Code generation for Flutter Padding widgets based on your constants

Related tags

Widgets paddinger
Overview

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

  • Add the following as dependencies:
dependencies:
  paddinger_annotations: [latestVersionHere]

dev_dependencies:
  paddinger: [latestVersionHere]
  • 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';
  • Add the part directive:
part 'paddings.g.dart';
  • 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

You might also like...

Flutter widgets and themes implementing the current macOS design language.

Flutter widgets and themes implementing the current macOS design language.

macos_ui Flutter widgets and themes implementing the current macOS design language. NOTE: This package depends on the excellent native_context_menu pl

Jan 7, 2023

Flutter Package for Easier Creation of Home Screen Widgets

Flutter Package for Easier Creation of Home Screen Widgets

Home Widget HomeWidget is a Plugin to make it easier to create HomeScreen Widgets on Android and iOS. HomeWidget does not allow writing Widgets with F

Dec 31, 2022

This repo is for anything that can be reusable in flutter like custom widgets 🟥, animations 🌟and more

Flutter Shortcuts This repo is for anything that can be reusable in flutter like custom widgets 🟥 , animations 🌟 and more. How to Use Just get the f

Dec 3, 2022

A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

A basic Flutter app that includes some native Widgets like alerts, cards, avatars, animated container, inputs, etc.

Flutter components This project was created with Flutter and some native Widgets like alerts, cards, avatars, animated container, inputs, etc. Getting

Nov 15, 2021

A Flutter package which provides helper widgets for selecting single or multiple account/user from the given list.

A Flutter package which provides helper widgets for selecting single or multiple account/user from the given list.

account_selector A Flutter package which provides helper widgets for selecting single or multiple account/user from a list Supported Dart Versions Dar

Oct 7, 2021

Custom Flutter widgets that makes Checkbox and Radio Buttons much cleaner and easier.

Custom Flutter widgets that makes Checkbox and Radio Buttons much cleaner and easier.

custom_radio_grouped_button Custom Radio Buttons and Grouped Check Box Button Custom Flutter widgets that makes Checkbox and Radio Buttons much cleane

Sep 23, 2022

A flutter widget for comparing two stacked widgets by dragging a slider thumb to reveal either sides of the slider horizontally or vertically.

A flutter widget for comparing two stacked widgets by dragging a slider thumb to reveal either sides of the slider horizontally or vertically.

Juxtapose A flutter widget for comparing two stacked widgets by dragging a slider thumb to reveal either sides of the slider horizontally or verticall

Nov 24, 2022

Interactive Widgets For Flutter

Interactive Widgets For Flutter

Flutter Interactive Widgets : This application covers following concepts, Gesture-based Widgets Time Picker Date Picker Input and Selection Widgets Di

Feb 25, 2022

Show custom in-app notification with any Widgets in flutter

Show custom in-app notification with any Widgets in flutter

notify_inapp show custom in-app notification with any Widgets. Getting Started Add this to your package's pubspec.yaml file: dependencies: notify_in

Aug 19, 2022
Releases(v0.2.0)
Owner
Emanuele
An Android Developer who likes to also explore other worlds. Check me out at https://www.emanuelepapa.dev or read my blog at https://www.w3ma.com
Emanuele
Flutter package: Assorted layout widgets that boldly go where no native Flutter widgets have gone before.

assorted_layout_widgets I will slowly but surely add interesting widgets, classes and methods to this package. Despite the package name, they are not

Marcelo Glasberg 122 Dec 22, 2022
Flutter-useful-widgets - Flutter Useful Widgets

useful_widgets This package makes it easy to build apps by providing a list of simple and useful widgets. import 'package:useful_widgets/useful_widget

Ricardo Crescenti 6 Jun 20, 2022
Custom widgets and utils using Flutter framework widgets and Dart language

reuse_widgets_and_utils The custom widgets and utils using Flutter framework widgets and Dart programming language. Getting Started This project is a

null 1 Oct 29, 2021
Widgets beginner - Widgets beginner with flutter

Widgets beginner - Widgets beginner with flutter

Tukhtamurodov Sardorbek 2 Feb 6, 2022
React hooks for Flutter. Hooks are a new kind of object that manages a Widget life-cycles. They are used to increase code sharing between widgets and as a complete replacement for StatefulWidget.

English | Português Flutter Hooks A Flutter implementation of React hooks: https://medium.com/@dan_abramov/making-sense-of-react-hooks-fdbde8803889 Ho

Remi Rousselet 2.6k Dec 29, 2022
A code generator to write widgets as function without loosing the benefits of classes.

Widgets are cool. But classes are quite verbose: class Foo extends StatelessWidget { final int value; final int value2; const Foo({Key key, thi

Remi Rousselet 528 Dec 29, 2022
A collection of widgets for making amazing onboarding experience in your flutter applications

Pal widgets A flutter package for better onboarding. A set of amazing onboarding widgets for your flutter applications. Install package add in your pu

Apparence.io 25 Oct 7, 2022
An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

An extensive snap tool/widget for Flutter that allows very flexible snap management and snapping between your widgets.

AliYigitBireroglu 101 Dec 16, 2022
Various Flutter widgets that are developed by Google but not by the core Flutter team

Flutter widgets This repository contains the source code for various Flutter widgets that are developed by Google but not by the core Flutter team. Is

Google 1.1k Jan 7, 2023
Flutter UI Widgets Flutter Package

Flutter UI Widgets Flutter Package This package makes different Flutter UI widgets implementation easy for you. Flutter UI Widgets The list of widgets

Hassan Ur Rahman 0 May 6, 2022