Challenges and Solutions Faced While Building the Flutter App

Handling Orientation: Portrait and Landscape

Challenge:

Supporting both portrait and landscape orientations while maintaining a consistent user experience was difficult. The UI needed to be user friendly when the device was rotated.

Solution:

We used MediaQuery to detect the screen orientation and defined a boolean isPortrait to check whether the device is in portrait mode. Based on this flag, we created different layouts for portrait and landscape orientations, ensuring the UI adjusts properly for both.

Dynamic Data Updates and Widget Refresh

Challenge:

The data in the app could be updated at any time (e.g., new transactions, edits), but the widgets weren’t refreshing automatically when the data changed. Ensuring that the UI dynamically updated was a big issue.

Solution:

We used methods such as Navigator.pushReplacement and .then to refresh the state of the widgets after navigation, making sure that the screen reloads the updated data upon returning to the main page. Additionally, we leveraged setState() to trigger the necessary UI updates. While we tried using ObjectBox’s dynamic queries to auto-refresh data using the stream providers, but they were not working as expected in our specific implementation, leading us to rely more on manual refresh mechanisms.