Flutter 柱中的颤振多交叉轴对准
是否有一种方法可以使列中的某些项使用Flutter 柱中的颤振多交叉轴对准,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,是否有一种方法可以使列中的某些项使用crossaxisalignment.start对齐,而其他项使用crossaxisalignment.center对齐 Column( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ // These text fie
crossaxisalignment.start
对齐,而其他项使用crossaxisalignment.center
对齐
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
// These text fields = crossaxisalignment.start
Text(
'Welcome',
textAlign: TextAlign.start,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.white,
fontSize: 36,
),
),
Text(
'To my test app',
textAlign: TextAlign.start,
style: TextStyle(
color: Colors.white,
),
),
SizedBox(height: 40.0),
// Everything else crossaxisalignment.center
TextFormField(
style: TextStyle(color: Colors.white),
textInputAction: TextInputAction.next,
focusNode: nodeOne,
onSaved: (value) => _email = value,
keyboardType: TextInputType.emailAddress,
decoration: InputDecoration(
prefixIcon:
Image.asset('assets/images/icons/Username.png'),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelText: "Email Address",
labelStyle: TextStyle(
color: nodeOne.hasFocus
? Colors.white
: Colors.grey),
),
),
TextFormField(
style: TextStyle(color: Colors.white),
textInputAction: TextInputAction.go,
focusNode: nodeTwo,
onSaved: (value) => _password = value,
obscureText: true,
decoration: InputDecoration(
prefixIcon: Image.asset(
'assets/images/icons/PasswordLock.png'),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.white),
),
labelStyle: TextStyle(
color: nodeTwo.hasFocus
? Colors.white
: Colors.grey),
labelText: "Password")),
SizedBox(height: 20.0),
FlatButton(
onPressed: () {},
child: Text('Forgotten password?',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white)),
),
ButtonTheme(
minWidth: MediaQuery.of(context).size.width,
height: 40,
child: RaisedButton(
textColor: prefix0.backgroundColor,
color: Colors.white,
child: Text("Login"),
onPressed: () {
_loginAction();
},
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(5.0))),
),
FlatButton(
onPressed: () {},
child: Text('Not registered?',
textAlign: TextAlign.center,
style: TextStyle(color: Colors.white)),
),
Divider(
indent: MediaQuery.of(context).size.width * 0.333333,
height: 5,
thickness: 3,
color: Colors.white,
endIndent: MediaQuery.of(context).size.width * 0.333333,
),
SizedBox(height: 15),
ButtonTheme(
minWidth: MediaQuery.of(context).size.width,
height: 40,
child: RaisedButton(
textColor: prefix0.backgroundColor,
color: Colors.white,
child: Text("Register here"),
onPressed: () {
_loginAction();
},
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(5.0))),
),
SizedBox(height: 20),
],
),
列(
mainAxisAlignment:mainAxisAlignment.end,
儿童:[
//这些文本字段=crossaxisalignment.start
正文(
“欢迎”,
textAlign:textAlign.start,
样式:TextStyle(
fontWeight:fontWeight.bold,
颜色:颜色,白色,
尺寸:36,
),
),
正文(
'到我的测试应用程序',
textAlign:textAlign.start,
样式:TextStyle(
颜色:颜色,白色,
),
),
尺寸箱(高度:40.0),
//其他所有内容都在.center中
TextFormField(
样式:TextStyle(颜色:Colors.white),
textInputAction:textInputAction.next,
focusNode:nodeOne,
onSaved:(值)=>\u email=value,
键盘类型:TextInputType.emailAddress,
装饰:输入装饰(
前缀:
Image.asset('assets/images/icons/Username.png'),
enabledBorder:UnderlineInputBorder(
borderSide:borderSide(颜色:Colors.grey),
),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.white),
),
labelText:“电子邮件地址”,
标签样式:文本样式(
颜色:nodeOne.hasFocus
?颜色:白色
:颜色。灰色),
),
),
TextFormField(
样式:TextStyle(颜色:Colors.white),
textInputAction:textInputAction.go,
focusNode:nodewo,
onSaved:(值)=>\u密码=值,
蒙昧文字:对,
装饰:输入装饰(
前缀:Image.asset(
“资产/图像/图标/密码锁.png”),
enabledBorder:UnderlineInputBorder(
borderSide:borderSide(颜色:Colors.grey),
),
FocusedOrder:下划线输入边框(
borderSide:borderSide(颜色:Colors.white),
),
标签样式:文本样式(
颜色:nodeTwo.hasFocus
?颜色:白色
:颜色。灰色),
labelText:“密码”),
尺寸箱(高度:20.0),
扁平按钮(
按下:(){},
子项:文本('忘记密码?',
textAlign:textAlign.center,
样式:TextStyle(颜色:Colors.white)),
),
钮扣(
minWidth:MediaQuery.of(context).size.width,
身高:40,
孩子:升起按钮(
textColor:prefix0.backgroundColor,
颜色:颜色,白色,
子项:文本(“登录”),
已按下:(){
_loginAction();
},
形状:新的RoundedRectangleBorder(
borderRadius:新的borderRadius.circular(5.0)),
),
扁平按钮(
按下:(){},
子项:文本('未注册?',
textAlign:textAlign.center,
样式:TextStyle(颜色:Colors.white)),
),
分隔器(
缩进:MediaQuery.of(context).size.width*0.333,
身高:5,,
厚度:3,
颜色:颜色,白色,
endIndent:MediaQuery.of(context).size.width*0.333333,
),
尺寸箱(高度:15),
钮扣(
minWidth:MediaQuery.of(context).size.width,
身高:40,
孩子:升起按钮(
textColor:prefix0.backgroundColor,
颜色:颜色,白色,
子项:文本(“在此处注册”),
已按下:(){
_loginAction();
},
形状:新的RoundedRectangleBorder(
borderRadius:新的borderRadius.circular(5.0)),
),
尺寸箱(高度:20),
],
),
更好的方法是使用列表视图
并使其子项对齐并设置对齐
属性
ListView(
children: <Widget>[
Align(
alignment: Alignment.centerLeft,
child: LeftWidget1(), // widget at left
),
Align(
alignment: Alignment.center,
child: CenterWidget1(), // widget at center
),
Align(
alignment: Alignment.centerRight,
child: RightWidget1(), // widget at right
),
],
)
ListView(
儿童:[
对齐(
对齐:对齐