我在下面写了StatefulWidget
,但在这一部分:
new FlatButton(
child: new Text(
...
)
),
我收到以下错误:
[dart]无法将参数类型“Text”分配给参数 输入'Row'。
完整的代码是:
part of awesome_library;
class ContentPage extends StatefulWidget {
ContentPage({Key key, this.title}) : super(key: key);
final String title;
@override
_ContentPageState createState() => new _ContentPageState();
}
class _ContentPageState extends State<ContentPage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Text(
'Click the button below to navigate back to the home screen ',
style: Theme.of(context).textTheme.display1,
),
new FlatButton(
child: new Text(
"ok",
style: Theme.of(context).textTheme.display1,
),
textColor: new Color(0xFF66BB6A),
onPressed: () => Navigator.of(context).pushNamed('/home'),
),
],
),
),
);
}
}