Skip to content

feat: add keyboard_dismiss_behavior to scrollable controls - #36

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
feat/keyboard-dismiss
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
feat/keyboard-dismiss

Conversation

@AdamMusa

@AdamMusa AdamMusa commented Oct 28, 2026 •

Copy link
Copy Markdown
Owner

Package A / A3 (keyboard-dismiss). Ruby counterpart: AdamMusa/ruflet#49.

Depends on #30 (A2), which depends on #27 (A1). It is stacked because the behavior is also passed to the pull-to-refresh CustomScrollViews. Review only the top commit, feat: add keyboard_dismiss_behavior to scrollable controls.

What

  • utils/misc.dart gains parseKeyboardDismissBehavior and Control.getKeyboardDismissBehavior. They are R4 underscore-tolerant: "onDrag", "on_drag" and "ondrag" all work.
  • keyboard_dismiss_behavior reaches every scroll view the scrollable controls build:
    • the ListView constructors (3) and the GridView constructors (2)
    • Material ReorderableListView (2) and Cupertino ReorderableList
    • the Material and Cupertino refresh CustomScrollViews
    • the SingleChildScrollView that ScrollableControl builds for Column, Row and View
  • Unset passes null, which keeps Flutter's inherited ScrollBehavior default. Existing apps are byte-for-byte unchanged.

Ruby usage

form = list_view(keyboard_dismiss_behavior: "onDrag", expand: true,
                 controls: [name_field, email_field, notes_field])
page.scroll = "auto"
page.keyboard_dismiss_behavior = "onDrag"   # page body (implicit View)

Wire

  • Prop: keyboard_dismiss_behavior, "manual" | "onDrag".
  • No events.

Material vs Cupertino

Both pass the value to their own scroll view (ReorderableListView vs ReorderableList, and RefreshIndicator's child vs the bouncing refresh CustomScrollView). Flutter's ScrollView unfocuses on drag the same way on both.

Tests: test/widgets/ruby_keyboard_dismiss_test.dart, 37 tests

  • One parser test covering the spellings and the fallback.
  • On iOS and Android: ListView, GridView, Column (scroll), Row (scroll, horizontal drag), ReorderableListView and a refreshable ListView, each with the behavior unset, "manual" and "onDrag". The test focuses a TextField inside the scroll view and drags. With onDrag the field loses focus; with unset or manual it keeps focus.

Results (verify_pr.sh, Flutter 3.41.2):

  • engine flutter test +783: All tests passed! (A2 746 + 37)
  • flutter analyze lib test: No issues found!
  • ruflet_core 149/149 files, 642 runs
  • wire-key audit: NEW vs baseline: 0

ListView, GridView, Column, Row, View and ReorderableListView read
keyboard_dismiss_behavior ("manual" or "onDrag", underscores allowed)
and pass it to their scroll view on both designs, including the
pull-to-refresh CustomScrollView and the SingleChildScrollView that
ScrollableControl builds. Unset keeps the inherited default.
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