Space
A lightweight Flutter package that provides clean and reusable widgets for adding horizontal and vertical spacing in your UI.
Stop writing SizedBox(height: 20) everywhere โ simply use VerticalSpace(20) or HorizontalSpace(20) to keep your widget tree clean and readable.
โจ Features
- ๐ Ultra-lightweight (zero dependencies)
- ๐ Simple vertical & horizontal spacing widgets
- ๐งน Cleaner widget tree with meaningful UI structure
- ๐จ Improves readability and consistency across layouts
- ๐ผ Works with any Flutter widget (Row, Column, ListView, etc.)
๐ฆ Installation
Add this to your pubspec.yaml:
dependencies:
space: ^1.0.0
Import the package:
import 'package:space/space.dart';
๐ Usage
โค Vertical Space
VerticalSpace(20); // 20px height
โค Horizontal Space
HorizontalSpace(16); // 16px width
๐งฑ Examples
Column Example
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Top Section"),
VerticalSpace(24),
Text("Bottom Section"),
],
);
Row Example
Row(
children: [
Icon(Icons.star),
HorizontalSpace(12),
Text("Starred Item"),
],
);
๐ง Optional Helper Functions (if included)
h(12); // horizontal 12px
v(20); // vertical 20px
๐ Example App
A complete usage example is available inside the /example folder of this package.
๐งฉ Why Use This Package?
- No need to create your own
SizedBoxrepeatedly - More readable and declarative UI
- Standardized spacing across your project
- Extremely small and dependency-free
๐ License
MIT License
โญ Support This Package
If you like this package:
- โญ Star it on GitHub
- ๐ Like it on pub.dev
- ๐ Share it with other Flutter developers