2022-12-05 08:06:45 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2023-10-06 12:19:06 +00:00
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
|
|
import 'package:unit2/bloc/offline/offline_bloc/offline_bloc.dart';
|
2023-10-06 04:43:37 +00:00
|
|
|
import 'package:unit2/model/offline/offlane_modules.dart';
|
|
|
|
import 'package:unit2/screens/offline/homepage/drawer.dart';
|
|
|
|
import 'package:unit2/screens/offline/homepage/menu_screen.dart';
|
|
|
|
import 'package:unit2/screens/unit2/homepage.dart/components/drawer-screen.dart';
|
2023-10-06 12:19:06 +00:00
|
|
|
import 'package:unit2/screens/unit2/homepage.dart/components/menu_tile.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import 'package:unit2/theme-data.dart/colors.dart';
|
|
|
|
import 'package:fluttericon/web_symbols_icons.dart';
|
|
|
|
import 'package:fluttericon/font_awesome5_icons.dart';
|
2023-10-06 04:43:37 +00:00
|
|
|
import 'package:unit2/utils/global_context.dart';
|
2023-01-23 03:02:59 +00:00
|
|
|
import '../../../../model/login_data/user_info/user_data.dart';
|
2022-12-05 08:06:45 +00:00
|
|
|
import '../../../../utils/global.dart';
|
|
|
|
|
|
|
|
class MenuScreen extends StatefulWidget {
|
2023-01-23 03:02:59 +00:00
|
|
|
final UserData? userData;
|
|
|
|
const MenuScreen({Key? key, required this.userData}) : super(key: key);
|
2022-12-05 08:06:45 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
State<MenuScreen> createState() => _MenuScreenState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MenuScreenState extends State<MenuScreen> {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-02-08 08:06:27 +00:00
|
|
|
return Drawer(
|
2023-06-06 06:54:51 +00:00
|
|
|
child: SizedBox(
|
|
|
|
height: screenHeight,
|
|
|
|
child: Column(
|
|
|
|
mainAxisSize: MainAxisSize.max,
|
|
|
|
children: [
|
2023-06-21 00:22:43 +00:00
|
|
|
Column(
|
|
|
|
children: <Widget>[
|
|
|
|
UserAccountsDrawerHeader(
|
2023-10-06 04:43:37 +00:00
|
|
|
currentAccountPictureSize: const Size.square(90),
|
2023-06-21 00:22:43 +00:00
|
|
|
decoration: const BoxDecoration(
|
|
|
|
color: primary,
|
|
|
|
image: DecorationImage(
|
|
|
|
image: AssetImage('assets/pngs/bg.png'),
|
|
|
|
fit: BoxFit.cover)),
|
2023-10-06 04:43:37 +00:00
|
|
|
accountName: null,
|
2023-06-21 00:22:43 +00:00
|
|
|
accountEmail: null,
|
|
|
|
currentAccountPicture: CircleAvatar(
|
2023-10-06 04:43:37 +00:00
|
|
|
radius: 100,
|
2023-06-21 00:22:43 +00:00
|
|
|
backgroundColor: fifth,
|
|
|
|
child: CircleAvatar(
|
2023-10-06 04:43:37 +00:00
|
|
|
radius: 100,
|
|
|
|
backgroundColor: third,
|
|
|
|
child: Image.asset(
|
|
|
|
'assets/pngs/capitol.png',
|
|
|
|
)),
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
2023-06-21 00:22:43 +00:00
|
|
|
),
|
|
|
|
getTile(FontAwesome5.user, "Basic Info", '/basic-info', context,
|
|
|
|
widget.userData!),
|
|
|
|
const Divider(),
|
2023-10-06 04:43:37 +00:00
|
|
|
getTile(FontAwesome5.user_circle, "Profile", '/profile',
|
2023-06-21 00:22:43 +00:00
|
|
|
context, widget.userData!),
|
2023-10-06 04:43:37 +00:00
|
|
|
const Divider(),
|
|
|
|
getTile(FontAwesome5.life_ring, "Request SOS", '/sos', context,
|
|
|
|
widget.userData!),
|
|
|
|
const Divider(),
|
|
|
|
SizedBox(
|
|
|
|
child: globalOfflineAvailable == true
|
|
|
|
? ListTile(
|
|
|
|
dense: true,
|
|
|
|
leading: const Icon(
|
|
|
|
Icons.exit_to_app,
|
|
|
|
color: primary,
|
|
|
|
),
|
|
|
|
title: const Text(
|
|
|
|
"Offline Mode",
|
2023-10-06 12:19:06 +00:00
|
|
|
style: TextStyle(color: Colors.black),
|
2023-10-06 04:43:37 +00:00
|
|
|
),
|
|
|
|
onTap: () async {
|
2023-10-06 12:19:06 +00:00
|
|
|
Navigator.pushReplacement(
|
|
|
|
NavigationService
|
|
|
|
.navigatorKey.currentState!.context,
|
2023-10-06 04:43:37 +00:00
|
|
|
MaterialPageRoute(builder: ((context) {
|
2023-10-06 12:19:06 +00:00
|
|
|
return BlocProvider(
|
|
|
|
create: (context) =>
|
|
|
|
OfflineBloc()..add(SwitchOffline()),
|
|
|
|
child: const OfflineDrawerScreen(),
|
|
|
|
);
|
2023-10-06 04:43:37 +00:00
|
|
|
})));
|
2023-10-06 12:19:06 +00:00
|
|
|
;
|
2023-10-06 04:43:37 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
: Container())
|
2023-06-21 00:22:43 +00:00
|
|
|
],
|
2023-06-06 06:54:51 +00:00
|
|
|
),
|
2023-10-06 04:43:37 +00:00
|
|
|
const Expanded(child: SizedBox()),
|
|
|
|
const Divider(),
|
|
|
|
Align(
|
|
|
|
alignment: FractionalOffset.bottomLeft,
|
|
|
|
child: getTile(
|
|
|
|
WebSymbols.logout, "Logout", '/', context, widget.userData!),
|
|
|
|
),
|
|
|
|
const SizedBox(
|
|
|
|
height: 10,
|
|
|
|
),
|
2023-06-06 06:54:51 +00:00
|
|
|
],
|
2022-12-05 08:06:45 +00:00
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|