Last updated:
0 purchases
paddinger
Paddinger #
Paddinger is a Flutter package to generate Padding widgets.
Given a set of constants like:
@paddinger
const double PADDING_NORMAL = 8;
copied to clipboard
A set of Padding classes will be generated like:
NormalAllPadding
NormalLeftPadding
NormalTopPadding
NormalRightPadding
NormalBottomPadding
NormalHorizontalPadding
NormalVerticalPadding
NormalLeftTopPadding
NormalLeftBottomPadding
NormalRightTopPadding
NormalRightBottomPadding
copied to clipboard
So instead of writing:
Padding(
padding: const EdgeInsets.all(PADDING_NORMAL),
child: Text(
'MyText',
),
)
copied to clipboard
you can just write:
NormalAllPadding(
child: Text(
'MyText',
),
)
copied to clipboard
How to use it #
Add the following as dependencies:
dependencies:
paddinger_annotations: [latestVersionHere]
dev_dependencies:
paddinger: [latestVersionHere]
copied to clipboard
Create a file where you will add all your PADDING_ constants, the file could be named paddings.dart.
Add your favourite material or cupertino import like:
// ignore: unused_import
import 'package:flutter/material.dart';
copied to clipboard
Add the part directive:
part 'paddings.g.dart';
copied to clipboard
Run the code generation with flutter pub run build_runner build --delete-conflicting-outputs
Have a look at the example app to see it in practice.
Publishing #
Dry Run:
flutter packages pub publish --dry-run
To publish:
flutter packages pub publish
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.