progress_loading_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.
Add this to your package's pubspec.yaml file:
progress_loading_button: '^1.0.0'
You can install packages from the command line:
$ flutter pub get
Alternatively, your editor might support flutter pub get.
Now in your Dart code, you can use:
import 'package:progress_loading_button/progress_loading_button.dart';
Add LoadingButton
to your widget tree:
LoadingButton(
defaultWidget: Text('Click Me'),
width: 196,
height: 60,
onPressed: () async {
await Future.delayed(
Duration(milliseconds: 3000),
() {
print('Button Pressed');
},
);
},
)
More parameters:
LoadingButton({
Key? key,
required this.defaultWidget,
this.loadingWidget = const CircularProgressIndicator(),
required this.onPressed,
this.type = LoadingButtonType.Raised,
this.color,
this.width = double.infinity,
this.height = 40.0,
this.borderRadius = 5.0,
this.borderSide = BorderSide.none,
this.animate = true,
}) : super(key: key);
Three types supported:
enum LoadingButtonType {
Raised,
Flat,
Outline,
}
Source code and example of this library can be found in git:
$ git clone https://github.com/gairick-saha/progress_loading_button.git