Skip to content

fix: honor Ruby expanded_insets, selected_suffix and hover_color on Dropdown - #54

Merged
AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/dropdown-expanded-insets-suffix-hover
Oct 29, 2026
Merged

AdamMusa merged 2 commits into
codex/engine-initializationfrom
fix/dropdown-expanded-insets-suffix-hover

Conversation

@AdamMusa

Copy link
Copy Markdown
Owner

Summary

Ruby's canonical Dropdown (materials/dropdown_control.rb) declares expanded_insets, selected_suffix and hover_color. The Material renderer (material_dropdown.dart, Flutter DropdownMenu) and the Cupertino renderer read none of them. Material derived expandedInsets only from expand. Upstream Flet's Dart doesn't apply these keys either. The descriptions below come from Flet's Python docs.

Fix

Material

  • expanded_insets (padding) now goes to DropdownMenu.expandedInsets. When it is absent, the old expand > 0 → EdgeInsets.zero rule still applies.
  • hover_color now goes to InputDecorationTheme.hoverColor, which is the text field's hover fill.
  • selected_suffix (a control) is "displayed after the selected item". DropdownMenu has no suffix slot, so when this key is set the renderer uses DropdownMenu.decorationBuilder and puts the control in InputDecoration.suffix. The builder now also carries label, hint_text, helper_text, error_text and leading_icon, because Flutter asserts that those are not passed both ways. The default arrow button is kept, since suffixIcon stays null. When selected_suffix is absent, the existing code path is unchanged.

Cupertino (cupertino_input_controls.dart)

  • selected_suffix is shown in the field's suffix, before the chevron button, only while an option is selected.
  • expanded_insets and hover_color are not applied, because they have no Cupertino equivalent. The iOS dropdown is a field that opens a bottom picker sheet, so there is no inline menu to inset, and CupertinoTextField has no hover fill. This is inherent to the design language.

git merge-tree shows clean merges with #10 (DropdownM2) and #43 (SearchBar), which touch the same Cupertino file.

Tests

New test/widgets/ruby_dropdown_keys_test.dart:

  • Material: expanded_insets {left: 8, right: 16} sets DropdownMenu.expandedInsets, and the field is 400 − 24 = 376 px wide.
  • Material: hover_color reaches the built TextField decoration.
  • Material: selected_suffix sets the decoration suffix. Label and helper are kept, and the arrow suffixIcon is kept.
  • Cupertino: the suffix renders after the selected option's text, and it is hidden when nothing is selected.

The first four failed before the fix. The "hidden" test passes on both, as a guard.

verify_pr.sh: flutter test +700, all passed (695 baseline + 5 new). flutter analyze lib test found no issues. Flutter 3.41.2.

Wave-2 follow-up E6

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