Skip to content

fix(feedback,routing): Navigator-overlay toasts and redirect/title fixes - #107

Merged
anilcancakir merged 2 commits into
masterfrom
feat/design-first-component-system
Jul 21, 2026
Merged

fix(feedback,routing): Navigator-overlay toasts and redirect/title fixes#107
anilcancakir merged 2 commits into
masterfrom
feat/design-first-component-system

Conversation

@anilcancakir

Copy link
Copy Markdown
Contributor

Summary

Hardens the MagicFeedback toast path and two routing behaviors, surfaced while building on the framework.

Feedback (overlay toasts)

  • Deliver toasts through the Navigator Overlay so they show without a Scaffold ancestor.
  • Degrade the snackbar to a logged warning when no Scaffold hosts it (no silent drop).
  • Render the overlay toast on a transparent Material so its text no longer inherits the root fallback DefaultTextStyle (the yellow debug double-underline); Magic.error/success/toast now render clean text.

Routing

  • Re-run redirects on auth-state change.
  • Treat a blank title suffix (e.g. an unset APP_NAME resolving to "") as absent, so the browser tab shows just the route title instead of "Route | " with a dangling separator.

Testing

  • flutter test test/routing/title_manager_test.dart green (39). The transparent-Material toast fix is a rendering change verified against a real overlay (no unit harness).

Copilot AI review requested due to automatic review settings July 20, 2026 21:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves framework UX resilience by routing feedback toasts through the Navigator Overlay (so they work without a Scaffold) and tightening two routing behaviors: redirect re-evaluation on auth-state changes and correct title-suffix handling when the suffix is blank.

Changes:

  • Render MagicFeedback snackbars/toasts via a single overlay-toast mechanism (with transparent Material wrapping to avoid fallback DefaultTextStyle artifacts).
  • Wire GoRouter refreshListenable to Auth.stateNotifier so redirects re-run automatically on login/logout/restore.
  • Treat a blank/whitespace title suffix as “absent” (no dangling separator), with test coverage added.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
test/routing/title_manager_test.dart Adds coverage for treating blank title suffix as absent.
test/routing/router_auth_refresh_test.dart New widget tests proving auth-state bumps re-run redirects without loops.
lib/src/ui/magic_feedback.dart Replaces ScaffoldMessenger snackbars with Navigator Overlay-based toasts and adds text-style hardening.
lib/src/routing/title_manager.dart Implements blank-suffix suppression via _withSuffix.
lib/src/routing/magic_router.dart Adds refreshListenable resolved from Auth.stateNotifier with defensive fallback.
example/pubspec.lock Updates example dependency lock resolutions.
CHANGELOG.md Documents the fixes under [Unreleased].

Comment thread lib/src/ui/magic_feedback.dart
Comment thread lib/src/ui/magic_feedback.dart
Comment thread lib/src/ui/magic_feedback.dart
Comment thread lib/src/ui/magic_feedback.dart
@anilcancakir
anilcancakir force-pushed the feat/design-first-component-system branch from b62dbf3 to 60fafc6 Compare July 21, 2026 07:12
@anilcancakir

Copy link
Copy Markdown
Contributor Author

Addressed the review feedback in fix(feedback): ...:

  • backgroundColor/color unused on showSnackbar — removed both parameters (no caller passed them; the overlay path never applied them).
  • Log.warning can throw when the log service is unbound (context-not-mounted and no-Overlay degrade paths) — routed through a _warn helper that logs via Log only when Magic.bound('log'), falling back to debugPrint otherwise, so early / teardown-time feedback degrades instead of throwing Service [log] is not registered. Covered by a new magic_feedback_test.dart case.
  • _dismissToast() remove() assert — already guarded on entry.mounted on master (fix(feedback): deliver toasts via the Navigator overlay so they show without a Scaffold #106); no unconditional remove().

Also folded in the original overlay-toast underline fix (transparent Material wrap). Full suite green (1257), analyze + format clean.

@anilcancakir
anilcancakir merged commit e7ef0f0 into master Jul 21, 2026
3 checks passed
@anilcancakir
anilcancakir deleted the feat/design-first-component-system branch July 21, 2026 07:13
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 73.33333% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/ui/magic_feedback.dart 55.55% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

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