alexandradeas / ots

A widget that can show loaders, notifications, internet connectivity changes as Overlay.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ots

All Contributors

An widget that can show loaders, notifications, internet connectivity changes as Overlay.

Example

Demo

Internet connectivity changes Loader Notification

Installation

dependencies:
  flutter:
    sdk: flutter
  ...

  ots:
    git:
      url: git://github.com/fayaz07/ots.git

How to use

void main() => runApp(
      MyApp(),
    );

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return OTS(
      showNetworkUpdates: true,
      persistNoInternetNotification: false,

      /// pass your custom loader here
      loader: CircularProgressIndicator(
        valueColor: AlwaysStoppedAnimation<Color>(Colors.red),
      ),

      child: MaterialApp(
      title: 'OTS Test',
        home: Home(),
      ),
    );
  }
}

By default, loader is set to CircularProgressIndicator for Android and CupertinoActivityIndicator for iOS.

Showing and hiding a loader

showLoader(
  isModal: true,
);
/// Your network operation
hideLoader();

Note: isModal stops user from interacting with the screen

Showing and hiding a notification

showNotification(
  title: 'Test',
  message: 'Hello, this is notification',
  backgroundColor: Colors.green,
  autoDismissible: true,
  notificationDuration: 2500,
);

// use only if `autoDismissible: false`
hideNotification();

Note: Notifications are automatically dismissed after the specified duration if autoDismissible is set to true.

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Mohammad Fayaz

πŸ’» πŸ–‹ πŸ“– πŸ’‘ πŸ€” 🚧

Alex Deas

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!

About

A widget that can show loaders, notifications, internet connectivity changes as Overlay.

License:Apache License 2.0


Languages

Language:Dart 98.0%Language:Swift 1.5%Language:Kotlin 0.4%Language:Objective-C 0.1%