Skip to content

fix(routing): resolve intermittent page title loss on web#53

Merged
anilcancakir merged 1 commit intomasterfrom
fix/title-widget-conflict
Apr 7, 2026
Merged

fix(routing): resolve intermittent page title loss on web#53
anilcancakir merged 1 commit intomasterfrom
fix/title-widget-conflict

Conversation

@anilcancakir
Copy link
Copy Markdown
Contributor

Summary

  • Fix intermittent page title loss on web — Flutter's internal Title widget was overwriting TitleManager's route-level title via didChangeDependencies() on InheritedWidget changes (MediaQuery, Locale, Theme)
  • Replace MaterialApp.router(title:) with onGenerateTitle that delegates to TitleManager.instance.effectiveTitle
  • Also includes file_picker upgrade from ^10.3.10 to ^11.0.2 (static API migration, Android CWE-22 security fix)

Root Cause

MagicApplication passed a static title to MaterialApp.router, which Flutter wraps in a Title widget. On web, Title.didChangeDependencies() fires on every InheritedWidget change and calls SystemChrome.setApplicationSwitcherDescription with the static base title — overwriting TitleManager's route-level title. The race is intermittent because it depends on timing of MediaQuery/Locale/Theme updates during initial page load.

Changes

  • lib/src/foundation/magic_app_widget.dart:210title: widget.titleonGenerateTitle: (_) => TitleManager.instance.effectiveTitle
  • lib/src/facades/pick.dart — Migrate FilePicker.platform.method()FilePicker.method() (4 call sites)
  • pubspec.yamlfile_picker: ^10.3.10^11.0.2

Test plan

  • flutter test — 914 tests passed
  • flutter test test/routing/title_manager_test.dart — 30 tests passed
  • dart analyze — zero warnings
  • dart format . --set-exit-if-changed — zero changes
  • Plan verifier: APPROVE (both plans)
  • Code review: APPROVED (file_picker plan)

Closes #44 (Dependabot file_picker PR — superseded by this PR which includes both the version bump and breaking API migration).

Copilot AI review requested due to automatic review settings April 7, 2026 20:32
Flutter's internal Title widget was overwriting TitleManager's
route-level title via didChangeDependencies() on InheritedWidget
changes (MediaQuery, Locale, Theme). Replace static title parameter
with onGenerateTitle that delegates to TitleManager.effectiveTitle.
@anilcancakir anilcancakir force-pushed the fix/title-widget-conflict branch from 1143b49 to a2f9b99 Compare April 7, 2026 20:34
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an intermittent Flutter web page-title regression where Flutter’s internal Title widget could overwrite Magic’s route-level titles, and updates the codebase for file_picker v11’s breaking API change.

Changes:

  • Switch MaterialApp.router from a static title: to onGenerateTitle backed by TitleManager.instance.effectiveTitle to keep Flutter’s Title widget aligned with route-level title updates.
  • Upgrade file_picker to ^11.0.2 and migrate facade call sites from FilePicker.platform.* to the new static FilePicker.* APIs.
  • Update changelog and example lockfile to reflect the dependency/version updates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pubspec.yaml Bumps file_picker dependency to ^11.0.2.
lib/src/foundation/magic_app_widget.dart Uses onGenerateTitle to prevent Flutter’s Title widget from clobbering TitleManager titles on web dependency changes.
lib/src/facades/pick.dart Migrates file picking calls to file_picker v11 static APIs.
example/pubspec.lock Updates resolved package versions/hashes for the example app after dependency changes.
CHANGELOG.md Documents the routing title fix and the file_picker upgrade under Unreleased.

@sentry
Copy link
Copy Markdown

sentry bot commented Apr 7, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
lib/src/foundation/magic_app_widget.dart 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@anilcancakir anilcancakir merged commit 26582c8 into master Apr 7, 2026
1 of 2 checks passed
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