network_status_dialog 0.0.2 copy "network_status_dialog: ^0.0.2" to clipboard
network_status_dialog: ^0.0.2 copied to clipboard

A Flutter package that shows an offline dialog when the user loses internet connection. Easily customizable with your own colors, text, and Lottie animation.

πŸ›‘ Network Status Dialog #

A lightweight Flutter package to automatically detect internet loss (including airplane mode) and show a customizable, non-dismissible dialog β€” ensuring users never interact with the app while offline.

Features #

  • Auto-detects no internet or airplane mode
  • Persistent dialog until connectivity is restored
  • Fully customizable: title, description, colors
  • Open Wi-Fi / Mobile Data settings directly from the dialog
  • Easy plug & play integration


Getting Started #

1. Add to pubspec.yaml #

dependencies:
  network_status_dialog: 0.0.2

2. Import and Use #

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

void main() {
  runApp(const MyApp());
}

/// Root widget of the app
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Wrap the screen (or the whole app) with NetworkStatusListener
      // This widget listens for network changes and automatically shows a dialog when offline
      home: NetworkStatusListener(
        config: NetworkDialogConfig(
          // Customize the dialog title
          title: "Oops!",
          // Message shown when offline
          description: "You're offline. Please check your internet connection.",
          // Primary color used for the button and accents
          primaryColor: Colors.red,
        ),
        child: const HomeScreen(), // Your actual app screen goes here
      ),
    );
  }
}

/// Example home screen widget
class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Network Dialog Example"),
      ),
      body: const Center(
        child: Text("You're online."),
      ),
    );
  }
}
11
likes
0
points
48
downloads

Publisher

verified publishersquarebits.com

Weekly Downloads

A Flutter package that shows an offline dialog when the user loses internet connection. Easily customizable with your own colors, text, and Lottie animation.

License

unknown (license)

Dependencies

app_settings, connectivity_plus, flutter, internet_connection_checker

More

Packages that depend on network_status_dialog