Skip to content

fix: apply Ruby layout keywords to ReorderableDragHandle - #7

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/reorderable-drag-handle-layout
Oct 28, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/reorderable-drag-handle-layout

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Summary

Ruby's ReorderableDragHandle (shared/reorderabledraghandle_control.rb) declares the full set of common layout keywords: width, height, margin, opacity, tooltip, badge, offset, rotate, scale, align, aspect_ratio, animate_*, left/top/right/bottom, expand, on_size_change, and so on. reorderable_drag_handle.dart returned a bare ReorderableDragStartListener with no LayoutControl, so every layout keyword was silently dropped. For example, reorderable_drag_handle(content: icon, width: 40, height: 40, margin: 8) rendered at the icon's intrinsic size with no margin.

Fix

The drag handle now wraps its listener in LayoutControl(control: control, child: ReorderableDragStartListener(...)) (base_controls.dart), like the other visual controls. The listener stays inside the layout wrappers. The sized area (width/height) is draggable, and the margin is outside the handle and does not start a drag. enabled: !control.disabled and the mouse_cursor MouseRegion are unchanged.

The control has no design-language widgets, so one file serves both Material and Cupertino. It works in both MaterialReorderableListViewControl (ReorderableListView) and CupertinoReorderableListViewControl (ReorderableList).

Tests

New test/widgets/ruby_reorderable_drag_handle_test.dart uses a ReorderableListView with show_default_drag_handles: false and three rows, each a ReorderableDragHandle. It runs on iOS and macOS (Cupertino list) and on Android (Material list):

  • Geometry: width: 40, height: 30, margin: {left: 8, top: 10} gives a 40x30 listener rect at offset (8, 10) from its row. opacity: 0.5 gives an Opacity(0.5) ancestor.
  • No layout keywords: the listener still hugs its content, so nothing changes when no layout keys are sent.
  • Dragging still works: a sized handle with margin and tooltip is dragged down past the next row. reorder fires once with {old_index: 0, new_index: 1}, and row B is now above row A.
  • Disabled: disabled: true does not reorder.

Before the fix, the 3 geometry cases failed (for example Expected Size(40.0, 30.0), Actual Size(16.6, 17.0) on iOS). Drag, no-keyword and disabled cases passed, which shows the change does not regress dragging.

verify_pr.sh <engine-wt> "" (Flutter 3.41.2):

  • flutter test: +707, all passed (695 baseline + 12 new).
  • flutter analyze lib test: no issues found.

QA finding #14 (qa-baseline.md: "ReorderableDragHandle … no LayoutControl/BaseControl … every layout keyword is ignored").

ReorderableDragHandle returned a bare ReorderableDragStartListener, so the
layout keywords Ruby declares for it (width, height, margin, opacity, tooltip,
badge, offset, rotate, scale, animate_*, on_size_change, ...) were dropped.
The listener is now wrapped in LayoutControl like every other visual control.

The listener stays inside the layout wrappers, so the sized area drags and the
margin does not.
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