utils/spacing library
Utility class for consistent spacing throughout Flutter applications.
Provides spacing constants and helper methods for creating consistent spacing widgets and EdgeInsets throughout your application.
Features
- Spacing Constants: Predefined spacing values (xs, sm, md, lg, xl, xxl, huge)
- SizedBox Helpers: Create vertical, horizontal, and square spacing widgets
- EdgeInsets Helpers: Create padding and margin with consistent spacing
- Predefined Widgets: Ready-to-use SizedBox widgets for common spacing
Usage
import 'package:save_points_extensions_utils/utils/spacing.dart';
// Use constants
Container(
padding: EdgeInsets.all(Spacing.md),
child: Text('Hello'),
)
// Use helpers
Column(
children: [
Text('First'),
Spacing.vertical(Spacing.md),
Text('Second'),
],
)
// Use predefined widgets
Column(
children: [
Text('First'),
Spacing.verticalMd,
Text('Second'),
],
)
Best Practices
- Use spacing constants instead of magic numbers
- Use predefined widgets for common spacing patterns
- Create custom spacing configs for different themes
Classes
- Spacing
- Utility class for consistent spacing throughout the application.