awaitable_button 1.1.0 copy "awaitable_button: ^1.1.0" to clipboard
awaitable_button: ^1.1.0 copied to clipboard

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

Awaitable Button #

Features #

Button with indicator display during processing to prevent consecutive hits.

Web demo for awaitable_button/example #

https://altive.github.io/flutter_widgets/

Getting started #

awaitable_button: any

Usage #

import 'package:awaitable_button/awaitable_button.dart';

@override
Widget build(BuildContext context) {
    return AwaitableElevatedButton<String>(
      // Required
      onPressed: () {
        // do something
      },
      // Optional
      whenComplete: (value) {
        // do something
      },
      // Optional
      onError: (exception, stackTrace) {
        // do something
      },
      // Optional
      buttonStyle: ElevatedButton.styleFrom(),
      // Optional
      indicator: CircularProgressIndicator(),
      // Optional
      executingChild: const Text('Executing...'),
      // Required
      child: const Text('Button'),
    );
}
@override
Widget build(BuildContext context) {
    return AwaitableOutlinedButton<String>(
      // Required
      onPressed: () {
        // do something
      },
      // Optional
      whenComplete: (value) {
        // do something (Optional)
      },
      // Optional
      onError: (exception, stackTrace) {
        // do something
      },
      // Optional
      buttonStyle: OutlinedButton.styleFrom(),
      // Optional
      indicator: CircularProgressIndicator(),
      // Optional
      executingChild: const Text('Executing...'),
      // Required
      child: const Text('Button'),
    );
}
@override
Widget build(BuildContext context) {
    return AwaitableTextButton<String>(
      // Required
      onPressed: () {
        // do something
      },
      // Optional
      whenComplete: (value) {
        // do something (Optional)
      },
      // Optional
      onError: (exception, stackTrace) {
        // do something
      },
      // Optional
      buttonStyle: TextButton.styleFrom(),
      // Optional
      indicator: CircularProgressIndicator(),
      // Optional
      executingChild: const Text('Executing...'),
      // Required
      child: const Text('Button'),
    );
}
@override
Widget build(BuildContext context) {
    return AwaitableIconButton<String>(
      // Required
      onPressed: () {
        // do something
      },
      // Optional
      whenComplete: (value) {
        // do something
      },
      // Optional
      executingIcon: const Icon(Icons.timer_sharp),
      // Required
      icon: const Icon(Icons.timer),
    );
}
20
likes
0
pub points
76%
popularity

Publisher

verified publisheraltive.co.jp

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

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on awaitable_button