load_in_button 0.0.2 load_in_button: ^0.0.2 copied to clipboard
A button with a load inside.
load_in_button #
A button with a loading icon inside.
Getting Started #
Just create the button on your code as the same way you would with a FlatButton.
LoadInButton(
key: _buttonKey,
onPressed: _buttonPressed,
child: Text('CONFIRMAR PEDIDO'),
color: Colors.red,
textColor: Colors.white
)
Control the loading #
bool variable
LoadInButton
contains a isLoading
property which controls if the button is loading or not. Just set it's value on the widget build.
LoadInButton(
key: _buttonKey,
isLoading: _isButtonLoading,
onPressed: _buttonPressed,
child: Text('CONFIRMAR PEDIDO'),
color: Colors.red,
textColor: Colors.white
)
Acessing the state
It's also possible to use the GlobalKey
to retrieve the start and use the helper methods
//Start the loading
_buttonKey.currentState?.start();
//Do something
//Finish the loading
_buttonKey.currentState?.finish();