Skip to content

refactor: move ProgressRing onto the shared control core - #94

Merged
AdamMusa merged 3 commits into
codex/engine-initializationfrom
refactor/progress-ring-control-core
Nov 2, 2026
Merged

AdamMusa merged 3 commits into
codex/engine-initializationfrom
refactor/progress-ring-control-core

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Depends on #91 (IconButton family), which stacks on #90 → #88 → #81. Until those merge, this PR's diff also shows their commits; review the last two.

What

Item 8 of the decoupling plan: ProgressRing (DSL names progress_ring and cupertino_activity_indicator) moves onto the shared core. Exactly two own commits:

  1. test: snapshot ProgressRing renderer behaviour: JSON snapshots of the legacy renderers (test/widgets/progress_ring_snapshot_test.dart, test/snapshots/ProgressRing/*.json), 9 fixtures × iOS/Android:
    • settled (determinate) fixtures through the shared harness: determinate (scripted pointer tap, invoke focus, unfocus), labelled (semantics_label + semantics_value), value_and_progress (both keys), maximal (every key), layout (layout keywords);
    • indeterminate fixtures that spin forever and cannot settle (indeterminate, progress_only, paused, radius): pumped for 100 ms by a local capture that records size, semantics, the native indicator's state and whether a frame is still scheduled (ticking). The shared harness (mountWire) is not changed.
    • every snapshot also records the native indicator's state (CircularProgressIndicator.value; CupertinoActivityIndicator.progress/animating/radius).
  2. refactor: move ProgressRing onto the shared control core: the migration. Snapshots change only per the parity table below.

Design

File Now
controls/progress_ring_core.dart (new) progressRingSpec, ProgressRingProps, ProgressRingCore. The core owns the one determinate fraction both designs show (progress wins over value, the iOS rule; clamped to 0..1, the Material rule) and the accessibility value both announce (semantics_value, or the determinate percentage, Material's rule). No events, no methods.
controls/progress_ring.dart MaterialProgressRingSkin → CircularProgressIndicator.
controls/cupertino_activity_indicator.dart CupertinoProgressRingSkin → CupertinoActivityIndicator (partially revealed while determinate), wrapped in the same Semantics (label, value, role, min/max) the Material ring builds for itself.
controls/adaptive_progress_ring.dart Same class/file (registry untouched); canonical entry (create: ProgressRingCore.new, C1e).

Core-consumed: value, progress (the fraction), semantics_value (the accessibility value). Material-only, with reasons: bgcolor, stroke_width, stroke_cap, stroke_align, track_gap (iOS spokes have no stroked track), size_constraints, padding, year_2023. Cupertino-only: radius (the Material ring sizes from size_constraints), animating (an indeterminate CircularProgressIndicator always spins). Both skins: color, semantics_label. Both skin files leave legacy_renderers.txt.

Manifest entry: a determinate, labelled fixture (so the harness can settle it and C7 compares what both designs announce), native widgets CircularProgressIndicator / CupertinoActivityIndicator, parity script tap native + unfocus. There are no core-sourced events.

Parity changes (DC-5)

# Platform Before After Ruby impact Snapshot rows
1 iOS no accessibility label or value semantics_label and the value (semantics_value, or the determinate percentage) announced, as on Android VoiceOver reads the ring like TalkBack determinate.ios, labelled.ios, maximal.ios, layout.ios, progress_only.ios, value_and_progress.ios (semantics)
2 Android progress ignored (the ring kept spinning indeterminately) honored as the fraction, as on iOS progress_ring(progress: 0.3) shows 30 % on Android progress_only.android (native.value null → 0.3, ticking true → false, semantics value 30)
3 Android value won when both value and progress were sent progress wins on both designs (the iOS rule) only a call sending both, with different values value_and_progress.android (0.2 → 0.8)
4 iOS a value/progress outside 0..1 failed CupertinoActivityIndicator's assertion clamped to 0..1 on both designs (Material already clamped) no crash in debug builds not in the snapshots (legacy throws); ruby_progress_ring_keys_test.dart
5 both invoke on the ring waited for the timeout (no listener) fails fast with #59's UnsupportedError text error instead of a timeout determinate.* invoke focus

Unchanged on both designs (identical snapshots): geometry everywhere, the indeterminate/paused/radius rings, Android semantics, the maximal Material ring.

Tests

  • Snapshot test: 18 (commit 1 against legacy, commit 2 updated per the table).
  • test/widgets/ruby_progress_ring_keys_test.dart (+3): Android honors progress, iOS clamps an out-of-range value, iOS announces label and percentage. The existing year_2023 tests pass unchanged.
  • Contract test, new entry: C1, C1e, C2/C2b, C3 (Ruby's 15 non-layout keywords), C4, C5, C6, C7.

team/verify_pr.sh on head ff96126 with ruflet origin/main fb29afbc: PASS: engine flutter test +1144 all passed, flutter analyze lib test no issues, ruflet_core 161/161 files. Wire-key audit: the 26 "new" findings are all Column/GridView/ListView/Row refresh and end-reached keys, which ruflet main has (ruflet #43/#45) but this stack's engine base (81609d0) predates (engine #27/#30). Against ruflet 43928509 (the tree #81–#91 were verified with) the audit reports 0 new.

Gate

No open PR touches adaptive_progress_ring.dart, progress_ring.dart, cupertino_activity_indicator.dart or ruby_progress_ring_keys_test.dart; checked before starting and before opening. core_manifest.dart and legacy_renderers.txt are only touched by the decoupling stack (#81–#91): expect adjacent-line conflicts with #84/#86/#87 (and developer 1's SegmentedButton/picker PRs); keep both sides, entries alphabetical.

Record the legacy ProgressRing renderers (CircularProgressIndicator on
Android, CupertinoActivityIndicator on iOS) as JSON snapshots: geometry,
semantics, the native indicator's state (value, progress, radius,
animating), what they send to Ruby during a tap and invoke outcomes.
Fixtures cover determinate, labelled, value plus progress, maximal and
layout-keyword rings, and, without settling, indeterminate, progress-only,
paused and radius rings, recording whether the indicator still spins. The
migration onto the shared control core may change them only as listed in
its parity table.
ProgressRingCore now owns everything Ruby sends for ProgressRing (the
progress_ring and cupertino_activity_indicator DSL names): one fraction for
both designs (`progress` wins over `value`, clamped to 0..1) and the
accessibility value both announce (`semantics_value`, or the determinate
percentage). The Material skin maps the core onto CircularProgressIndicator
and the Cupertino skin onto CupertinoActivityIndicator, wrapped in the same
semantics the Material ring exposes. The registry entry has the canonical
shape (create: ProgressRingCore.new).

Android now honors `progress`; iOS announces semantics_label and the
progress value to accessibility and no longer fails an assertion on an
out-of-range value. Unknown methods fail fast. Snapshots change only for
those rows.
…-core

Brings in the PRs merged since, so #94 merges; conflicts take the resolution tested on the full merge of the open PRs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
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