Skip to content

A Flutter package to display loading indicators, error messages, and progress bars.

License

Notifications You must be signed in to change notification settings

mbfakourii/waiter

Repository files navigation

logo

Waiter

pub package
A Flutter package to display loading indicators, error messages, and progress bars.

Features

  • Show loading
  • Show error
  • Show progress
  • Manage retries
  • Support sheets
  • Support dialogs
  • Support Material 1,2,3

Example App

Usage

Quick simple usage example:

WaiterController waiterController = WaiterController();

...

Waiter(
    callback: waiterController,
    onTry: (value) {
      print("onTry");
      
      if(value == "errorTag"){
        print("errorTag");    
      }
    },
    firstLoadShowLoading: false,
    child: Scaffold(
      ...
    ),
);

...
    
waiterController.showLoading();
waiterController.showError("errorTag");

Progress

If you need progress, you can use the following code

WaiterController waiterController = WaiterController();

ValueNotifier<double> progress = ValueNotifier<double>(0);
ValueNotifier<int> currentNumberProgress = ValueNotifier<int>(0);
ValueNotifier<int> totalNumberProgress = ValueNotifier<int>(0);

...

Waiter(
  callback: waiterController,
  onTry: (value) {
    print("onTry");
  },
  firstLoadShowLoading: true,
  progress: progress,
  currentNumberProgress: currentNumberProgress,
  totalNumberProgress: totalNumberProgress,
  onCancelProgress: (value) {
    print("onCancelProgress");
  },
  onDismissProgress: () {
    print("onDismissProgress");
  },
  child: Scaffold(
    ...
  ),
);

...

waiterController.showProgress("progressTag");

totalNumberProgress.value = 1;
currentNumberProgress.value = 1;
progress.value = 50.0;

Multi Language

There is a possibility of customization for different languages in this package

WaiterLanguage language = WaiterLanguage.copy(
    confirm: S.current.confirm,
    pleaseWait: S.current.pleaseWait,
    cancel: S.current.cancel,
    tryAgain: S.current.tryAgain);
    
Waiter(
  ...
  language: language,
  ...
);   

S For intl Package

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing plugin code, view the documentation.

About

A Flutter package to display loading indicators, error messages, and progress bars.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published