flutter - 在移动设备中实现 Flutter Web 的菜单
解决方案
您正在寻找的特定类型的小部件称为抽屉。您可以访问 https://flutter.dev/docs/cookbook/design/drawer了解完整详情。让我也举一个抽屉代码的例子。
class Trial extends State<State1> {
Widget build(BuildContext context) {
return Scaffold(
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
DrawerHeader(
child: Center(
child: Text(
'Choose an Option:',
style: TextStyle(
fontSize: 30,
),
),
),
decoration: BoxDecoration(
color: Colors.blue,
),
),
Padding(
child: Card(
child: ListTile(
leading: Icon(
Icons.add,
size: 35,
),
title: Text(
'Increment by 2',
style: TextStyle(
fontSize: 20,
),
textAlign: TextAlign.center,
),
onTap: () {
setState(() {
increment = 2;
Navigator.pop(context);
});
},
),
),
padding: EdgeInsets.all(9.0),
),
],
),
),
);
}
请注意。这不是要求的特定代码。我只提供了一个简洁的示例,可以对其进行调整以获得必要的结果。
推荐阅读
- amazon-web-services - 从 cron 重新启动弹性 beanstalk 应用程序服务器
- java - Can messages be lost at kafka producer side during deployment?
- c - C中的布尔函数“控件可能到达非无效函数的结尾”错误
- firebase - Firebase Admin SDK 错误 未找到请求的项目
- python - 如何使用 pandas 在数据框中搜索匹配的字符串?
- reactjs - React select 传递组件的 props to useMemo
- javascript - Tablesorter Jquery 库不工作
- spring - 与查询 JPA 的关系 - Spring
- docker - 如何通过 NGINX 代理在 Docker 中运行的 NuxtJs 应用程序?
- python - 在没有 for 循环的情况下取范数