My Network Popup
A Flutter package that displays a customizable network connectivity popup across all screens when the device goes offline. Perfect for apps that require real-time network status updates.
Features
- Real-time network monitoring.
- Customizable popup design.
- Works across all screens and navigation flows.
- Lightweight and easy to integrate.
Installation
Add the following to your pubspec.yaml:
dependencies: my_network_popup: ^1.0.1+2
Usage
Wrap your MaterialApp with NetworkOverlay:
import 'package:flutter/material.dart';
import 'package:my_network_popup/my_network_popup.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return NetworkOverlay(
child: MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Network Popup Demo')),
body: const Center(child: Text('Main Content')),
),
),
);
}
}
Customization
You can customize the popup and behavior:
NetworkOverlay(
checkInterval: const Duration(seconds: 5),
checkUrl: 'https://your-custom-endpoint.com',
offlinePopup: const CustomPopup(),
onlineCallback: () {
print('Connection restored!');
},
child: MaterialApp(...),
)