katana_indicator 2.4.0 copy "katana_indicator: ^2.4.0" to clipboard
katana_indicator: ^2.4.0 copied to clipboard

A package to make it easier to use Flutter's indicators (especially when waiting for processing in Future).

Masamune logo

Katana Indicator

Follow on Twitter Follow on Threads Maintained with Melos

GitHub Sponsor


[GitHub] | [YouTube] | [Packages] | [Twitter] | [Threads] | [LinkedIn] | [mathru.net]


Introduction #

When developing applications, it is often necessary to write processes that take some time, such as saving data or logging in on a button onPressed.

Basically, you would have the user wait with an indicator until the process is complete, and then display a dialog or return to the screen when it is complete.

I have created a package that makes it easy to describe the process for this purpose.

Assume that all processes to be executed wait on Future.

It can be easily written as follows

final future = repository.save(); // Some kind of storage process (return Future<dynamic>)
await future.showIndicator(context); // Displays an indicator and does not allow the user to operate until the process is completed
// Show Dialog
copied to clipboard

katana_model allows all CRUD operations to wait in Future, so the saving process can be written in a concise manner.

IconButton(
  icon: Icon(Icons.check),
  onPressed: () async {
    final doc = collection.create();
    await doc.save({
      "first": "masaru",
      "last": "hirose",
      "type": "kanimiso",
    }).showIndicator(context);
    context.router.pop();
  }
);
copied to clipboard

Installation #

Import the following packages

flutter pub add katana_indicator
copied to clipboard

How to use #

Basically, you just use the extension methods provided by Future.

final doc = collection.create();
await doc.save({
  "first": "masaru",
  "last": "hirose",
  "type": "kanimiso",
}).showIndicator(context);
context.router.pop();
copied to clipboard

The indicator CircularProgressIndicator is used by default.

If you wish to change this, use the indicator parameter of showIndicator.

await doc.save({
  "first": "masaru",
  "last": "hirose",
  "type": "kanimiso",
}).showIndicator(context, indicator: Center(child: LinearProgressIndicator()));
copied to clipboard

GitHub Sponsors #

Sponsors are always welcome. Thank you for your support!

https://github.com/sponsors/mathrunet

4
likes
160
points
5.52k
downloads

Publisher

verified publishermathru.net

Weekly Downloads

2024.09.14 - 2025.03.29

A package to make it easier to use Flutter's indicators (especially when waiting for processing in Future).

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, katana

More

Packages that depend on katana_indicator