connectivity_alert_widget 2.0.0+2 copy "connectivity_alert_widget: ^2.0.0+2" to clipboard
connectivity_alert_widget: ^2.0.0+2 copied to clipboard

A Flutter package to handle connectivity in an elegant way, giving power to the user to display different widgets when there's or there isn't connectivity

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Example Connectivity'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ConnectivityAlertWidget(
              onlineWidget:
                  Icon(Icons.network_wifi, color: Colors.green, size: 280),
              offlineWidget:
                  Icon(Icons.signal_wifi_off, color: Colors.red, size: 280),
              onConnectivityResult: (connectivity) => print(connectivity),
            ),
          ],
        ),
      ),
    );
  }
}
13
likes
140
pub points
54%
popularity

Publisher

verified publisherrodrigobastos.dev

A Flutter package to handle connectivity in an elegant way, giving power to the user to display different widgets when there's or there isn't connectivity

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

connectivity, flutter

More

Packages that depend on connectivity_alert_widget