gpt4 book ai didi

Flutter 将应用栏标题向左偏移

转载 作者:IT王子 更新时间:2023-10-29 06:55:53 27 4
gpt4 key购买 nike

我正在为我的应用程序创建页面,并且我已经创建了带有前导图标的应用程序栏。然而,图标和标题之间的空间非常大,对我来说,看起来不合适。

我确实将应用栏的标题向左偏移/推了一点。

代码:

appBar: AppBar(
leading: Builder(
builder: (BuildContext context) {
return IconButton(
icon: const Icon(Icons.chevron_left),
iconSize: MediaQuery.of(context).size.width * 0.1,
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
padding: EdgeInsets.fromLTRB(0.0, 0.0, 0.0, 0.0),
onPressed: () => Navigator.of(context).pop(),
);
},
),
title: Text("Student Finance",
style: TextStyle(color: Colors.white),
),
),

截图:

enter image description here

最佳答案

//添加标题小部件下的所有内容并使前导为假

AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
IconButton(
onPressed: () => Navigator.pop(context),
icon: const Icon(Icons.chevron_left, size: 32.0),
),
Text("Student Finance"),
],
),
titleSpacing: 0.0,
automaticallyImplyLeading: false,
),

关于Flutter 将应用栏标题向左偏移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57437005/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com