下面的代码列出了一个图表,我需要在图表中实现图表在垂直(高度)和水平(宽度)方向上的扩展.建议的方法(例如https://docs.flutter.io/flutter/widgets/Row-class.html)将Expanded在Row或中使用Column.
我正在尝试扩展的图表小部件扩展CustomPaint,没有孩子,所有内容都是使用CustomPainter画布绘制的CustomPainter.paint(canvas, size).
这段代码
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
'vvvvvvvv:',
),
new RaisedButton(
color: Colors.green,
onPressed: _chartStateChanger,
),
new Text(
'vvvvvvvv:',
),
new Expanded( // Expanded in Column, no expansion vertically
child: new Row(
children: [
new Text('>>>'),
new Expanded(// Expanded in Row, expands horizontally
child: new Chart( // …Run Code Online (Sandbox Code Playgroud) flutter ×1