apptomate_custom_row 0.0.1
apptomate_custom_row: ^0.0.1 copied to clipboard
A customizable Flutter Row widget with built-in spacing between children and additional layout options.
CustomRow Widget #
A customizable Flutter Row widget with built-in spacing between children and additional layout options.
Features #
- Consistent spacing between child widgets
- Optional outer spacing (padding-like behavior)
- Full control over main and cross axis alignment
- Runtime validation for negative spacing
- Demo widget showcasing various configurations
- Maintains all standard Row functionality
Installation #
Add the dependency to your pubspec.yaml:
dependencies:
apptomate_custom_row: ^0.0.1
Usage #
Basic Usage #
CustomRow(
spacing: 12.0,
children: [
Icon(Icons.home),
Text('Home'),
Icon(Icons.arrow_forward),
],
)
Available Parameters #
| Parameter | Type | Default | Description |
|---|---|---|---|
children |
List | required | Widgets to display in the row |
spacing |
double | 8.0 | Space between children (must be ≥ 0) |
includeOuterSpacing |
bool | false | Adds spacing at row start/end |
mainAxisAlignment |
MainAxisAlignment | start | Main axis alignment |
crossAxisAlignment |
CrossAxisAlignment | center | Cross axis alignment |
mainAxisSize |
MainAxisSize | max | Row's main axis size behavior |
Advanced Examples #
With outer spacing:
CustomRow(
spacing: 16.0,
includeOuterSpacing: true,
children: [/*...*/],
)
Space between items:
CustomRow(
spacing: 12.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [/*...*/],
)
Demo #
The package includes a CustomRowWidget demo that shows four different configurations:
- Default spacing (8.0)
- Increased spacing (16.0)
- With outer spacing
- Space-between layout
To run the demo:
void main() {
runApp(MaterialApp(
home: CustomRowWidget(),
));
}
Implementation Details #
The widget works by:
- Accepting standard Row parameters
- Automatically inserting
SizedBoxwidgets between children - Optionally adding leading/trailing spacing
- Maintaining all native Row functionality
Best Practices #
- Use consistent spacing values throughout your app
- Consider
includeOuterSpacingfor better visual balance - Combine with
MainAxisAlignmentfor advanced layouts - For complex scenarios, nest
CustomRowwithin other layout widgets
Comparison with Flutter's Row #
| Feature | Flutter Row | CustomRow |
|---|---|---|
| Child spacing | Manual (wrap each child) | Automatic |
| Outer spacing | Requires Padding | Built-in option |
| Spacing validation | No | Yes (non-negative) |
| Code verbosity | High | Reduced |