-
Notifications
You must be signed in to change notification settings - Fork 34
/
menu_screen.dart
73 lines (69 loc) · 2.25 KB
/
menu_screen.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import 'package:connectivity_wrapper/connectivity_wrapper.dart';
import 'package:connectivity_wrapper_example/screens/scaffold_example_screen.dart';
import 'package:connectivity_wrapper_example/utils/strings.dart';
import 'package:connectivity_wrapper_example/utils/utils.dart';
import 'package:flutter/material.dart';
import 'custom_offline_widget_screen.dart';
import 'network_aware_widget_screen.dart';
class MenuScreen extends StatelessWidget {
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
MenuScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
title: const Text("Connectivity Wrapper Example"),
),
body: ConnectivityScreenWrapper(
disableInteraction: false,
disableWidget: Container(
color: Colors.red.withOpacity(0.3),
),
child: ListView(
children: <Widget>[
ListTile(
title: const Text(Strings.example1),
onTap: () async {
AppRoutes.push(context, const ScaffoldExampleScreen());
},
),
const Divider(),
ListTile(
title: const Text(Strings.example2),
onTap: () {
AppRoutes.push(context, const CustomOfflineWidgetScreen());
},
),
const Divider(),
ListTile(
title: const Text(Strings.example3),
onTap: () {
AppRoutes.push(context, const NetworkAwareWidgetScreen());
},
),
const Divider(),
ListTile(
title: const Text(Strings.example4),
onTap: () async {
if (await ConnectivityWrapper.instance.isConnected) {
showSnackBar(
context,
title: "You Are Connected",
color: Colors.green,
);
} else {
showSnackBar(
context,
title: "You Are Not Connected",
);
}
},
),
const Divider(),
],
),
),
);
}
}