From eee57e727aef47061a54c67ceebae553162d156f Mon Sep 17 00:00:00 2001 From: Semyon Babushkin Date: Wed, 22 Nov 2017 19:12:10 +0300 Subject: [PATCH] fixed bug with logout menu item --- android/app/app.iml | 24 ++++++++++++++---------- lib/base/base_state.dart | 32 ++++++++++++++++++++++---------- lib/common.dart | 2 +- 3 files changed, 37 insertions(+), 21 deletions(-) diff --git a/android/app/app.iml b/android/app/app.iml index d5685ba..d2a2cf4 100644 --- a/android/app/app.iml +++ b/android/app/app.iml @@ -145,21 +145,25 @@ - + - - + + + - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/lib/base/base_state.dart b/lib/base/base_state.dart index 28172ad..ffaa588 100644 --- a/lib/base/base_state.dart +++ b/lib/base/base_state.dart @@ -58,20 +58,32 @@ abstract class BaseState extends State { } List getMenuButtons() { + + List 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 [ new PopupMenuButton( 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; } ) ]; diff --git a/lib/common.dart b/lib/common.dart index 4dec9ab..73c7339 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -216,6 +216,6 @@ getLocaleTitle(String code) { } // Добавил вызов, что-бы AOT компилер не выкинул либу. -getImage() { +getImage() async { return await ImagePicker.pickImage(); }