Closed ekimia closed 1 year ago
This can be done by passing fade transition into the child and animationController properties of the drawer, so no sense to add this into the plugin.
return AdvancedDrawer(
animationController: animationController,
child: FadeTransition(
opacity: Tween<double>(
begin: 1.0,
end: 0.25,
).animate(animationController),
child: Scaffold(
appBar: AppBar(
title: const Text('Advanced Drawer Example'),
leading: IconButton(
onPressed: _handleMenuButtonPressed,
icon: ValueListenableBuilder<AdvancedDrawerValue>(
valueListenable: _advancedDrawerController,
builder: (_, value, __) {
return AnimatedSwitcher(
duration: Duration(milliseconds: 250),
child: Icon(
value.visible ? Icons.clear : Icons.menu,
key: ValueKey<bool>(value.visible),
),
);
},
),
),
),
body: Container(),
),
),
drawer: SafeArea(
child: Container(
child: ListTileTheme(
textColor: Colors.white,
iconColor: Colors.white,
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Container(
width: 128.0,
height: 128.0,
margin: const EdgeInsets.only(
top: 24.0,
bottom: 64.0,
),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.black26,
shape: BoxShape.circle,
),
child: Image.asset(
'assets/images/flutter_logo.png',
),
),
ListTile(
onTap: () {},
leading: Icon(Icons.home),
title: Text('Home'),
),
ListTile(
onTap: () {},
leading: Icon(Icons.account_circle_rounded),
title: Text('Profile'),
),
ListTile(
onTap: () {},
leading: Icon(Icons.favorite),
title: Text('Favourites'),
),
ListTile(
onTap: () {},
leading: Icon(Icons.settings),
title: Text('Settings'),
),
Spacer(),
DefaultTextStyle(
style: TextStyle(
fontSize: 12,
color: Colors.white54,
),
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 16.0,
),
child: Text('Terms of Service | Privacy Policy'),
),
),
],
),
),
),
),
);
Adds an
IgnorePointer
widget to optionally animate the decoration as the drawer opens and closes, similar to the Twitter app on iOS:https://user-images.githubusercontent.com/357513/210119394-63b64eda-53ea-4454-811d-dd6ba01fc850.MP4