class Home extends StatefulWidget {
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
late final ZoomDrawerController _controller;
@override
void initState() {
super.initState();
_controller = ZoomDrawerController(vsync: this);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (_controller.isOpen) {
await _controller.close();
return false;
} else {
return true;
}
},
child: ZoomDrawer(
controller: _controller,
childBorderRadius: BorderRadius.circular(16),
drawer: Material(
color: Colors.transparent,
child: SafeArea(
child: ListView(
padding: const EdgeInsets.all(16),
children: [
ListTile(
leading: Icon(Icons.home),
title: Text('Home'),
),
ListTile(
leading: Icon(Icons.settings),
title: Text('Settings'),
),
],
),
),
),
child: Scaffold(
appBar: AppBar(
leading: IconButton(
onPressed: () {
print('icon button pressed');
_controller.toggle();
},
icon: Icon(Icons.menu),
),
title: Text('zoom_drawer Example'),
actions: [
IconButton(
onPressed: () {
print('icon button pressed');
_controller.toggle();
},
icon: Icon(Icons.menu),
),
],
),
body: Center(
child: Text('zoom_drawer Example'),
),
),
),
);
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
License
jezsung/zoom_drawer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published