Repository navigation
fix: honor TextField focused border and background on iOS - #67
Merged
AdamMusa merged 2 commits intoNov 2, 2026
Merged
Conversation
On iOS, border: "none" still drew the native rounded border and white fill: the string reached the Border-map parser, which threw, and a null border left CupertinoTextField's default decoration in place. This broke form_row(text_field(border: "none"), ...) layouts. Resolve the border style explicitly. none paints nothing (decoration null, so disabled fields get no gray box either); outline and underline use the native hairline unless border_color/border_width are given (width 0 removes the line) instead of a hard-coded 1 dp black line; underline has square corners and no fill; absent or a Border map keeps the native field. filled/fill_color now paint a background on iOS too. Material is unchanged.
The Cupertino renderer ignored focused_border_color, focused_border_width and focused_bgcolor. The field already tracks focus (including the shift_enter node), so the decoration now restyles the drawn border and replaces the background while focused. As on Material, border "none" stays borderless when focused, and border styling without a border keyword implies an outline.
AdamMusa
pushed a commit
that referenced
this pull request
Nov 3, 2026
Follow-up to #67 (iOS TextField focus styling). With `filled: true`, `fill_color` and `focused_bgcolor`, iOS showed focused_bgcolor while the field had focus but Material kept fill_color, because buildInputDecoration only fell back to focused_bgcolor when no fill_color was set (`fillColor ?? (focused ? focusedBgcolor ?? bgcolor : bgcolor)`, unchanged since the engine was extracted). Both designs now follow one rule: while focused, `focused_bgcolor` (when set) is the background; otherwise `fill_color`, then `bgcolor`. That is what the keyword means (Flet documents it as the TextField's background colour in the focused state, and Ruby passes it through unchanged on TextField and CupertinoTextField), so a field-specific focus colour no longer disappears because a resting fill is also set. The iOS renderer already did this; the Material decoration (shared with the Material DropdownM2) now does too. Without fill_color nothing changes. ruby_text_field_focus_colors_test.dart checks fill_color at rest, focused_bgcolor while focused and fill_color after blur on iOS and Android; the Android case fails without the fix (it stayed 0xFF00FF00). TextField, dropdown and form widget tests plus test/architecture: 418/418. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MqfxcsDiEUZngybe9L72JQ
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #53 (
fix/cupertino-textfield-border-none, approved at54c2709). This branch contains #53's commit plus one commit (456a98f). Please review only the last commit; once #53 merges, this PR's diff shrinks to it.What
The iOS TextField ignored
focused_border_color,focused_border_widthandfocused_bgcolor. The Cupertino renderer already tracks focus, including the separateshift_enterfocus node, through_focusedandsetState. #53's_decoration()helper now applies the focused styling:focused_border_color/focused_border_widthBorder.all, underline → the bottom rule, a Border map → each non-none side. They fall back toborder_color/border_width, then to the native hairline.border: "none"InputBorder.none.copyWith(...)is still nonefocused_bgcolorbgcolor/fill/native white). It works withborder: "none"too, then giving a decoration only while focused.borderkeyword"outline", as Material does. Unfocused it is identical to the native field (Border.all(native hairline)).Visible change on top of #53:
border_color/border_widthwithout aborderkeyword now apply on iOS. Previously they were ignored there, but they applied on Material.Material is unchanged (
form_field.dart/textfield.dartuntouched). This PR does not fix a pre-existing Material bug found while testing: Material's_onFocusChangenever callssetState, sofocused_bgcolor(andfocused_color) never refresh on focus. It is reported to the lead as a follow-up.Tests
test/widgets/ruby_text_field_focus_styling_test.dart(7 tests):showKeyboard), a red border and yellow fill. Back to gray and white on unfocus. Thefocus/blurevents fire.focused_border_width: 2: the border widens, and the field grows by 2 dp because border width insets the content.borderkeyword: unfocused it equals the native decoration; focused it shows a red outline ring with the native radius.border: "none":decorationis null at rest; focused it has no border but thefocused_bgcolorfill; null again on unfocus.shift_enter: a field focused on its own node is styled too.Before the fix, the 6 iOS tests failed. Together with #53's 6 border tests and the validation tests, all pass.
verify_pr.sh(Flutter 3.41.2) at456a98f: