indicator_button 1.0.1 copy "indicator_button: ^1.0.1" to clipboard
indicator_button: ^1.0.1 copied to clipboard

A Flutter Button with indicates progress. It can play an animation indicates progress when the button is pressed

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

0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A Flutter Button with indicates progress. It can play an animation indicates progress when the button is pressed

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on indicator_button