我用Container做了一个自定义的应用栏,但我需要将标题放在行的中心,后退按钮放在左侧的边缘。我确实尝试了添加隔板、mainaxisallignment等一切,但没有按照要求正确放置。那么有没有什么方法可以让我利用呢?先谢谢你了。
Widget header() {
return new Container(
height: 140,
decoration: BoxDecoration(
color: Color(0xFFAFDCEC),
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(20),
bottomRight: Radius.circular(20))),
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(
height: 60,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
IconButton(icon: Icon(Icons.arrow_back_ios, color: Colors.white,),),
Text(
'To-Do List',
style: TextStyle(color: Colors.white, fontSize: 25),
)
],
)
],
),
);
}
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
SizedBox(width:10), //if you want to have some space (like 10px) from left edge for back button use this or wrapping IconButton with Padding with only left prameter
IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
onPressed: () {}),
Expanded(
child: Center(
child: Text(
'To-Do List',
style: TextStyle(color: Colors.white, fontSize: 25),
),
),
),
],
)