I am using the drawer menu in my application with the default menu (close the example of the homepage), and the navigation between pages works great.
However, in the 'logout' option I need to dispatch this event in my bloc, and not navigate to any page. So I tried using onTap by calling a logout function, But when I click, nothing happens. Any ideas?
List<ScreenHiddenDrawer> itens = new List();
_HomeScreenState(this._user);
@override
void initState() {
super.initState();
itens.add(new ScreenHiddenDrawer(
new ItemHiddenMenu(
name: 'Home',
colorLineSelected: Colors.red[700],
selectedStyle: TextStyle(fontWeight: FontWeight.w700),
),
HomeTab()));
itens.add(new ScreenHiddenDrawer(
new ItemHiddenMenu(
name: 'Card',
colorLineSelected: Colors.red[700],
selectedStyle: TextStyle(fontWeight: FontWeight.w700)),
cardTab()));
itens.add(new ScreenHiddenDrawer(
new ItemHiddenMenu(
name: 'Offers',
colorLineSelected: Colors.red[700],
selectedStyle: TextStyle(fontWeight: FontWeight.w700)),
offersTab()));
itens.add(new ScreenHiddenDrawer(
new ItemHiddenMenu(
name: 'Exit',
colorLineSelected: Colors.red[700],
selectedStyle: TextStyle(fontWeight: FontWeight.w700),
onTap: () {
_exitToApp();
},
),
null)); ///i'm replace with empty container, but has the same effect
}
void _exitToApp() {
...
}
@override
void dispose() {
super.dispose();
}
Widget cardTab() {
...
}
Widget homeTab() {
...
}
Widget offersTab() {
...
}
@override
Widget build(BuildContext context) {
return HiddenDrawerMenu(
initPositionSelected: 0,
backgroundColorMenu: Colors.grey,
backgroundColorAppBar: Theme.of(context).primaryColor,
elevationAppBar: 2,
isTitleCentered: true,
whithAutoTittleName: true,
screens: itens,
backgroundColorContent: Theme.of(context).scaffoldBackgroundColor,
enableShadowItensMenu: true,
contentCornerRadius: 10,
slidePercent: 60,
verticalScalePercent: 85,
isDraggable: true,
curveAnimation: Curves.fastLinearToSlowEaseIn,
enableScaleAnimin: true,
enableCornerAnimin: true ),
);
}
}```