Skip to content

Conversation

@dhituval
Copy link

@dhituval dhituval commented Nov 19, 2025

Related Issue(s)

Fixes #865

Summary

This PR generalizes the original “hide Nutrition widget” request into a flexible system that allows users to toggle the visibility of any dashboard widget. Instead of a single boolean flag, the app now maintains a dashboardWidgetVisibility map that supports multiple configurable widgets.

Motivation

Issue #852 requested the ability to hide the Nutrition widget. During review, maintainers suggested making the feature more flexible so all dashboard widgets could be user-configurable. This PR implements that expanded functionality.

Changes

UserProvider

  • Added dashboardWidgetVisibility map to store visibility states for all widgets.
  • Persisted the map using SharedPreferencesAsync.
  • Added helper methods: _loadDashboardWidgetVisibility(), isDashboardWidgetVisible(), setDashboardWidgetVisible()

Dashboard

  • Updated DashboardScreen so routines, weight, measurements, calendar, and nutrition widgets render only if marked visible in the map.

Settings UI

  • Added a new “Dashboard Widget Visibility” section in SettingsPage.
  • Implemented SwitchListTile controls for each widget.
  • UI updates immediately via Provider and persists across app restarts.

Testing

  • Verified toggles correctly update visibility in real time.
  • Restarted the app to confirm persistence.
  • Confirmed behavior across multiple widgets.
  • Tested on iOS simulator (iPhone 15).
  • Added new test stubs to support the expanded visibility logic.
Screenshot 2025-12-09 at 1 37 25 PM

If applicable, please link to any related issues (Closes #123,
Closes wger-project/other-repo#123, See also #123, etc.)

Please check that the PR fulfills these requirements

  • [ x] Tests for the changes have been added (for bug fixes / features)
  • [ x] Set a 100 character limit in your editor/IDE to avoid white space diffs in the PR
    (run dart format .)
  • [x ] Updated/added relevant documentation (doc comments with ///).
  • [ x] Added relevant reviewers.

@rolandgeider
Copy link
Member

Hi and thanks for the PR!

I would say that we should be a bit more flexible and allow the users to hide / show other widgets in the home screen (they might want to hide the routines, but not the diet plan). We could save in the prefs a map with the visibility state of the different widgets?

@dhituval
Copy link
Author

dhituval commented Dec 8, 2025

@rolandgeider

Thanks for the suggestion! I refactored the implementation to store a dashboardWidgetVisibility map in UserProvider and added toggles in the Settings page for routines, weight, measurements, calendar, and nutrition. The dashboard now checks this map before rendering each widget, so users can individually hide or show the sections they care about.

Screenshot 2025-12-08 at 2 01 37 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants