on_connectivity_widget
is a Flutter Package used to listen network states and show a custom message to application.
This Plugin uses connectivity_plus as dependency to listen network states and on_toast_widget to show custom and animated messages.
Any problem? Issues
Any suggestion? Pull request
NOTE: Feel free to help with readme translations
Add the following code to your pubspec.yaml
:
dependencies:
on_connectivity_widget: ^1.1.0
- Everytime network state change, will shown a message.
- All message has a default widget, but, you can create your own.
- You can define Animation type.
- You can create/set your own Animation.
- You can define how long Animation will last.
- You can define Position type.
- You can create/set your own Position.
- You can define how long Position will last.
- Fix bugs.
- Add more default animations.
- Add more
[Features]
OnConnectivityWidget() // The main widget to start using the plugin.
All types of parameters on this plugin:
Parameters | Arguments | Description |
---|---|---|
position |
SlidePositionType? |
Used to define message position |
bluetoothWidget |
Widget? |
Widget shown when connection state is: Bluetooth. |
wifiWidget |
Widget? |
Widget shown when network state is: Wifi. |
ethernetWidget |
Widget? |
Widget shown when network state is: Ethernet. |
mobileWidget |
Widget? |
Widget shown when network state is: Mobile |
noneWidget |
Widget? |
Widget shown when network state is: Offline. |
animationDuration |
Duration? |
Used to define how long animation will last. |
messageDuration |
Duration? |
Used to define how long message will last. |
messageDurationWhenOnline |
Duration? |
Used to define how long message will after [showNoneUntilOnline]. |
animationType |
Curve? |
Used to define what animation type will be shown. |
cancelInitState |
bool? |
Used to define if message will shown when application starts. |
showNoneUntilOnline |
bool? |
Used to define if message will await until network connect. |
customAnimation |
Animation<Offset>? |
Used if you want use your own animation. |
customPosition |
Alignment? |
Used if you want use your own position. |
See more in Documentation
OnConnectivityWidget(
animationDuration: Duration(seconds: 1),
messageDuration: Duration(seconds: 2),
position: SlidePositionType.BOTTOM,
showNoneUntilOnline: true,
messageDurationWhenOnline: Duration(seconds: 2),
animationType: Curves.bounceInOut,
cancelInitState: false,
bluetoothWidget: OnMessageWidget(
title: 'You\'re online',
desc: 'Your current connection is: Bluetooth',
color: Colors.lightBlue[200]!,
icon: Icons.check_circle_outline_rounded,
),
wifiWidget: const OnMessageWidget(
title: 'You\'re online',
desc: 'Your current connection is: Wifi',
color: Colors.green,
icon: Icons.check_circle_outline_rounded,
),
ethernetWidget: OnMessageWidget(
title: 'You\'re online',
desc: 'Your current connection is: Ethernet',
color: Colors.lightGreen[200]!,
icon: Icons.check_circle_outline_rounded,
),
mobileWidget: const OnMessageWidget(
title: 'You\'re online',
desc: 'Your current connection is: Mobile',
color: Colors.blue,
icon: Icons.check_circle_outline_rounded,
),
noneWidget: const OnMessageWidget(
title: 'You\'re offline',
desc: 'Your current connection is: Offline',
color: Colors.red,
icon: Icons.error_outline_rounded,
),
//customAnimation: null,
//customPosition: null,
),;