颤动:我想在中心放置文本
flutter: I want text in Center
我吵架了。在这一行中,我有两个小部件,一个在图标中,一个是文本,在这一行中,我的图标固定在左侧,我希望我的文本位于这一行的中央,我的图标将固定
这是我的代码。
child: Column(
children: [
Container(
color: mPrimaryColor,
height: MediaQuery.of(context).size.height / 23,
width: MediaQuery.of(context).size.width,
child: Row(
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Spacer(),
Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),
Spacer(),
],
),
),],),
试试这个:
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Expanded(child: Center(child: Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),),),
SizedBox(
width: 45,
),
],
我吵架了。在这一行中,我有两个小部件,一个在图标中,一个是文本,在这一行中,我的图标固定在左侧,我希望我的文本位于这一行的中央,我的图标将固定
这是我的代码。
child: Column(
children: [
Container(
color: mPrimaryColor,
height: MediaQuery.of(context).size.height / 23,
width: MediaQuery.of(context).size.width,
child: Row(
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Spacer(),
Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),
Spacer(),
],
),
),],),
试试这个:
children: [
SizedBox(
width: 15,
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
height: MediaQuery.of(context).size.height / 23,
width: 30,
child: Icon(
Icons.arrow_back_ios_rounded,
size: 20,
color: whitetext,
),
),
),
Expanded(child: Center(child: Text(
// "${widget.headerName}".tr(),
"ADMINISTRATIVE CONTACT",
style: headingWhite(),
textAlign: TextAlign.center,
),),),
SizedBox(
width: 45,
),
],