AVAILABLE: 5
progress_loading_button is a free and open-source (MIT license) Flutter Material Button package that supports various button style demands. It is designed to be user-friendly and customizable.
Adding the Package
Add the following to your pubspec.yaml
file:
progress_loading_button: '^1.0.0'
Install the package from the command line:
$ flutter pub get
Now in your Dart code, you can use it. Remember to always import the library wherever you use it:
import 'package:progress_loading_button/progress_loading_button.dart';
How to Use Progress Loading Button
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');
},
);
},
)
Additional Parameters
You can customize the button using extra 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);
Supported Button Types
The following button types are supported:
enum LoadingButtonType {
Raised,
Flat,
Outline,
}