以下 Flutter 布局(列内有两行,每行包含一个文本小部件和一个字段小部件)编译并运行 - 但文本和文本字段小部件未显示。您应该看到的是单词“用户名”后跟一行中的文本字段,以及单词“密码”后跟下一行中的文本字段。请问我做错了什么?
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Welcome to Flutter',
home: new Scaffold(
appBar: new AppBar(
title: new Text('Welcome to Flutter'),
),
body: new Container(
padding: new EdgeInsets.all(20.0),
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
new Text('User Name'),
new TextField(
autofocus: true,
decoration: new InputDecoration(
border: InputBorder.none,
hintText: 'Please enter your user name'),
),
],
),
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
new Text('User Name'),
new TextField(
decoration: new InputDecoration(
border: InputBorder.none,
hintText: 'Please enter your pasword'),
),
],
),
],
),
)),
);
}
}