Package selection guidance compiled from public package information, community data, and project usage.
Flutter Gutter is a responsive UI utility package that ensures consistent spacing between widgets across different screen sizes and axis directions. It simplifies layout management by automatically adapting padding and margins based on the orientation (horizontal or vertical) and device dimensions, helping developers maintain clean, aligned interfaces without manual calculations. Ideal for creating fluid, scalable designs that look polished on any platform.
Use cases
Creating responsive layouts with consistent spacing
Automating padding/margin adjustments across orientations
Building adaptable UIs for multi-platform apps
Maintaining visual harmony in dynamic widget arrangements
Simplifying complex layout logic with minimal code
Ensuring accessibility through uniform spacing
Key features
Automatic axis-aware spacing
Responsive to screen size changes
Supports all major platforms
Minimal boilerplate required
Intuitive API for horizontal and vertical gaps
Seamless integration with existing Flutter widgets
Suitable for
Developers focused on responsive design
Teams building cross-platform applications
UI/UX designers implementing consistent spacing
Projects requiring adaptive layouts
Beginners learning Flutter layout principles
Apps targeting diverse screen sizes
Considerations
May require adjustment for highly custom spacing needs
Limited to spacing-related functionality
Not suitable for non-layout use cases
Depends on correct usage of Flutter's layout system
Best paired with other layout utilities for complex designs
Does not replace full layout frameworks like Flex or Grid
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
Flutter Gutter
Ensure all visual gaps between your widgets are consistent, adapted to the axis direction, and
respond to screen size!
Create a vertical gap in vertical layouts (Column, vertical Scrollable, etc) and a horizontal
gap in horizontal layouts (Row, horizontal Scrollable, etc).
Size the gap according to the current screen size and Material Design's corresponding breakpoint
definition (small gap on small screens, larger gap on large screens)
GutterTiny, GutterSmall, GutterLarge and GutterExtraLarge all provide gaps that are factors of the base gutter
size for situations where larger or smaller gaps are more appropriate. By default, each successive
gutter size is a factor of 2 larger than the previous.
For convenience, alternative constructors are provided (Gutter.tiny, etc.) for each gutter size.
For more flexibility, you can also use the provided extension on BuildContext to reference the
gutter and margin sizes directly (context.gutter, context.gutterLarge, context.margin, etc).
Use Gap to create an axis aligned spacing with an explicit size.
Supported Widgets
Flutter Gutter's widgets traverse up the widget tree until they find an ancestor that meets one of
the following conditions:
GutterConfiguration.maybeOf(context).customWidgetToAxis(widget) returns a non-null Axis (this
is a custom function that lets you extend Flutter Gutter to support arbitrary widgets).
widget is a scrollable with a defined axis.
widget has an Axis direction attribute (for example, Flutter Gutter supports
Boxy's widgets automatically).
Note that case 3 means that ANY widget with an axis is supported, however this is a dynamic check
which means that the Dart compiler will not be able to tree shake out any axis attributes on any
widget. This may increase your app's bundle size by a very small amount.
I have a Github issue against Flutter to add an explicit axis scope to Flutter which would
resolve this limitation. If you like using Flutter Gutter and want to see it improved, please upvote
the linked issue.
Example
Without flutter_gutter you have to manually specify the axis direction (by using height or
width) and specify size of the gap yourself:
returnColumn(
children: [
constText('I hate using sized box.'),
SizedBox(height: 10),
constText('If only there were a better way...'),
],
);
With flutter_gutter the Gutter widget identifies that it's in a vertical layout (Column) and
automatically creates a vertical gap. It also looks up the screen size and sizes the gap accordingly
so you don't have to specify a gap size manually:
returnColumn(
children: [
constText('I hate using sized box.'),
Gutter(),
constText('And now I don\'t have to!'),
],
);
To use the gutter sizes directly, use the extension on context:
returnPadding(
padding: EdgeInsets.only(left: context.gutter, right: context.gutterSmall),
child: Text('This is the margin size on this device: ${context.margin}'),
);
To use Gutter with custom widgets that don't expose an axis argument or to override the default
gutter spacing or scaling, use GutterConfiguration:
returnGutterConfiguration(
data: GutterConfigurationData(
widgetToAxis: (widget) {
if (widget isMyCustomColumn) {
returnAxis.vertical;
}
returnnull;
},
),
child: MyCustomColumn(
children: [
constText('This widget isn\'t supported by `Gutter` ).'),
Gutter(),
constText('But with `GutterConfiguration` I can make Gutter work with any widget!'),
],
),
);
Gap and Flutter Gutter are very similar, but Flutter Gutter does a few extra things Gap does not:
Auto sizes gap spacing according to the Material breakpoints system (see "Core Features" above).
Detects the axis of ANY widget that exposes an Axis direction attribute or getter (see
"Supported Widgets" above).
Allows you to add support for arbitrary widgets using GutterConfiguration and widgetToAxis.
Personally, I especially appreciate feature 1 as it makes it easier for me to add spacing and
ensures that spacing and padding in different parts of my app are consistently sized. However, if
none of the above features are important to you, you'll likely prefer the Gap package!