pad 0.2.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 75

Pad #

pub package

Quick padding for Flutter with a short syntax. Instead of:

   const Padding(
      padding: EdgeInsets.only(top: 10.0),
      child: Text("Foo")
   )

You can use:

   const PadTop(10.0, child: Text("Foo"))

Usage #

Directional padding #

   const Pad(
      bottom: 10.0,
      top: 10.0,
      left: 10.0,
      right: 10.0,
      child: Text("Foo")
   )

All parameters are optional

Pad left #

   const PadLeft(10.0, child: Text("Foo"))

Pad right #

   const PadRight(10.0, child: Text("Foo"))

Pad top #

   const PadTop(10.0, child: Text("Foo"))

Pad bottom #

   const PadBottom(10.0, child: Text("Foo"))

Pad horizontal #

   const PadHorizontal(10.0, child: Text("Foo"))

Pad vertical #

   const PadVertical(10.0, child: Text("Foo"))

Pad all #

   const PadAll(10.0, child: Text("Foo"))

Pad from LTRB #

   const PadLTRB(
      10.0,
      15.0,
      10.0,
      15.0,
      child: Text("Foo")
   )

Changelog #

0.2.0 #

Add PadLeft, PadRight, PadTop, PadBottom

0.1.0 #

Initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:pad/pad.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text("Pad")),
        body: PadAll(
          15.0,
          child: ListView(children: <Widget>[
            Container(
              color: Colors.grey[300],
              child: const Pad(top: 100.0, left: 100.0, child: Text("Foo")),
            ),
            const Pad(bottom: 10.0),
            Container(
              color: Colors.grey[300],
              child: const PadAll(100.0, child: Text("Foo")),
            ),
            const Pad(bottom: 10.0),
            Container(
              color: Colors.grey[300],
              child: const PadVertical(100.0, child: Text("Foo")),
            ),
            const Pad(bottom: 10.0),
            Container(
              color: Colors.grey[300],
              child: const PadHorizontal(100.0, child: Text("Foo")),
            ),
            const Pad(bottom: 10.0),
            Container(
              color: Colors.grey[300],
              child: const PadLTRB(
                25.0,
                50.0,
                25.0,
                50.0,
                child: Text("Foo"),
              ),
            ),
            const Pad(bottom: 50.0)
          ]), // This trailing comma makes auto-formatting nicer for build methods.
        ));
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  pad: ^0.2.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:pad/pad.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
51
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jul 9, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • pad that is a package requiring null.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
cupertino_icons ^0.1.2 0.1.3
extra_pedantic ^1.1.1+3 1.2.0
flutter 0.0.0
pedantic ^1.7.0 1.9.0 1.9.1
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.1
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test