indicator_button 1.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

Indicator Button #

A Flutter Button with indicates progress

Pub GitHub

Demo: #

Demo 1

Demo 2

Demo 3

Getting Started #

  • Add dependency to your pubspec.yaml
dependencies:
  indicator_button: ^1.0.1
  • Install packages
flutter pub get
  • Import it
import 'package:indicator_button/indicator_button.dart';
  • Add indicator to your widget tree
  int _targetUserId = 123;
  List<int> _followingUserIdList = [123];

  Widget _createFollowButton() {
    var followed = _followingUserIdList.contains(_targetUserId);
    var buttonText = followed ? 'Following' : ' +  Follow';
    var buttonBackgroundColor = followed ? Colors.white30 : Colors.white;
    var borderColor = followed ? Colors.grey : Colors.blue;
    var textColor = followed ? Colors.grey : Colors.blue;

    var button = IndicatorButton(
      backgroundColor: buttonBackgroundColor,
      progressColor: textColor,
      borderColor: borderColor,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Icon(
            Icons.remove_red_eye,
            size: 20.0,
            color: textColor,
          ),
          Text(
            buttonText,
            style: TextStyle(
              fontWeight: FontWeight.bold,
              fontSize: 15.0,
              color: textColor,
            ),
          ),
        ],
      ),
      onPressed: () async {
        await Future.delayed(new Duration(milliseconds: 2000), () {
          setState(() {
            if (followed) {
              _followingUserIdList.remove(_targetUserId);
            } else {
              _followingUserIdList.add(_targetUserId);
            }
          });
        });
      },
    );

    return Container(
      width: 130.0,
      height: 32.0,
      child: button,
    );
  }

Contributing #

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Contributors #

See the Contributors List.

CHANGE LOG #

See the CHANGELOGS.md.

License #

This project is licensed under the MIT License - see the LICENSE file for details

[1.0.0] - 2019-08-02

  • add example and english demo

[0.0.3] - 2019-08-02

  • fix demo.

[0.0.2] - 2019-08-02

  • fix bug and readme.

[0.0.1] - 2019-07-31.

  • first release.

example/README.md

Example #

example application for indicator_button .

Demo 3

Getting Started #

  • Add dependency to your pubspec.yaml
dependencies:
  indicator_button: ^1.0.1
  • Install packages
flutter pub get
  • Import it
import 'package:indicator_button/indicator_button.dart';
  • Add indicator to your widget tree
  int _targetUserId = 123;
  List<int> _followingUserIdList = [123];

  Widget _createFollowButton() {
    var followed = _followingUserIdList.contains(_targetUserId);
    var buttonText = followed ? 'Following' : ' +  Follow';
    var buttonBackgroundColor = followed ? Colors.white30 : Colors.white;
    var borderColor = followed ? Colors.grey : Colors.blue;
    var textColor = followed ? Colors.grey : Colors.blue;

    var button = IndicatorButton(
      backgroundColor: buttonBackgroundColor,
      progressColor: textColor,
      borderColor: borderColor,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Icon(
            Icons.remove_red_eye,
            size: 20.0,
            color: textColor,
          ),
          Text(
            buttonText,
            style: TextStyle(
              fontWeight: FontWeight.bold,
              fontSize: 15.0,
              color: textColor,
            ),
          ),
        ],
      ),
      onPressed: () async {
        await Future.delayed(new Duration(milliseconds: 2000), () {
          setState(() {
            if (followed) {
              _followingUserIdList.remove(_targetUserId);
            } else {
              _followingUserIdList.add(_targetUserId);
            }
          });
        });
      },
    );

    return Container(
      width: 130.0,
      height: 32.0,
      child: button,
    );
  }

Use this package as a library

1. Depend on it

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


dependencies:
  indicator_button: ^1.0.1

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

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/indicator_button.dart.

Run flutter format to format lib/indicator_button.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <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