Skip to content

feat: add AboutDialog control with a licenses page - #29

Merged
AdamMusa merged 3 commits into
codex/engine-initializationfrom
feat/about-dialog
Oct 29, 2026
Merged

AdamMusa merged 3 commits into
codex/engine-initializationfrom
feat/about-dialog

Conversation

@AdamMusa

@AdamMusa AdamMusa commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Depends on #37 (fix/dialog-early-close-race). This branch is stacked on it so that it can use the shared lib/src/widgets/control_route.dart. Until #37 merges, this PR's diff also shows #37's commit a81dfdf; review commits cd7c20d and e1f0782.

Ruby counterpart: AdamMusa/ruflet#44

Item D3 (P2): adds an AboutDialog control with an open-source licenses page (App Store / Play compliance).

What it renders

Material (Android/web/desktop) Cupertino (iOS/macOS), hand-built per D-7
about view (default) SDK AboutDialog (name, version, icon, legalese, controls as children, built-in "View licenses" / "Close") CupertinoAlertDialog: title "<name> <version>"; content is the icon, legalese and controls; actions are "View Licenses" and "Close" (default)
licenses SDK LicensePage NEW widgets/cupertino_license_page.dart (below)
view: "licenses" pushes LicensePage directly pushes the Cupertino license page directly
default name nearest Title (SDK rule) nearest Title (same rule)

Cupertino license page. It is a CupertinoPageScaffold with a CupertinoNavigationBar(middle: "Licenses"), an app header (icon, name, version, legalese), and a FutureBuilder over LicenseRegistry.licenses, grouped by package and sorted case-insensitively. Packages are listed in a CupertinoListSection.insetGrouped of CupertinoListTiles (package, additionalInfo = license count, CupertinoListTileChevron). Tapping a package opens its license text: LicenseParagraph.indent becomes a 16 px leading inset per level, centered paragraphs are centered, and entries are separated by hairlines. It uses no Material symbols.

Wire contract

  • Type: AboutDialog
  • Keys: application_name, application_version, application_icon (a Control, or an icon via buildIconOrWidget), application_legalese, controls, view ("about" | "licenses"), open, modal, barrier_color
  • Event: dismiss

Lifecycle (same open / _open / dismiss contract as AlertDialog)

  • open: true presents in a post-frame callback inside the owning navigator. The dialogs use the owner's ControlMaterialDialogRoute / ControlCupertinoDialogRoute, so the barrier is in the route overlay and live (1f21fca).
  • Closing via "Close", a barrier tap, popping the licenses route, or open: false resets open and fires dismiss exactly once.
  • open: false closes only the dialog's own routes: the dialog, or the licenses page for view: "licenses", plus the license routes it opened itself. Each route is popped when it is on top and removed with removeRoute when something covers it. Another control's dialog or any app view above it is never touched, and only this control's dismiss fires.
  • Ownership (QA fix). The route content is wrapped in ControlRouteScope, an InheritedTheme added to fix: close only the dialog's own route when open turns false #37's helper. A route pushed from inside it while carrying the pusher's themes is adopted by the control: that includes the SDK "View licenses" button (showLicensePage captures and re-applies InheritedThemes) and the Cupertino licenses list/detail pages (pushCarryingThemes, the same mechanism). Present, close, early close and the single dismiss are fix: close only the dialog's own route when open turns false #37's presentControlRoute / closeControlRoute. There is no local lifecycle code and no popUntil any more.

Deviations from the spec (intentional)

  • The SDK widgets are pushed through Ruflet's route classes onto the owning navigator, instead of showAboutDialog / showLicensePage. showAboutDialog defaults to the root navigator and bypasses the live-barrier route. showLicensePage returns void, so its route could not be tracked for open: false / dismiss.
  • Added modal and barrier_color, for parity with AlertDialog. They feed the existing route classes at no extra cost.
  • The iOS strings ("View Licenses", "Close", "Licenses") are English, because CupertinoLocalizations has no equivalent strings.

Tests

test/widgets/ruby_about_dialog_test.dart has 10 iOS cases and 7 Android cases. Each iOS case also asserts no Material widgets, no AboutDialog and no LicensePage:

  • iOS alert with title, icon, legalese, extra controls (in that order) and both actions
  • default name taken from the app Title
  • Close fires dismiss once and resets open
  • "View Licenses" lists the test LicenseRegistry package with its count and chevron, plus the app header. Tapping it shows the text with a 16 px indent, a centered heading and correct ordering. Back to the list and back to the alert, then Close fires dismiss.
  • view: "licenses" opens the CupertinoPageRoute directly; popping it fires dismiss
  • open: false closes the alert and the license page above it; reopening works
  • barrier tap dismisses; modal keeps the alert open
  • Android: the SDK AboutDialog gets name/version/legalese/icon/children, and "View licenses" opens LicensePage
  • Android: Close fires dismiss; view: "licenses" opens LicensePage and popping it fires dismiss; open: false closes it
  • QA regression, both designs: another control's AlertDialog is open above the AboutDialog. open: false (plus a rebuild) closes the About dialog only. The other dialog stays open (open == true) and the only event is 1:dismiss; closing the other dialog afterwards adds 20:dismiss.
  • QA regression, both designs: with the license page(s) opened from the dialog and another dialog above them, open: false removes the dialog and its license routes (iOS: list + detail page; Android: the SDK LicensePage), and the other dialog stays. Android also checks that open: false closes the LicensePage the SDK button opened.

Before the QA fix, the "another dialog above" cases failed on both designs: the other dialog was closed as well. After it, all 17 pass, along with #37's dialog_early_close_test (10) and modal_presentation_test (3).

Matrix fixture: case 'AboutDialog' uses open: false. All 5 platforms pass, and so do the architecture tests.

verify_pr.sh with Flutter 3.41.2 against the Ruby counterpart:

PASS ruby:ruflet_core                   146/146 files, 623 runs
PASS engine:ruflet flutter test         +727: All tests passed!   (695 base + 10 from #37 + 17 AboutDialog + 5 matrix)
PASS engine:ruflet analyze              No issues found!
INFO wire-key audit                     NEW vs baseline: 0, fixed: 0

Ruby usage

page.show_dialog(about_dialog(application_name: "Rides", application_version: "1.4.0",
                              application_legalese: "© 2026 Rides Inc."))
page.show_dialog(about_dialog(application_name: "Rides", application_version: "1.4.0", view: "licenses"))

Material shows the SDK AboutDialog and LicensePage; iOS shows a
CupertinoAlertDialog with View Licenses/Close and a hand-built Cupertino
licenses page (inset-grouped LicenseRegistry packages, then the license
text with paragraph indents), with no Material widgets. view: licenses
opens the licenses page directly.

Both follow the dialog open/_open/dismiss lifecycle through Ruflet's
dialog routes in the owning navigator; open: false also closes the
license pages opened from the dialog but never an app view.
_close used popUntil, which popped every pageless route above the
dialog, so closing an AboutDialog also closed another control's dialog
opened above it and fired its dismiss.

The renderers now use the shared control_route helper (stacked on the
early-close fix). The helper gains ControlRouteScope: routes pushed from
inside a control's route while carrying its InheritedThemes (the SDK
View licenses button via showLicensePage, the Cupertino licenses pages
via pushCarryingThemes) are adopted by that control. open: false pops or
removes only the dialog and the license routes it opened itself.
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.

1 participant