flutter progress button
flutter_progress_button is a free and open source (mit license) material flutter button that supports variety of buttons style demands. it is designed to be easy to use and customizable.
get started
depend on it
add this to your package’s pubspec.yaml file:
flutter_progress_button: '^0.6.2'
install it
you can install packages from the command line:
$ flutter pub get
alternatively, your editor might support flutter pub get.
import it
now in your dart code, you can use:
import 'package:flutter_progress_button/flutter_progress_button.dart';
how to use
add progressbutton
to your widget tree:
progressbutton(
normalwidget: const text('i am a button'),
progresswidget: const circularprogressindicator(),
width: 196,
height: 40,
onpressed: () async {
int score = await future.delayed(
const duration(milliseconds: 3000), () => 42);
// after [onpressed], it will trigger animation running backwards, from end to beginning
return () {
// optional returns is returning a function that can be called
// after the animation is stopped at the beginning.
// a best practice would be to do time-consuming task in [onpressed],
// and do page navigation in the returned function.
// so that user won't missed out the reverse animation.
};
},
),
source
source code and examples of this library can be found in git:
$ jiangyang5157/flutter_progress_button.git
Comments are closed.