扑来:WebView中的抽屉充气
我在脚手架菜单中使用抽屉。当我将网络视图中的窗口较小时,抽屉消失并出现一个小按钮。 从左侧打开菜单。
我想将抽屉保留在此放气版本中以进行全窗口尺寸,但是我得到了一个静态菜单。我该如何改变?
代码:
Scaffold(
drawer: DrawerMenu(),
...
)
class DrawerMenu extends StatelessWidget {
const DrawerMenu({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: [
Container(
padding: EdgeInsets.all(appPadding),
child: Image.asset("assets/images/mylogo.png"),
),
DrawerListTile(
title: 'Something',
svgSrc: 'assets/icons/Dashboard.svg',
tap: () {Navigator.pop(context);}),
DrawerListTile(
title: 'Somethingelse',
svgSrc: 'assets/icons/BlogPost.svg',
tap: () {Navigator.pop(context);}),
],
),
);
}
}`
I am using a Drawer in a Scaffold menu. When I make the window in the web-view smaller, the Drawer vanishes and a small button appears.
which opens the menu from the left.
I would like to keep the drawer in this deflated version for full window size, but I get a static menu. How do I change that?
Code:
Scaffold(
drawer: DrawerMenu(),
...
)
class DrawerMenu extends StatelessWidget {
const DrawerMenu({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Drawer(
child: ListView(
children: [
Container(
padding: EdgeInsets.all(appPadding),
child: Image.asset("assets/images/mylogo.png"),
),
DrawerListTile(
title: 'Something',
svgSrc: 'assets/icons/Dashboard.svg',
tap: () {Navigator.pop(context);}),
DrawerListTile(
title: 'Somethingelse',
svgSrc: 'assets/icons/BlogPost.svg',
tap: () {Navigator.pop(context);}),
],
),
);
}
}`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在脚手架中使用抽屉属性的用途是显示&隐藏抽屉。
要使抽屉始终以全窗大小可见,请尝试根据屏幕宽度作为单独的小部件创建
The usage of drawer property in Scaffold is to show & hide the drawer.
To make the drawer always visible in full window size, try create as a seperate widget based on width of the screen