Skip to content
Annika Muecke edited this page Jul 21, 2022 · 2 revisions

Idea behind the feed

The main purpose of the feed is to allow the user to take back actions that they added. It also serves as a way to see what happened in the last few moments of the game which can be useful during chaotic situations. Another reason why the feed exists is that the user gets visual feedback and sees that their inputs are registered by the app.

UI

The feed UI components can be found in lib > widgets > main_screen > action_feed.dart.

It is a scrollable ListView with dynamically updated row children. Each row contains a text displaying the actionType variable associated with the gameAction entered into the feed (TODO this might change in the future with better naming), a text with the name of the player and a trash can icon. grafik

Logic

The logic of the feed can be found in lib > utils > feed_logic.dart it interacts with the feedActions list, feedTimer and boolean variables stored in the corresponding GetX controller.

periodicFeedTimerReset is called whenever the periodic feedTimer reaches 0 seconds and pops an item of the feedActions list every x milliseconds. When this popping is performed the periodicResetIsHappening value in the GetX controller is updated to block a second timer reset which can be triggered by the StopWatchExecute.reset (this would set the feedTimer to 0 again calling onFeedTimerEnded and in turn periodicsFeedtimerReset again). (removed in the scope of #296)

addFeedItem adds a gameAction object to the feedItems list in the GetX controller. When an item is added the feedTimer is reset - starting over from the beginning. That way items only leave the feed during times of inactivity and the amount of items displayed in the feed increases during times of high activity. If the feed is full the oldest item is removed and a new action is added.

removeFeedItem gets called when the user clicks on a feed row, deleting the item from the gamestate and the database

Future changes:

  • clicking on feed should highlight the location action has been performed from with an x on the field
  • text displaying action should be in the right locale and easier to understand
  • feed item lifetime should be adjustable in settings
  • player changes should be seen in the feed too
  • amount of feed items to be displayed should adjustable in the settings

Clone this wiki locally