Files
Tanami_App/lib/shared/components/no_internet.dart

96 lines
3.5 KiB
Dart
Raw Permalink Normal View History

2024-06-12 12:02:46 +05:30
// ignore_for_file: file_names, sized_box_for_whitespace
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:tanami_app/core/routes/routes.dart';
import 'package:tanami_app/core/styles/app_color.dart';
import 'package:tanami_app/shared/components/toast_message.dart';
2024-06-24 19:27:15 +05:30
import 'package:tanami_app/core/styles/app_images.dart';
2024-06-12 12:02:46 +05:30
class NoInternet extends StatelessWidget {
const NoInternet({super.key});
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(false),
child: Scaffold(
2024-06-24 19:27:15 +05:30
backgroundColor: AppColor.plainWhite,
body: Column(
children: [
2024-06-12 12:49:54 +05:30
Center(
child: Container(
margin: const EdgeInsets.only(top: 100),
height: 180.h,
width: 1.sw,
child: Image.asset(AppImages.noInternetImage),
),
),
Center(
child: Padding(
padding: const EdgeInsets.only(top: 100),
child: Center(
child: Column(
children: <Widget>[
const SizedBox(
height: 15.0,
),
Container(
margin: const EdgeInsets.symmetric(horizontal: 20),
2024-06-12 12:02:46 +05:30
child: Text(
2024-06-24 19:27:15 +05:30
"Internet Connection is Down!\n\nEnsure your internet's up and running.",
textAlign: TextAlign.center,
style: GoogleFonts.dmSans(
fontSize: 18.0,
fontWeight: FontWeight.w500,
),
),
2024-06-12 12:49:54 +05:30
),
const SizedBox(
height: 30.0,
),
2024-06-18 14:58:53 +05:30
GestureDetector(
2024-06-12 12:49:54 +05:30
onTap: () async {
final connectivityResult =
await (Connectivity().checkConnectivity());
if (connectivityResult[0] ==
ConnectivityResult.wifi ||
connectivityResult[0] ==
ConnectivityResult.mobile) {
goRouter.pop();
} else {
errorToastMessage(
context, "Internet is still down");
}
},
child: Container(
height: 54.h,
width: 330.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.h),
color: AppColor.primaryColor2),
child: Center(
child: Text(
"Try Again",
style: GoogleFonts.dmSans(
2024-06-24 19:27:15 +05:30
color: AppColor.plainWhite,
fontSize: 20.sp,
),
2024-06-12 12:49:54 +05:30
),
),
2024-06-12 12:02:46 +05:30
),
),
2024-06-12 12:49:54 +05:30
],
2024-06-12 12:02:46 +05:30
),
2024-06-12 12:49:54 +05:30
),
2024-06-12 12:02:46 +05:30
),
),
2024-06-24 19:27:15 +05:30
],
),
),
2024-06-12 12:02:46 +05:30
);
}
}