nice_button 0.1.7

nice_button #

pub package Donate

A Flutter package for Android and IOS to design nice buttons with no hassle in your app. Enjoy !

Installation #

Add the following to pubspec.yaml

dependencies:
  ...
  nice_button: ^0.1.7

Usage Example #

import nice_button.dart

import 'package:nice_button/nice_button.dart';

For normal buttons #

NiceButton(
    width: 255,
    elevation: 8.0,
    radius: 52.0,
    text: "Login",
    background: yourColor,
    onPressed: () {
        print("hello");
        },
    ),

For mini buttons #

Icon is required in this case

NiceButton(
    mini: true,
    icon: Icons.home,
    background: yourColor,
    onPressed: () {
        print("hello");
    },
    )

For gradient buttons #

var firstColor = Color(0xff5b86e5), secondColor = Color(0xff36d1dc);

NiceButton(
    radius: 40,
    padding: const EdgeInsets.all(15),
    text: "Register",
    icon: Icons.account_box,
    gradientColors: [secondColor, firstColor],
    onPressed: () {},
    )

Package demo

Refer to example folder and the source code for more information.

[0.1.0]

  • Initial build for Flutter nice button library

[0.1.1]

  • Format code and some minor changes

[0.1.2]

  • Update the documentation and some minor changes

[0.1.3]

  • Update package description to provide more info

[0.1.4]

  • Remove 'new' reserved keyword (this is not necessary since Dart 2.0)
  • Dart Style Guide says "Don't initialize variables to null"
  • Upgrade SDK version to 2.2 (Now you can use spread operators)
  • Some basic refactoring to improve code reusability and make easy to read

[0.1.5]

  • Add fontSize parameter to button

[0.1.6]

  • Add iconColor parameter to button

[0.1.7]

  • you can set custom width for mini buttons

example/README.md

A Complete Example #

A new Flutter project.

import 'package:flutter/material.dart';
import 'package:nice_button/NiceButton.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Nice Button Demo',
      theme: new ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  MyHomePageState createState() {
    return new MyHomePageState();
  }
}

class MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
  @override
  Widget build(BuildContext context) {
    var firstColor = Color(0xff5b86e5), secondColor = Color(0xff36d1dc);
    return new Scaffold(
      appBar: new AppBar(
        backgroundColor: firstColor,
        title: new Text('Nice Button Demo'),
      ),
      body: new Material(
        child: new Center(
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: new Column(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                NiceButton(
                  width: 255,
                  elevation: 8.0,
                  radius: 52.0,
                  text: "Login",
                  background: firstColor,
                  onPressed: () {
                    print("hello");
                  },
                ),
                NiceButton(
                  mini: true,
                  icon: Icons.home,
                  background: firstColor,
                  onPressed: () {
                    print("hello");
                  },
                ),
                NiceButton(
                  elevation: 5,
                  mini: true,
                  icon: Icons.label,
                  gradientColors: [secondColor, firstColor],
                  onPressed: () {},
                ),
                NiceButton(
                  radius: 40,
                  padding: const EdgeInsets.all(15),
                  text: "Register",
                  icon: Icons.account_box,
                  gradientColors: [secondColor, firstColor],
                  onPressed: () {},
                )
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  nice_button: ^0.1.7

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:nice_button/nice_button.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
82
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]
91
Learn more about scoring.

We analyzed this package on Sep 13, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.2

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test