Skip to content

Conversation

@maxdav18
Copy link

@maxdav18 maxdav18 commented Dec 10, 2025

I noticed issue #852 was open and decided to implement a fix for it. I am submitting this contribution as part of a software engineering course at the University of Michigan.

Hides the nutritional plan widget on the dashboard if the user has no active current plan.

Proposed Changes

  • Imported Provider and NutritionPlansProvider in lib/screens/dashboard.dart.
  • Added logic to check if nutritionProvider.currentPlan is null.
  • Wrapped the DashboardNutritionWidget in a conditional check so it is hidden when no plan is active.

Related Issue(s)

Fixes #852

Please check that the PR fulfills these requirements

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

Notes:
Verified manually on macOS. The widget successfully disappears when no plan is active and reappears when a plan is created.

…ject#852)

Hides the nutritional plan widget on the dashboard if the user has no active current plan.
Added a new widget test `test/nutrition/dashboard_visibility_test.dart`.

This test verifies that the "Nutritional plan" widget is correctly hidden when no active plan exists and shown when a plan is active. It mocks the `NutritionPlansProvider` to ensure the dashboard logic is tested in isolation without relying on the real database state.
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.

hide diet plan in home, if not used

1 participant