【发布时间】:2023-03-13 23:57:01
【问题描述】:
我正在尝试使抽屉图标大于默认大小,我正在使用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'),
),
],
),
),
【问题讨论】:
-
“ListView 来自左侧而不是右侧”是什么意思?
-
这里侧边栏从右边开始到左边结束,而不是我想从左边开始到右边结束imgur.com/a/GygwllG
-
明白了,那么抽屉图标呢?你能分享一下你现在拥有的代码吗?
-
设置右侧抽屉我使用
endDrawer(见上文)但是当我按下按钮打开侧边栏时它从右侧打开它,因为我相信它是`endDrawer`的属性而且我不知道如何按住右侧的按钮从左到右“强制”打开。 Whitwidth: MediaQuery.of(context).size.width * 0.85,我试图让图标变大,但它不起作用 -
我明白这一点。你提到了图标大小的问题,但在上面的代码中我看不到使用的图标。
标签: flutter dart flutter-layout