Commit graph

34 commits

Author SHA1 Message Date
Jakob Meier
eba0790f7c
More bug fixes (see description)
- Fixed bug where opening room would show null-error,
  for a couple of seconds.
  This was caused by the FAB not checking if widget.info!=null

- Added try&catch for item category,
  to prevent index-out-of-bounds when the item uses a category
  that no longer exists

- Renamed add/remove Articles to fit the new name: ShoppingListItem
2023-04-05 09:23:41 +02:00
Jakob Meier
5b398eb2ae
Bug fixes (see description)
- Fixed bug where switching room pages
  (list,products,categories,about),
  would result an unknown error,
  due to setState being called on a widget that isn't mounted.
  This was solved by surrounding the setState function,
  with a condition to check if the widget is mounted

- Fixed bug where room members weren't recognized as admins
  This was caused by a typedifference between the server and the app
  (The server now returns booleans,
  where as before a ==1 comparison was
  needed)
- Fixed bug where successfully closing the admin/kick member dialog,
  would crash the application.
  This was caused by popping the same context twice.
  We are now using two navigator (the outer and the inner one)
2023-04-05 08:54:48 +02:00
Jakob Meier
89c0b069e1
Formatted some files 2023-04-04 20:33:49 +02:00
Jakob Meier
5cd21c8adf
Added Combined new/edit and view product screen
Similarily to categories and rooms,
the edit product screen is reused as a new-room screen,
which is especially easy, because the user is unable to select
the product id themselves.
NOTE: the dynamic value-unit input is still missing some "subunits"

The view product screen has links to the edit product page,
the view parent page (if available) and a not yet functional
view children screen.
NOTE: The parent product display should be restricted in width,
and the screen is missing value/unit information.
2023-04-04 20:28:26 +02:00
Jakob Meier
47387bb395
Added basic Shopping List and Product list
including the ability to
add item into the shopping cart and remove them.

The click events have been implemented,
however the routes do not exist yet.

NOTE: The shopping list item info sheet is still missing
the unit type and value
and some more advanced options, like deleting the item
2023-04-04 10:29:29 +02:00
Jakob Meier
8706122590
Merged EditRoom and NewRoom page
and moved ChangeRoomIcon-Dialog into seperate file.

This was done in an attempt to remove redundancy
2023-04-02 13:19:24 +02:00
Jakob Meier
4cfa4c2ad0
Fixed bug where closing the icon selector would close the screen 2023-04-02 13:19:24 +02:00
Jakob Meier
1ba36ff9f0
Added option to delete, edit and reorder categories.
NOTE: The click action is removed, if the user doesn't
have the required permission and the drag-handle is not shown.

BUG: Editing the list (in any way, other than reordering it),
wont reload the list - hopefully this will be addressed later,
by caching the categories (or removing them from the cache)
and auto-rebuilding on cache-change
2023-04-02 13:19:23 +02:00
Jakob Meier
b73362c101
Replaced math based approach with bitwise operations 2023-04-02 13:19:23 +02:00
Jakob Meier
3c5211bb5b
Moved about subscreens into about folder
This was done in an attempt to keep the folder structure
sorted and clean
2023-04-01 09:36:59 +02:00
Jakob Meier
a40e3af3e5
Fixed bug where public rooms weren't filtered correctly
This was caused by doNetworkRequest
introduced in Commit 5d333522a5 (Simplified network requests & snackbars, 2023-03-23),
as it ran asynchronously and thus the blacklist wasn't filled in time.
2023-03-31 21:54:45 +02:00
Jakob Meier
99f0ed3558
Basic Categories Page layout
Planned Flow (unimplemented):
- create new category on /edit-category page using bottom-right fab
- sort categories using the two-line hamburger-style menu on each item
- click on a category to modify/delete it
  NOTE: maybe on a different screen or MBS?
2023-03-31 21:52:14 +02:00
Jakob Meier
8fffafde47
Added translations using l10n
Translations are provided in *.arb* format.
Some keys have descriptions
(indicated by leading @-symbol).
Descriptions should not be copied into the translation itself.

Currently only English is supported (app_en.arb),
but German is planned.

Apparently weblate merged .arb support at some time,
so it would be nice to enable community translations at some point.
2023-03-29 15:14:27 +02:00
Jakob Meier
90adcc6bb1
Fixed context bugs caused by moving to GoRouter
NOTE: Some bugs have not been fixed, and the member screen needs fixing,
but before that can happen, localstore has to be replaced,
because it causes loops on android and linux.
It also seems like it might lead to memory leaks
2023-03-28 17:21:35 +02:00
Jakob Meier
5b9b48cd24
Migrated to GoRouter
Reasons for migration:
- buggy behaviour from old router
- GoRouter is a recommended flutter plugin
- ShellRoutes allow exposing Providers
  to a limited scope of routes
- GoRoutes provides named routes,
  and the navigator allows us to provide parameters directly.
2023-03-28 14:54:39 +02:00
Jakob Meier
bb9a8621a0
Moved User into application wide conntext.
Every page (after login) has access
to the User object via context.read/watch<User>().

This reduces localstore and asnyc operations,
as the screens do not have to load the user every time.
Additionally this prevents anyone from
using the without a user object.
2023-03-25 17:18:46 +01:00
Jakob Meier
e3ca4fafa6
Added room default permission editor screen
The screen allows the user to change the default permission set,
that applies to every member (but not the owner nor the admins).

This screen is only accessible by the owner,
admins or members with the changeAdmin permission.
2023-03-25 10:31:28 +01:00
Jakob Meier
6b98c696ea
Finishied room member screen
The screen allows every room member,
to view a list of other room members,
and their role (Owner, Admin or Member).

If the user is allowed
(Owner, Admin, changeAdmin/manageMembers),
to either kick or promote members to the admin role,
the list tile will have a tap event.
NOTE: This is why some members do not have a hover animation.
For example the owner cannot be kicked.
2023-03-25 10:31:14 +01:00
Jakob Meier
ecd87cf2cd
Made content scrollable
Added SingleChildScrollView to new-room, edit-room
and the about-room tab.
NOTE: Added a padding to the new and edit room pages,
to prevent widgets from touching the screen bottom
2023-03-24 18:21:23 +01:00
Jakob Meier
672892e21b
Removed Flexible widget.
FIXES: Bug where signup, signin,
edit room and new room screen would fail to open,
because the Flexible Widget cannot be nested in a
Centered Widget.

NOTE: Turns out the widget was not neccessary at all
2023-03-24 16:42:12 +01:00
Jakob Meier
fa734eca15
Moved network requests into seperate method,
called from initState using
WidgetsBinding.instance.addPostFrameCallback

FIXES: bug where edit room would reset
the input field content
2023-03-24 16:33:37 +01:00
Jakob Meier
4775d6923e
Added edit room screen
Data-fetch routine:
fetch room information from server
-> if unsuccessfull load room from disk

The room will automatically be closed,
if either of the following conditions apply:
- the user is offline and no data was found on disk
- the network request returned a server error
2023-03-24 13:25:42 +01:00
Jakob Meier
5d333522a5
Simplified network requests & snackbars
and rewrote the component's network requests.

showSimpleSnackbar, allows displaying a simple snackbar,
with text and one action button, that can be clicked.

doNetworkRequest is supposed to be a wrapper for the
already existing post* functions.
It aims to make network requests and error handling easier,
by containing all the try&catch blocks
and being able to show snackbars.
2023-03-24 13:25:34 +01:00
Jakob Meier
eabb6b93ae
Moved room pages into seperate folder 2023-03-23 14:04:48 +01:00
Jakob Meier
8e02de97c1
Added missing routes
and added a padding around the visibility selector
2023-03-23 11:05:18 +01:00
Jakob Meier
4ed46929f8
Moved main room screen into room folder 2023-03-23 10:19:14 +01:00
Jakob Meier
c466a19fc9
Added ability to delete or leave room.
NOTE: Only the room owner can delete a room,
but they are not able to leave the room.

BUG: Deleting or leaving the room deletes the room from disk,
but for an unknown reason, the homescreen does not update
and still shows the room.
Opening and closing the room seems to cause the homescreen to
update, removing the room.
2023-03-23 08:58:34 +01:00
Jakob Meier
c54e4f519f
Added about room screen.
NOTE: Some of the route redirect options are still missing.
There should also be a delete Room option
2023-03-22 21:17:03 +01:00
Jakob Meier
f3ac4a502c
Added stub screens
Used as a placeholder,
whilst other screens are currently worked on.

NOTE: there is no finished specification for
Products and Shopping List Items
2023-03-22 21:16:00 +01:00
Jakob Meier
ea2791fac7
Removed unnecessary server attribut in request
Triggered by 9efffabe80
2023-03-22 21:15:05 +01:00
Jakob Meier
69d1892fc8
Renamed /new-room endpoint to /add-room/new
This has been done in an effort
to move all endpoints used to join a room
under one umbrella (/add-room)

A list of planned or completed endpoints:
- /add-room
- /add-room/new
- /add-room/by-id
2023-03-21 20:26:24 +01:00
Jakob Meier
6347476b2f
Finished join-public-room screen
NOTE: If the user is already in a public room,
the room will not be shown in the list.

NOTE: The search funtionality
has not been implemented yet.

NOTE: The join invite-only room screen
will be part of a later commit.
But the endpoint has already been set to
/add-room/by-id
2023-03-21 20:24:48 +01:00
Jakob Meier
596c8cc4eb
Started working on Join Room Screen
Work already done:
- moving the New Room screen to a different endpoint
- fetching public rooms using the post API
- displaying public rooms

Suggestion for user interaction:
1. click on room
2. open bottomSheet with information and join button
3. click "join" to join room
2023-03-20 21:19:25 +01:00
Jakob Meier
cfd54e3bb5
Added room creation screen
If the room was created successfully,
the wizard automatically saves the room data on disk.
This allows it to be cached,
even if the user loses internet connection
right before the wizard exists.
That way the room will be cached.
2023-03-18 20:28:30 +01:00