Until now, FoodEntryBloc (which is holding the global state for every
day) would cause a change in every widget in the tree. For example, when
an entry for one day gets added, all other entries in opened days would
also be rebuilt.
Now, the GlobalState will be emitted with an additional date, which
signals, which date caused the state change.
With this information, I selectively only build the EntryLists that
needs to be rebuilt.
Additionally, the calendar FAB will push a new route instead of
navigating to a new day by utilizing the pageController.
1. Show PerDate widgets inside of an PageView
2. Introduce GoRouter so we can intercept back button taps with
BackButtonListener
3. Implement rudimentary navigation
4. Fix bug that still showed a spinner event when the barcode was not
found.
the EnterFoodWidget.
1. Make scanned foods appear in the list of foods
2. Remove Controller for entering food
This commit removes the EnterFoodController that was used to put a
scanned food into the EnterFoodWidget.
This is now unnecessary because scanning a product will be distributed
via the FoodBLoC.
This fixes a bug that was caused by a name containing a comma.
We store the food entries in a csv so logically a comma in the name,
causes the parser to crash.
We fix this, by wrapping the name in quotation marks and writing a new
parser for food entries.
Previously, when you would navigate to a PerDate widget that already
exists on the Navigation stack, a food that is entered will not be
visible when popping to the PerDate widget with the same date.
This is because the state is not updated (the BLoC exists per PerDate
widget, and a change in one widget does not cause firing an event in the previous widget's BLoC).
With this fix, we call setState() and update the entries for the widget
from storage.