alex-melnyk / flutter_advanced_drawer

https://pub.dev/packages/flutter_advanced_drawer
https://pub.dev/packages/flutter_advanced_drawer
BSD 3-Clause "New" or "Revised" License
70 stars 23 forks source link

No have animation when click menu item drawer or open to hide from menu #47

Open hafidprintsoft opened 7 months ago

hafidprintsoft commented 7 months ago

Animation not active when hide drawer from item menu different when open the drawer menu

cbassols commented 4 months ago

I am experiencing an issue where the reverse animation does not activate when calling _advancedDrawerController.hideDrawer(). The drawer closes instantly without the expected transition effect.

cbassols commented 4 months ago

I have resolved the animation timing issue when closing the drawer by using WidgetsBinding.instance.addPostFrameCallback. This ensures that the drawer's hide operation (_advancedDrawerController.hideDrawer()) is scheduled to run after the widget tree has been rebuilt.

ListTile(
    leading: Icon(Icons.dashboard),
    title: Text('Dashboard'),
    onTap: () async {
        _updateTabSelection(0, 'Dashboard');
        WidgetsBinding.instance.addPostFrameCallback((_) {
            _advancedDrawerController.hideDrawer();
        });
    },
)