Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kauemurakami/loading-status-button
LoadingStatusButton is a Flutter package that provides an animated button with support for multiple states. It allows you to visually control the button’s status, including loading, success, and error states, with smooth and customizable animations. Ideal for interfaces that require dynamic visual feedback during asynchronous operations.
https://github.com/kauemurakami/loading-status-button
button-animation dart flutter flutter-package flutter-ui package pubdev
Last synced: about 1 month ago
JSON representation
LoadingStatusButton is a Flutter package that provides an animated button with support for multiple states. It allows you to visually control the button’s status, including loading, success, and error states, with smooth and customizable animations. Ideal for interfaces that require dynamic visual feedback during asynchronous operations.
- Host: GitHub
- URL: https://github.com/kauemurakami/loading-status-button
- Owner: kauemurakami
- License: mit
- Created: 2024-08-30T23:02:46.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2024-09-05T20:43:35.000Z (2 months ago)
- Last Synced: 2024-09-28T14:22:38.175Z (about 2 months ago)
- Topics: button-animation, dart, flutter, flutter-package, flutter-ui, package, pubdev
- Language: Dart
- Homepage: https://pub.dev/packages/loading_status_button
- Size: 1.17 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
[![Star on GitHub](https://img.shields.io/github/stars/kauemurakami/loading-status-button.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/kauemurakami/loading-status-button)
## loading_status_buttonIt's a flutter package that allows you to manage the state of the button, along with an animation, in addition to loading with animation on the button, you can provide visual feedback like `error` or `success` too, in addition to enabling and disabling it through some logic provided.
## Features
`LoadingStatusButton` is a Flutter package that provides an animated button with support for multiple states. It allows you to visually control the `status` of the button, including `loading`, `success` and `error` states, in addition to being able to leave the button enabled or not with `status` `enable` and `disable`.
With smooth and customizable animations, it is ideal for interfaces that require dynamic visual feedback during asynchronous operations.## Getting started
```
$ flutter pub add loading_status_button
```
or add in your dependencies in `pubspec.yaml`
```yaml
dependencies:
loading_status_button:
```## Usage
Short example, for a more complex example go to the `/example` folder:
```dart
import 'package:flutter/material.dart';
import 'package:loading_status_button/loading_status_button.dart';void main() {
runApp(const MyApp());
}class MyApp extends StatelessWidget {
const MyApp({super.key});@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Loading Status Button',
debugShowCheckedModeBanner: false,
theme: ThemeData(
useMaterial3: true,
),
home: MyHomePage(),
);
}
}class MyHomePage extends StatelessWidget {
MyHomePage({super.key});
final LoadingStatusButtonController controller =
LoadingStatusButtonController(initialStatus: StatusButton.enable);@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
LoadingStatusButtonWidget(
callback: () async => await fakeCallSuccess(),
controller: controller,
buttonColor: Colors.black,
loadingColor: Colors.white,
succesIconColor: Colors.green,
errorIconColor: Colors.red,
widget: const Text(
'Button Success',
style: TextStyle(color: Colors.white, fontSize: 17.0),
),
),
],
),
),
),
);
}fakeCallSuccess() async {
await controller.setStatus(StatusButton.loading);
//fake fetchData
await Future.delayed(const Duration(seconds: 5));
await controller.setStatus(StatusButton.success);
await controller.setStatus(StatusButton.enable); // or another action, example navigate to another page after success
}
}
```
If you want to remove this controller from memory, we can use the method inherited from `ChangeNotifier`, the method `dispose`
```dart
controller.dispose();
```