Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/altive/awaitable_button
A button that displays an indicator during asynchronous processing and allows callbacks to be executed after completion or exception catch.
https://github.com/altive/awaitable_button
dart flutter
Last synced: 1 day ago
JSON representation
A button that displays an indicator during asynchronous processing and allows callbacks to be executed after completion or exception catch.
- Host: GitHub
- URL: https://github.com/altive/awaitable_button
- Owner: altive
- License: mit
- Created: 2022-03-19T22:36:30.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-02T01:12:03.000Z (3 months ago)
- Last Synced: 2024-10-27T09:04:13.040Z (17 days ago)
- Topics: dart, flutter
- Language: Dart
- Homepage: https://altive.dev
- Size: 24.2 MB
- Stars: 9
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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
```pubspec.yaml
awaitable_button: any
```## Usage
```dart
import 'package:awaitable_button/awaitable_button.dart';
```This package includes the following buttons.
Use them according to your style.- `AwaitableElevatedButton`
- `AwaitableOutlinedButton`
- `AwaitableTextButton`
- `AwaitableFilledButton`
- `AwaitableFilledTonalButton````dart
@override
Widget build(BuildContext context) {
return AwaitableElevatedButton(
// 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: const Text('Executing...'),
// Required
child: const Text('Button'),
);
}
````AwaitableOutlinedButton`, `AwaitableTextButton`, `AwaitableFilledButton` and `AwaitableFilledTonalButton` is exactly the same as for `AwaitableElevatedButton`.
```dart
@override
Widget build(BuildContext context) {
return AwaitableIconButton(
// 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: const Icon(Icons.timer_sharp),
// Required
icon: const Icon(Icons.timer),
);
}
```