Site icon Flutter Packages | Pub dev Packages – Flutter Mobile App World

Code generation for Flutter Padding widgets

Paddinger

Paddinger is a Flutter package to generate Padding widgets.

Given a set of constants like:

@paddinger
const double PADDING_NORMAL = 8;

A set of Padding classes will be generated like:

NormalAllPadding
NormalLeftPadding
NormalTopPadding
NormalRightPadding
NormalBottomPadding
NormalHorizontalPadding
NormalVerticalPadding
NormalLeftTopPadding
NormalLeftBottomPadding
NormalRightTopPadding
NormalRightBottomPadding

So instead of writing:

Padding(
  padding: const EdgeInsets.all(PADDING_NORMAL),
  child: Text(
    'MyText',
  ),
)

you can just write:

NormalAllPadding(
  child: Text(
    'MyText',
  ),
)

How to use it

dependencies:
  paddinger_annotations: [latestVersionHere]

dev_dependencies:
  paddinger: [latestVersionHere]
// ignore: unused_import
import 'package:flutter/material.dart';
part 'paddings.g.dart';

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

Download Flutter Padding widget source code on GitHub

https://github.com/ema987/paddinger
Exit mobile version