fixed bug with logout menu item
This commit is contained in:
@@ -58,20 +58,32 @@ abstract class BaseState<T extends StatefulWidget> extends State<T> {
|
||||
}
|
||||
|
||||
List<Widget> getMenuButtons() {
|
||||
|
||||
List<Widget> menuItemList = [];
|
||||
menuItemList.add(new PopupMenuItem(
|
||||
value: 0,
|
||||
child: getMenuItem(settings_png, StringsLocalization.settings())
|
||||
));
|
||||
|
||||
menuItemList.add(new PopupMenuItem(
|
||||
value: 1,
|
||||
child: getMenuItem(settings_png, StringsLocalization.help())
|
||||
));
|
||||
|
||||
helper.getToken().then((token){
|
||||
if (token != null) { // пользователь авторизован
|
||||
menuItemList.add(new PopupMenuItem(
|
||||
value: 2,
|
||||
child: getMenuItem(settings_png, StringsLocalization.logout())
|
||||
));
|
||||
}
|
||||
});
|
||||
|
||||
return <Widget>[
|
||||
new PopupMenuButton<int>(
|
||||
onSelected: onOptionsItemClick,
|
||||
itemBuilder: (BuildContext context) {
|
||||
return [new PopupMenuItem(
|
||||
value: 0,
|
||||
child: getMenuItem(settings_png, StringsLocalization.settings())),
|
||||
new PopupMenuItem(
|
||||
value: 1,
|
||||
child: getMenuItem(help_png, StringsLocalization.help())),
|
||||
new PopupMenuItem(
|
||||
value: 2,
|
||||
child: getMenuItem(logout_png, StringsLocalization.logout()))
|
||||
];
|
||||
return menuItemList;
|
||||
}
|
||||
)
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user