fix: keep borderless form widgets borderless under an app's theme - #160
Merged
Merged
Conversation
Widgets that bring their own layout set `InputDecoration.border` to `InputBorder.none`, some of them `errorBorder` as well, but never the remaining state borders. An `InputDecorator` picks `enabledBorder`, `disabledBorder`, `focusedBorder`, `errorBorder` or `focusedErrorBorder` depending on the field's state and only falls back to `border` where the matching one is `null`. `InputDecoration.applyDefaults` fills those missing slots from the `InputDecorationTheme` of the embedding app, so an app that styles the individual states — a visible line in the resting state, for example — drew a box around a checkbox or an option list. The app cannot work around it either: the theme applies to every field or to none. Sets all five in `CheckBoxFormWidget`, `AttachmentFormWidget`, `GeolocationFormWidget`, `AddressFormWidget`, `EnumFormWidget`, `EnumCollectionFormWidget` and the two inner fields of `DateTimeFormWidget`, through a new `InputDecorationX.withoutBorder` rather than repeating six lines eight times. `borderInEveryState` covers the general case. Only the Widgets that wrap their own content are affected. A single select rendered as a dropdown is an ordinary field and keeps the border the app asked for, which a test pins down next to the borderless ones. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Symptom
Seit die Labels über den Feldern stehen (2.4.0), hat das Thema von ApptiveTeams wieder eine Linie im Ruhezustand — und die Checkbox „Discussed with Team?" im Urlaubsantrag sitzt seitdem in einem Kasten. Die App kann das nicht abfangen: das
InputDecorationThemegilt für alle Felder oder für keins.Ursache
Die betroffenen Widgets setzen
InputDecoration.borderaufInputBorder.none, teils aucherrorBorder, aber nie die übrigen Zustände. EinInputDecoratorwählt aber nach Zustand aus und greift aufbordernur zurück, wo der passende Eintragnullist:Und
InputDecoration.applyDefaultsfüllt genau diese Lücken vorher aus demInputDecorationThemeder einbettenden App.border: InputBorder.noneallein deckt also keinen der sechs Zustände ab, sobald eine App die Einzelzustände stylt. Flutters Doku sagt es wörtlich: „all five borders … must be set."Änderung
Ein Helfer statt sechs Zeilen achtmal:
Angewandt in
CheckBoxFormWidget,AttachmentFormWidget,GeolocationFormWidget,AddressFormWidget,EnumFormWidget,EnumCollectionFormWidgetund den beiden inneren Feldern vonDateTimeFormWidget.Abgrenzung
Betroffen sind nur die Widgets, die ihr eigenes Layout mitbringen. Ein
singleSelectals Dropdown ist ein ganz normales Feld und behält den Rahmen der App —EnumFormWidgetnutzt den rahmenlosenInputDecoratornur beitype == 'selectList'. Ein eigener Test hält das fest, damit später nicht zu viel unterdrückt wird.Testing
test/border_suppression_test.dart, davon einer, der die Ursache selbst festnagelt:InputDecoration(border: none).applyDefaults(theme)liefert weiterhin den sichtbarenenabledBorder.flutter testin apptive_grid_form: 345/345melos run lint:all: SUCCESSflutter pub publish --dry-run: 0 Warningsmelos run test:allmeldet einen Fehlschlag inapptive_grid_theme(Golden-Tests der macOS-Variante). Vorbestehend — schlägt auf dem 2.4.0-Standcb8efecin einem frischen Worktree genauso fehl, und dieser Branch fasst kein File in dem Paket an.Gegengeprüft
In ApptiveTeams per Path-Override gebaut, Team ZWEIDENKER → Urlaubsantrag: Checkbox ohne Kasten, Textfelder mit Rahmen. Override wieder entfernt.
Nicht Teil dieses PRs
SignatureFormWidgethat denselben Defekt mit umgekehrtem Vorzeichen: es setztborderunderrorBorderaufOutlineInputBorder(), aber nicht die anderen drei, bekommt im Ruhezustand also den Rahmen der App und im Fehlerzustand seinen eigenen. Inkonsistent, aber nicht kaputt — es vollständig zu setzen würde den fokussierten Zustand sichtbar verändern, und das ist eine Design-Entscheidung.🤖 Generated with Claude Code