我只想通过从屏幕上的任意点从左向右滑动来打开左侧导航窗格,而不仅仅是从最左边滑动。
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Best Shape of My Life.',
theme: ThemeData(primaryColor: Colors.green, fontFamily: 'Product-Sans'),
home: Scaffold(
appBar: AppBar(
title: const Text('Best Shape of My Life.'),
centerTitle: true,
backgroundColor: Colors.black,
),
body: const Center(
child: Text('Woww World'),
),
backgroundColor: Colors.black,
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
))),
);
}
}
这会打开导航栏,但仅当从最左侧滑动时才会打开,这会导致问题,因为我使用滑动导航。
您是否尝试过研究手势检测器?您也许可以将抽屉类包装到手势检测器中并触发抽屉打开。这也可能意味着自定义小部件。
https://api.flutter.dev/flutter/widgets/GestureDetector-class.html