SmartForm class
A responsive form layout that automatically adjusts columns per breakpoint.
Use SmartForm to create forms that display:
- 1 column on mobile
- 2 columns on tablet
- 3 columns on desktop
Example:
SmartForm(
children: [
SmartFormField(child: TextField(decoration: InputDecoration(labelText: 'Name'))),
SmartFormField(child: TextField(decoration: InputDecoration(labelText: 'Email'))),
SmartFormField(child: TextField(decoration: InputDecoration(labelText: 'Phone'))),
SmartFormField(
span: 2, // Takes 2 columns on tablet/desktop
child: TextField(decoration: InputDecoration(labelText: 'Address')),
),
],
)
With custom column counts:
SmartForm(
mobileColumns: 1,
tabletColumns: 3,
desktopColumns: 4,
children: [...],
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- SmartForm
- Available extensions
Constructors
-
SmartForm({required List<
SmartFormField> children, Key? key, int watchColumns = 1, int mobileColumns = 1, int tabletColumns = 2, int desktopColumns = 3, int tvColumns = 4, SpacingSize spacing = SpacingSize.md, SpacingSize runSpacing = SpacingSize.md, WrapCrossAlignment crossAxisAlignment = WrapCrossAlignment.start, EdgeInsets? padding}) -
Creates a SmartForm widget.
const
Properties
-
children
→ List<
SmartFormField> -
The form fields to display.
final
- crossAxisAlignment → WrapCrossAlignment
-
How the children should be aligned within a row.
final
- desktopColumns → int
-
Number of columns on desktop-sized screens.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- mobileColumns → int
-
Number of columns on mobile-sized screens.
final
- padding → EdgeInsets?
-
Optional padding around the form.
final
- runSpacing → SpacingSize
-
The spacing between rows.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- spacing → SpacingSize
-
The spacing between columns.
final
- tabletColumns → int
-
Number of columns on tablet-sized screens.
final
- tvColumns → int
-
Number of columns on TV-sized screens.
final
- watchColumns → int
-
Number of columns on watch-sized screens.
final
Methods
-
aligned(
AlignmentGeometry alignment) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Aligns this widget within its parent. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
centered(
) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Centers this widget. -
clipped(
{BorderRadius borderRadius = BorderRadius.zero}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget with a ClipRRect. -
constrained(
{double? minWidth, double? maxWidth, double? minHeight, double? maxHeight}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a ConstrainedBox. -
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
decorated(
BoxDecoration decoration) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a DecoratedBox. -
expanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Expands this widget to fill available space. -
flexible(
{int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Makes this widget flexible. -
hideOn(
List< SmartBreakpoint> breakpoints, {Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Hides this widget on the specified breakpoints. -
hideOnDesktop(
{Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Hides this widget on desktop and TV breakpoints. -
hideOnMobile(
{Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Hides this widget on mobile and watch breakpoints. -
inkWell(
{VoidCallback? onTap, BorderRadius? borderRadius}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget with Material and InkWell for ripple effects. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onTap(
VoidCallback? onTap) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a GestureDetector. -
opacity(
double opacity) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds opacity to this widget. -
padded(
EdgeInsets padding) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds padding using EdgeInsets. -
paddedAll(
double value) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds equal padding on all sides. -
paddedHorizontal(
double value) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds horizontal padding. -
paddedSymmetric(
{double horizontal = 0, double vertical = 0}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds symmetric padding. -
paddedVertical(
double value) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds vertical padding. -
responsivePadding(
{EdgeInsets? watch, EdgeInsets? mobile, EdgeInsets? tablet, EdgeInsets? desktop, EdgeInsets? tv}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds responsive padding to this widget. -
safeArea(
{bool left = true, bool top = true, bool right = true, bool bottom = true}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a SafeArea. -
scrollable(
{Axis scrollDirection = Axis.vertical, EdgeInsets? padding}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a SingleChildScrollView. -
showOnDesktop(
{Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Shows this widget only on desktop and TV breakpoints. -
showOnly(
List< SmartBreakpoint> breakpoints, {Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Shows this widget only on the specified breakpoints. -
showOnMobile(
{Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Shows this widget only on mobile and watch breakpoints. -
showOnTablet(
{Widget? replacement}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Shows this widget only on tablet breakpoint. -
sized(
{double? width, double? height}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Wraps this widget in a SizedBox with the given dimensions. -
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
-
withPadding(
SpacingSize size) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds padding using spacing tokens. -
withPaddingOnly(
{SpacingSize? left, SpacingSize? top, SpacingSize? right, SpacingSize? bottom}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds padding on specific sides using spacing tokens. -
withSymmetricPadding(
{SpacingSize? horizontal, SpacingSize? vertical}) → Widget -
Available on Widget, provided by the SmartWidgetExtension extension
Adds symmetric padding using spacing tokens.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited