FormFieldStyle class
How every form field in an app, a form or a part of the screen is drawn: its box, border, label and spacing.
Colors still come from the theme's NyFieldColors, so each style works
in light and dark. A field's own style: wins over its form's
NyFormWidget.fieldStyle, which wins over the app's.
For the whole app, in Nylo.configure:
formFieldStyle: FormFieldStyle.outlined(),
For one form:
class ProfileForm extends NyFormWidget {
@override
FormFieldStyle get fieldStyle => FormFieldStyle.grouped();
}
- Annotations
Constructors
- FormFieldStyle.filled({double radius = 12, FieldLabelPosition labelPosition = FieldLabelPosition.above, bool dense = false})
-
A soft grey box with a hairline border, the label above it. The
default.
const
- FormFieldStyle.grouped({double radius = 12, bool dense = false})
-
Fields as rows in one card, each label beside its value, as in iOS
settings. A form puts its text, picker, date and switch fields that
follow each other in one card; elsewhere, wrap them in a
FormFieldGroup.
const
- FormFieldStyle.outlined({double radius = 10, FieldLabelPosition labelPosition = FieldLabelPosition.above, bool dense = false})
-
A transparent box with a crisp border that turns into a 2 px accent
border when focused. For business, admin and web-like apps.
const
- FormFieldStyle.underlined({FieldLabelPosition labelPosition = FieldLabelPosition.above, bool dense = false})
-
No box, just a line under the field that thickens to the accent when
focused. For minimal apps and long forms of short fields.
const
Properties
- contentPadding → EdgeInsetsGeometry
-
The padding inside a field's box.
no setter
- dense → bool
-
Whether fields are shorter, for forms with many fields.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- isGrouped → bool
-
Whether fields are rows in a card.
no setter
- labelGap → double
-
The space between a label and the field under it.
no setter
- labelPosition → FieldLabelPosition
-
Where a field's label sits. A grouped field's label is always beside
its value.
final
- look → FormFieldLook
-
Which of the four looks this is.
final
- radius → double
-
The corner radius of a field's box, or of a group's card.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
cardDecoration(
NyFieldColors colors) → BoxDecoration? - Where a radio group or switch row draws its card: a filled or outlined one, or none for FormFieldLook.underlined.
-
decoration(
NyFieldColors colors, {required bool hasError, required bool disabled, BorderRadius? radius}) → InputDecoration -
A field's box: its fill and borders for each state, in
colors. -
groupDecoration(
NyFieldColors colors) → BoxDecoration - The card behind a FormFieldGroup, and behind a grouped field shown on its own.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Methods
-
of(
BuildContext context) → FormFieldStyle -
The style for
context: the nearest FormFieldStyleScope's, else the app's fromNylo.configure, else FormFieldStyle.filled.