自定义抽屉图标颤动



我正在尝试使抽屉图标大于默认大小,并且我正在使用width: MediaQuery.of (context) .size.width * 0.85,但它不起作用,我不知道为什么。然后我希望ListView从左边而不是右边,但我需要菜单图标在右边。我该怎么做?

endDrawer: Container(
width: MediaQuery.of(context).size.width * 0.85,
child: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children:  <Widget>[
DrawerHeader(
decoration: BoxDecoration(
color: Colors.deepOrange,
),
child: Text(
'Drawer Header',
style: TextStyle(
color: Colors.white,
fontSize: 24,
),
),
),
ListTile(
leading: Icon(Icons.message),
title: Text('Messages'),
onTap: () {
Navigator.push(context,MaterialPageRoute(builder: (context) => StantonPlanet()));
}
),
ListTile(
leading: Icon(Icons.account_circle),
title: Text('Profile'),
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
),
],
),
),

我找到了一个修复

appBar: AppBar(
automaticallyImplyLeading: false,
//backgroundColor: red,
toolbarHeight: 120,
centerTitle: false,
actions: [
IconButton(
icon: Icon(Icons.menu_rounded),
iconSize: 35,
onPressed: () => _scaffoldKey.currentState!.openDrawer()
),
],
leading: IconButton(
icon: Icon(Icons.arrow_back),
iconSize: 35,
onPressed: () => Navigator.of(context).pop(),
),
title: Text('App Bar', style: TextStyle(color: white, fontSize: 30,),),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
bottom: Radius.circular(30),
),
),
),
Scaffold(
appBar: AppBar(
title:Text('hi'),
leading: IconButton(
icon: Icon(Icons.menu),
onPressed: () => Scaffold.of(context).openDrawer(),
),
),

最新更新