Repository navigation
fix: map TextField border keyword onto the iOS field decoration - #53
Merged
AdamMusa merged 2 commits intoOct 29, 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.
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.
Engine-only fix (no Ruby change;
border,border_color,border_width,border_radius,filled,fill_colorandbgcolorare already TextField keywords).Problem
On iOS,
text_field(border: "none")still drew the native rounded border and white fill. Insidecupertino_textfield.dart:"none"reached the Border-map parser, which threw.catchleftbordernull.defaultDecoration.copyWith(border: null, color: null, ...)keeps the default border, fill and radius.This breaks the documented
form_row(text_field(border: "none"), ...)pattern from Package B (engine #21 / ruflet #37). The other string values were off too:"outline"and"underline"drew a hard-coded 1 dp black line instead of the native separator hairline, andfilled/fill_colorwere ignored on iOS.Fix
One
_decoration()helper in the Cupertino renderer, with no Material symbols:border{bottom: {...}})"outline"Border.allwith the native hairline color/width unlessborder_color/border_widthare given;border_width: 0removes it (same as Material)"underline"border_radius), no fill"none"decoration: null): no border, no fill, and no gray box whendisabledThese still paint on any style:
bgcolor,filled: true(fill_color ?? bgcolor ?? CupertinoColors.tertiarySystemFill, the iOS filled-field color),gradient,imageandshadows. For example,border: "none", filled: truegives a borderless filled field like a search field.border_radiusdefaults to the native 5 dp. Unknown border strings fall back to the native field with a debugPrint.Material is unchanged;
form_field.dartis untouched.Visible changes
On iOS, an explicit
border: "outline"orborder: "underline"now renders the native grey hairline instead of a 1 dp black line, andunderlineno longer has the white fill. Apps that want the old look can setborder_color: "black", border_width: 1:Fields without a
borderkeyword, and Material, look exactly as before.Tests
test/widgets/ruby_text_field_border_test.dart(6 tests):none:CupertinoTextField.decoration == null, and noDecoratedBoxwith a border or fill is painted. This holds for disabled fields too.none+ background:bgcolor,filledandfill_colorpaint a fill with no border.outline:border_color/border_width: 2give a red 2 dp border, which grows the field by 4 dp and insets the text by 2 dp. ABoxDecorationborder adds to layout padding.border_width: 0removes the border, andborder_radiusis honored.underline: bottom rule only,BorderRadius.zero, no fill. A 1 dp rule grows the field by 1 dp versus the hairline;filledadds the fill.outline→OutlineInputBorder,underline→UnderlineInputBorder,none→InputBorder.none, andfilled+fill_colorstill fill. No Cupertino widgets render on Android.Before the fix, the 4 string-border iOS tests failed (
nonekept the native decoration; outline/underline were 1 dp black). The map and Material tests passed before and after.Form-row check (not committed): on a throwaway merge of this branch with
origin/feat/form-row(#21),form_row(prefix: "Name", content: text_field(border: "none", expand: 1))on iOS rendersCupertinoFormRowwith no field box, and the text vertically aligned with and right of the prefix. The same test on #21 alone fails with the nativeBoxDecoration. The two branches merge cleanly.verify_pr.sh(Flutter 3.41.2):