on_connectivity_widget 1.0.2 icon indicating copy to clipboard operation
on_connectivity_widget: ^1.0.2 copied to clipboard

Flutter Package used to listen network connection and show a custom message to application.

example/lib/main.dart

/*
Author: Lucas Josino
Github: https://github.com/LucasPJS
Package: on_connectivity_widget
Homepage: https://github.com/LucasPJS/on_connectivity_widget
Copyright: © 2021, Lucas Josino. All rights reserved.
License: https://github.com/LucasPJS/on_connectivity_widget/blob/main/LICENSE
*/

import 'package:flutter/material.dart';
import 'package:on_connectivity_widget/on_connectivity_widget.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("OnConnectivityExample"),
        ),
        body: OnConnectivityWidget(
          animationDuration: Duration(seconds: 1),
          messageDuration: Duration(seconds: 2),
          position: PositionType.BOTTOM,
          showNoneUntilOnline: true,
          messageDurationWhenOnline: Duration(seconds: 2),
          animationType: Curves.bounceInOut,
          cancelInitState: false,
          wifiWidget: Container(
            height: 60,
            width: double.infinity,
            color: Colors.green,
            child: Center(child: Text("Wifi")),
          ),
          mobileWidget: Container(
            height: 60,
            width: double.infinity,
            color: Colors.blue,
            child: Center(child: Text("Mobile")),
          ),
          noneWidget: Container(
            height: 60,
            width: double.infinity,
            color: Colors.red,
            child: Center(child: Text("None")),
          ),
          //customAnimation: null,
          //customPosition: null,
        ),
      ),
    );
  }
}
8
likes
120
pub points
62%
popularity

Publisher

shield icon for verified publisherslucasjosino.com

Flutter Package used to listen network connection and show a custom message to application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

connectivity_plus, flutter, on_toast_widget

More

Packages that depend on on_connectivity_widget