Skip to content

Repository files navigation

Awaitable Button

Features

Button with indicator display during processing to prevent consecutive hits.

Web demo for awaitable_button/example

You can try out the interactive buttons on the demo page below.

https://altive.github.io/awaitable_button/

Getting started

awaitable_button: any

Usage

import'package:awaitable_button/awaitable_button.dart';

This package includes the following buttons. Use them according to your style.

  • AwaitableElevatedButton
  • AwaitableOutlinedButton
  • AwaitableTextButton
  • AwaitableFilledButton
  • AwaitableFilledTonalButton
@overrideWidgetbuild(BuildContext context) {
returnAwaitableElevatedButton<String>(
// Required
onPressed: () {
// do something
},
// Optional
whenComplete: (value) {
// do something
},
// Optional
onError: (exception, stackTrace) {
// do something
},
// Optional
buttonStyle:ElevatedButton.styleFrom(),
// Optional
indicator:CircularProgressIndicator(),
// Optional
indicatorColor:Colors.green,
// Optional
indicatorSize:Size.square(24),
// Optional
executingChild:constText('Executing...'),
// Required
child:constText('Button'),
);
}

AwaitableOutlinedButton, AwaitableTextButton, AwaitableFilledButton and AwaitableFilledTonalButton is exactly the same as for AwaitableElevatedButton.

@overrideWidgetbuild(BuildContext context) {
returnAwaitableIconButton<String>(
// Required
onPressed: () {
// do something
},
// Optional
whenComplete: (value) {
// do something
},
// Optional
onError: (exception, stackTrace) {
// do something
},
// Optional
iconSize:24,
// Optional
indicator:CircularProgressIndicator(),
// Optional
indicatorColor:Colors.green,
// Optional
indicatorSize:Size.square(24),
// Optional
executingIcon:constIcon(Icons.timer_sharp),
// Required
icon:constIcon(Icons.timer),
);
}

About

A button that displays an indicator during asynchronous processing and allows callbacks to be executed after completion or exception catch.

Topics

Resources

Code of conduct

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages