屏幕底部的抽屉在颤动
drawer at bottom of screen in flutter
我想要一个回忆应用程序。在此应用程序中,您可以单击一个内存,它会在底部打开一个抽屉,如下所示:https://i.stack.imgur.com/6lWeb.png 我认为从 ui 的角度来看这是有道理的,因为从侧面打开抽屉会浪费屏幕除非您处于横屏模式,否则不会影响您的财产,但人们不会。
我尝试在 google 上搜索 我确实找到了:
return Scaffold(
key: _scaffoldKey,
endDrawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(child: Text("right drawer"))
但是在 dartpad 中这没有用,因为没有定义 endDrawer bottomDrawer 也没有用。
showModalBottomSheet 应该可以满足您的需求。它过去对我有用。
这是我在过去的待办事项列表项目中使用的代码片段,其中包括 showModalBottomSheet:
class TasksScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightBlueAccent,
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.lightBlueAccent,
child: Icon(Icons.add),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) => AddTaskScreen(),
);
上面的代码片段激活了模式底部 sheet 在单击浮动操作按钮后从应用底部向上滑动。
它在我的应用程序中的外观图片:https://i.stack.imgur.com/p41J8.jpg
颤振文档:
https://api.flutter.dev/flutter/material/showModalBottomSheet.html
我想要一个回忆应用程序。在此应用程序中,您可以单击一个内存,它会在底部打开一个抽屉,如下所示:https://i.stack.imgur.com/6lWeb.png 我认为从 ui 的角度来看这是有道理的,因为从侧面打开抽屉会浪费屏幕除非您处于横屏模式,否则不会影响您的财产,但人们不会。
我尝试在 google 上搜索 我确实找到了:
return Scaffold(
key: _scaffoldKey,
endDrawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
DrawerHeader(child: Text("right drawer"))
但是在 dartpad 中这没有用,因为没有定义 endDrawer bottomDrawer 也没有用。
showModalBottomSheet 应该可以满足您的需求。它过去对我有用。
这是我在过去的待办事项列表项目中使用的代码片段,其中包括 showModalBottomSheet:
class TasksScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.lightBlueAccent,
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.lightBlueAccent,
child: Icon(Icons.add),
onPressed: () {
showModalBottomSheet(
context: context,
builder: (context) => AddTaskScreen(),
);
上面的代码片段激活了模式底部 sheet 在单击浮动操作按钮后从应用底部向上滑动。
它在我的应用程序中的外观图片:https://i.stack.imgur.com/p41J8.jpg
颤振文档: https://api.flutter.dev/flutter/material/showModalBottomSheet.html