A widget that displays the device's connectivity status
Features
- Widget will automatically appears when internet is not connected
- Widget will automatically disappears when internet is connected
- You can customize the properties of connectivity plus widget
- You can pass your own widget
- You can use connectivity plus widget in anywhere in application
Usage
After adding dependency add the below code in main function to enable connectivity check stream for whole app
WidgetsFlutterBinding.ensureInitialized();
ConnectivityPlusService().initConnectivityService();
Example
void main() async {
WidgetsFlutterBinding.ensureInitialized();
ConnectivityPlusService().initConnectivityService();
runApp(const MyApp());
}
Calling Widget
ConnectivityPlusWidget(
backgroundColor:Colors.red,
height:40,
marquee: false,
textStyle:const TextStyle(fontSize: 20,color: Colors.white),
),
ConnectivityPlusCustomWidget(
customWidget: const Center( child: Icon(Icons.wifi_off_outlined,color: Colors.red,size: 100,),
),
),
ConnectivityPlusWidget(
backgroundColor:Colors.orange,
height:40,
marquee: true,
textStyle:const TextStyle(fontSize: 20,color: Colors.white),
decoration: BoxDecoration(
color: Colors.orange, //new Color.fromRGBO(255, 0, 0, 0.0),
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(20.0),
topRight: const Radius.circular(20.0))
),
),
Additional information
for further contact us on flutter.hasan@gmail.com