如何将文本对齐到 IconButton 小部件的中心底部?
How to align a text to center bottom of a IconButton widget?
我想将文本与 IconButton 的底部中心对齐,但它不在中心,而是在开头。
我想要的示例:Image Here
它显示的东西:Image here
代码
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Align(
alignment: Alignment.center,
child: Text(
"All",
)),
],
),
],
),
我已经尝试了我所知道的一切,但仍然没有用。
如果你能帮我解决这个问题,非常感谢。
不要为您的 IconButton()
创建另一行 text
将您的 IconButton()
换成 Column()
并将 Text()
添加到 Column()
。
你可以这样做。
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
Text("ABC"),
],
),
],
),
],
);
你可以试试here
我想将文本与 IconButton 的底部中心对齐,但它不在中心,而是在开头。
我想要的示例:Image Here
它显示的东西:Image here
代码
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
Align(
alignment: Alignment.center,
child: Text(
"All",
)),
],
),
],
),
我已经尝试了我所知道的一切,但仍然没有用。 如果你能帮我解决这个问题,非常感谢。
不要为您的 IconButton()
创建另一行 text
将您的 IconButton()
换成 Column()
并将 Text()
添加到 Column()
。
你可以这样做。
Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceEvenly,
children: [
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.library_add_check,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.thumb_up,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.message,
size: 22,
)),
Text("abc"),
],
),
Column(
children:[
IconButton(
onPressed: () {},
icon: Icon(
Icons.supervisor_account,
size: 22,
)),
Text("ABC"),
],
),
],
),
],
);
你可以试试here