icon loading button
IconLoadingButton is a Flutter package heavily inspired by rounded_loading_button
with design changes and inclusion of icons.
https://pub.dev/packages/rounded_loading_button
Light mode | Dark mode |
---|---|
Installation
Add this to your pubspec.yaml:
dependencies:
icon_loading_button: ^1.0.0
Usage
Import
import 'package:rounded_loading_button/rounded_loading_button.dart';
Simple Implementation
final IconButtonController _btnController1 = IconButtonController();
final IconButtonController _btnController2 = IconButtonController();
void buttonPressed() async {
Future.delayed(const Duration(seconds: 1), () {
_btnController2.error();
Future.delayed(const Duration(seconds: 1), () {
_btnController2.reset();
});
});
}
IconLoadingButton(
color: const Color(0xff0066ff),
iconColor: Colors.white,
valueColor: const Color(0xff0066ff),
errorColor: const Color(0xffe0333c),
successColor: const Color(0xff58B09C),
child: Text(
'Login with Google',
style: GoogleFonts.openSans().copyWith(
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
iconData: PhosphorIcons.googleLogo,
onPressed: () {
buttonPressed();
},
successIcon: PhosphorIcons.check,
controller: _btnController2,
),
Properties of IconLoadingButton:
duration
- The duration of the button animationloaderSize
- The size of the CircularProgressIndicatoranimateOnTap
- Whether to trigger the loading animation on the tap eventresetAfterDuration
- Reset the animation after specified duration, defaults to 15 secondserrorColor
- The color of the button when it is in the error statesuccessColor
- The color of the button when it is in the success statesuccessIcon
- The icon for the success statefailedIcon
- The icon for the failed stateiconColor
- The icon color for the button
Contributions
All contributions are welcome!