【发布时间】:2022-01-12 19:16:37
【问题描述】:
我目前正在使用 Flutter/dart 为基本登录屏幕制作 GUI,并试图了解如何创建屏幕左侧所示的菜单栏。目前我的想法是有一行包含用户名和密码的文本字段,这似乎工作正常。然后使用一列作为侧面的菜单栏。我是使用颤振的新手,并且了解创建基本应用程序的基础知识,但我无法理解是否应该为菜单栏使用列,或者是否有更好的方法。
class LoginPage extends HookWidget {
LoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.blueGrey[100],
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 0,
title: Text(useL10n().loginTitle),
actions: <Widget> [
IconButton(
icon: Icon(
Icons.bluetooth,
), onPressed: () {
},
),
],
),
body: Padding(
padding: EdgeInsets.all(15),
child: Row(
children: <Widget>[
Expanded(
child: Padding(
padding: EdgeInsets.all(15),
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'USERNAME',
),
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(15),
child: TextField(
decoration: InputDecoration(
border: OutlineInputBorder(),
labelText: 'PASSWORD',
),
),
),
),
Container(
color: Colors.blue[800], // Should I use a container here to create the menu
child: Column(
),
),
],
),
),
);
}
}
我遇到的问题是我在行中有一个嵌套列,所以当我构建和运行代码时它甚至没有显示出来。我只看到用户名和密码的行。
【问题讨论】:
标签: flutter android-studio dart