dimengen 0.1.0
dimengen: ^0.1.0 copied to clipboard
Flutter Dimensions Generator
Dimengen β Flutter Dimensions Generator #
Dimengen is a SourceGen-based code generator for Flutter that automatically creates EdgeInsets, BorderRadius, SizedBox constants (e.g., sVerticalMBottom, mAll, lOnlyLeft, etc.) based on a custom dimensions class.
Example #
Define your dimension constants inside an annotated class:
import 'package:dimengen/dimengen.dart';
@Dimengen()
abstract final class Dimensions {
static const double s = 8.0;
static const double m = 16.0;
static const double l = 24.0;
}
Then you can simply use them like this:
Padding(
padding: DimensionsInsets.sVertical,
child: Text('Example'),
)
Installation
Add to your pubspec.yaml:
dependencies:
dimengen: ^0.1.0
dev_dependencies:
build_runner: ^2.4.6
βCode Generation
Run:
flutter pub run build_runner build
Or watch for changes:
flutter pub run build_runner watch
Why Use Dimengen?
- Centralized dimension values
- Promotes clean, reusable, and consistent UI spacing
- Automatically generates dozens of EdgeInsets variants
- Improves code readability and maintainability
π€ Contributing
Have suggestions or improvements? Feel free to submit a pull request or open an issue. Contributions are welcome!