Flutter 如何在Flatter中对齐容器内的内容物?
我在这个圆形容器中添加了几个按钮。我想把中间对齐。最初,当我添加它们时,它们是完全对齐的,但当我更改按钮下方文本的大小时,对齐方式也发生了变化。代码如下:Flutter 如何在Flatter中对齐容器内的内容物?,flutter,dart,alignment,Flutter,Dart,Alignment,我在这个圆形容器中添加了几个按钮。我想把中间对齐。最初,当我添加它们时,它们是完全对齐的,但当我更改按钮下方文本的大小时,对齐方式也发生了变化。代码如下: Stack( children: <Widget>[ Padding( padding: const EdgeInsets.only(top: 290.0, left: 8, right:
Stack(
children: <Widget>[
Padding(
padding:
const EdgeInsets.only(top: 290.0, left: 8, right: 8),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
const BorderRadius.all(Radius.circular(16.0)),
),
height: 110,
),
),
Padding(
padding: const EdgeInsets.only(top: 110.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 198.0, left: 0),
child: Column(
children: <Widget>[
Container(
height: 50,
width: 50,
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFFFF8C3B),
const Color(0xFFFE524B)
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
color: Colors.orange,
shape: BoxShape.circle,
),
child: Icon(Entypo.login,
color: Colors.white)),
SizedBox(
height: 5,
),
Text('Sign In', style: TextStyle(
color: Color(0xFFFF8C3B),
fontFamily: "Netflix",
fontWeight: FontWeight.bold,
fontSize: 17)),
],
),
),
Padding(
padding:
const EdgeInsets.only(top: 198.0, left: 25),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
height: 50,
width: 50,
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFFFF8C3B),
const Color(0xFFFE524B)
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
color: Colors.orange,
shape: BoxShape.circle,
),
child: Padding(
padding: const EdgeInsets.only(
left: 2.0, top: 1),
child: Container(
child: Icon(Entypo.credit,
color: Colors.white)),
)),
SizedBox(
height: 5,
),
Text('Payments', style: TextStyle(
color: Color(0xFFFF8C3B),
fontFamily: "Netflix",
fontWeight: FontWeight.bold,
fontSize: 17)),
],
),
),
Padding(
padding:
const EdgeInsets.only(top: 198.0, left: 15),
child: Column(
children: <Widget>[
Container(
height: 50,
width: 50,
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFFFF8C3B),
const Color(0xFFFE524B)
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
color: Colors.orange,
shape: BoxShape.circle,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Icon(Entypo.log_out,
color: Colors.white)),
)),
SizedBox(
height: 5,
),
Text('Sign Out', style: TextStyle(
color: Color(0xFFFF8C3B),
fontFamily: "Netflix",
fontWeight: FontWeight.bold,
fontSize: 17)),
],
),
),
Padding(
padding:
const EdgeInsets.only(top: 198.0, left: 20),
child: Column(
children: <Widget>[
Container(
height: 50,
width: 50,
decoration: new BoxDecoration(
gradient: LinearGradient(
colors: [
const Color(0xFFFF8C3B),
const Color(0xFFFE524B)
],
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
color: Colors.orange,
shape: BoxShape.circle,
),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Icon(Entypo.info,
color: Colors.white)),
)),
SizedBox(
height: 5,
),
Text('About Us', style: TextStyle(
color: Color(0xFFFF8C3B),
fontFamily: "Netflix",
fontWeight: FontWeight.bold,
fontSize: 17)),
],
),
),
],
),
),
],
),
堆栈(
儿童:[
填充物(
衬垫:
仅限常数边集(顶部:290.0,左侧:8,右侧:8),
子:容器(
装饰:盒子装饰(
颜色:颜色,白色,
边界半径:
常数边界半径所有(半径圆形(16.0)),
),
身高:110,
),
),
填充物(
填充:仅限常量边集(顶部:110.0),
孩子:排(
crossAxisAlignment:crossAxisAlignment.center,
mainAxisAlignment:mainAxisAlignment.space,
儿童:[
填充物(
填充:仅限常量边集(顶部:198.0,左侧:0),
子:列(
儿童:[
容器(
身高:50,
宽度:50,
装饰:新盒子装饰(
梯度:线性梯度(
颜色:[
常量颜色(0xFFFF8C3B),
常量颜色(0xFFFE524B)
],
开始:Alignment.centerLeft,
结束:对齐。中间右侧,
),
颜色:颜色。橙色,
形状:BoxShape.circle,
),
子:图标(Entypo.login,
颜色:颜色。白色),
大小盒子(
身高:5,,
),
Text(“登录”,样式:TextStyle)(
颜色:颜色(0xFFFF8C3B),
fontFamily:“Netflix”,
fontWeight:fontWeight.bold,
尺寸:17),,
],
),
),
填充物(
衬垫:
仅限常数边集(顶部:198.0,左侧:25),
子:列(
mainAxisAlignment:mainAxisAlignment.start,
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
容器(
身高:50,
宽度:50,
装饰:新盒子装饰(
梯度:线性梯度(
颜色:[
常量颜色(0xFFFF8C3B),
常量颜色(0xFFFE524B)
],
开始:Alignment.centerLeft,
结束:对齐。中间右侧,
),
颜色:颜色。橙色,
形状:BoxShape.circle,
),
孩子:填充(
填充:仅限常量边设置(
左:2.0,上:1),
子:容器(
子项:图标(Entypo.credit,
颜色:颜色。白色),
)),
大小盒子(
身高:5,,
),
文本(“付款”,样式:TextStyle)(
颜色:颜色(0xFFFF8C3B),
fontFamily:“Netflix”,
fontWeight:fontWeight.bold,
尺寸:17),,
],
),
),
填充物(
衬垫:
仅限常数边集(顶部:198.0,左侧:15),
子:列(
儿童:[
容器(
身高:50,
宽度:50,
装饰:新盒子装饰(
梯度:线性梯度(
颜色:[
常量颜色(0xFFFF8C3B),
常量颜色(0xFFFE524B)
],
开始:Alignment.centerLeft,
结束:对齐。中间右侧,
),
颜色:颜色。橙色,
形状:BoxShape.circle,
),
孩子:填充(
填充:常数边集全部(8.0),
子:容器(
子:图标(Entypo.log_out,
颜色:颜色。白色),