Skip to content

Helpers

Janina Krueger edited this page Jul 2, 2022 · 8 revisions

Adapt app bar (Issue #139)

Bildschirmfoto_von_2022-06-06_14-03-25
According to our UI draft the app bar was removed from all scaffold screens and replaced by a menu button in the top left. Therefore, the appBar parameter in the Scaffolds was replaced by a drawer and key parameter. The drawer parameter is given our NavDrawer() menu and for the key a GlobalKey is added. With this configuration, by pressing the menu button, the given drawer is opened.

Adapt Side Menu (Issue #160)

Bildschirmfoto_von_2022-07-01_16-19-19 Bildschirmfoto_von_2022-07-01_16-19-33 Bildschirmfoto_von_2022-07-01_16-19-50
To adapt the side menu to our design draft, some steps were necessary:

  • Most changes had to be done in NavDrawer class in NavDrawer.dart.

    • It contains now of a Stack of a ListView and the sign-out button. This is, because the sign-out button should always be positioned at the bottom. If it was in the ListView, its position would move on collapsing of ListTiles.
    • The ListTiles of the ListView are build with the function buildMenuList in a GetBuilder. The GetBuilder is needed here, because the Back to Game button should only be shown when the global variables show, that a game is actually running. To build the individual ListTiles, there are two classes:
      • SimpleListEntry: Returns a non-collabsible ListTile which takes you to the screen which is given as parameter.
      • CollabsibleListEntry: Returns a collabsible list entry (ExpansionTile), which takes you to the screen which is given as parameter. On collapsing, it shows other list entries, which are given as parameter.
  • In TempController three variables were added:

    • _playingTeam is added, so it is possible to distinguish between _selectedTeam and _playingTeam. This is needed, because when a game is running (_selectedTeam) and the user changes to a Team settings screen of another team (_selectedTeam), the team of the running game has to be cached.
      So when changing to team settings screen during a game, the _selectedTeam variable is changed and changed back to _playingTeam when going back to the game.
    • _gameIsPaused is added, so it can be distinguised between if a game was started but the time is not running and no game was started at all. This is needed to know when to show the back to game button.
    • _menuIsEllapsed is added, so we have knowledge about if a menu entry in the drawer is ellapsed or not. If some entry is ellaped, the back to game button disappears, because otherwise it would move which looks strange.
  • In all screens the following Scaffold parameter was added:

              onDrawerChanged: (isOpened) {
                if (!isOpened) {
                  tempController.setMenuIsEllapsed(false);
                }
              }
    
    • This is to set the TempController parameter _menuIsEllapsed to false, if the drawer closes. When the drawer opens again, all menu entries will not be ellapsed even if they were ellapsed on closing the drawer.

Clone this wiki locally