flml_internet_checker 0.0.4 flml_internet_checker: ^0.0.4 copied to clipboard
Internet Connectivity Checking Package. This package aims to check internet connection by just wrapping the widget with InternetChecker Widget without using any function calls inside your app
import 'package:flml_internet_checker/flml_internet_checker.dart';
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Internet Checker',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return InternetChecker(
placeHolder: Lottie.asset(
"assets/no_internet.json",
height: 250,
),
internetConnectionText: "No Internet Connection",
child: const Scaffold(
body: Center(
child: Text("You are Online"),
),
),
);
}
}