gpt4 book ai didi

flutter - 如何更改抽屉导航的工具栏颜色

转载 作者:行者123 更新时间:2023-12-03 04:44:21 26 4
gpt4 key购买 nike

如何更改抽屉导航的工具栏颜色。

最佳答案

只需添加 padding: EdgeInsets.all(0.0),在您的 listview Drawer 内的小部件小部件
试试这个

class HomePage extends StatefulWidget {
@override
_HomePageScreen createState() => _HomePageScreen();
}

class _HomePageScreen extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Home"),
),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.all(0.0),
children: <Widget>[
UserAccountsDrawerHeader(
accountName: Text("Nilesh Rathod"),
accountEmail: Text("nilesh@gmail.com"),
currentAccountPicture: CircleAvatar(
backgroundColor: Colors.white,
child: Text("Nilu"),
),
),
ListTile(
title: Text("Home"),
trailing: Icon(Icons.new_releases),
),
Divider(),
ListTile(
title: Text("Profile"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Tab Layout"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Comman View Demo"),
trailing: Icon(Icons.person),
onTap: () => {},
),
Divider(),
ListTile(
title: Text("Close"),
trailing: Icon(Icons.close),
onTap: () => Navigator.of(context).pop(),
),
],
),
),
body: CachedNetworkImage(
imageUrl: '/image/K8FFo.jpg?s=328&g=1',
placeholder: (context, url) => CircularProgressIndicator(), //<= ends here
errorWidget: (context, url, error) => Icon(Icons.error)),
);
}
}
输出

With padding: EdgeInsets.all(0.0),


enter image description here

Without padding: EdgeInsets.all(0.0),


enter image description here

关于flutter - 如何更改抽屉导航的工具栏颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62557573/

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