ots 0.0.1 copy "ots: ^0.0.1" to clipboard
ots: ^0.0.1 copied to clipboard

outdated

A package for showing loading indicators, notifications, dialogs, internet connectivity updates, Over the Screen easily.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:ots/ots.dart';

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(),
//      ),
      child: CupertinoApp(
        title: 'OTS Test',
        home: Home(),
      ),
    );
  }
}

final textStyle = TextStyle(color: Colors.white);

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

class _HomeState extends State<Home> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              RaisedButton(
                color: Colors.blue,
                child: Text('Show Notification', style: textStyle),
                onPressed: () {
                  showNotification(
                    message: 'Hello, this is notification',
                    title: 'Test',
                    backgroundColor: Colors.green,
                    autoDismissible: true,
                    notificationDuration: 2500,
                  );

                },
              ),
              RaisedButton(
                color: Colors.green,
                child: Text('Show Loader', style: textStyle),
                onPressed: () async {
                  showLoader(
                    isModal: true,
                  );

                  await Future.delayed(Duration(seconds: 3));
                  hideLoader();
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
12
likes
0
pub points
74%
popularity

Publisher

unverified uploader

A package for showing loading indicators, notifications, dialogs, internet connectivity updates, Over the Screen easily.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

connectivity, flutter

More

Packages that depend on ots