connection_status_bar 1.1.6 connection_status_bar: ^1.1.6 copied to clipboard
customizable flutter widget that animates when internet connection changes.
import 'package:flutter/material.dart';
import 'package:connection_status_bar/connection_status_bar.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Material(
child: Stack(
children: [
Align(
alignment: Alignment.topCenter,
child: Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Text(
'turn off device internet connection to see the widget animating',
textAlign: TextAlign.center,
),
),
),
),
Align(
alignment: Alignment.topCenter,
child: ConnectionStatusBar(),
),
],
),
);
}
}