You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
438 lines
20 KiB
Dart
438 lines
20 KiB
Dart
///todo deleted
|
|
// import 'dart:io';
|
|
//
|
|
// import 'package:flutter/material.dart';
|
|
// import 'package:flutter/services.dart';
|
|
// import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
// import 'package:provider/provider.dart';
|
|
// import 'package:test_sa/controllers/notification/firebase_notification_manger.dart';
|
|
// import 'package:test_sa/controllers/providers/api/user_provider.dart';
|
|
// import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
|
|
// import 'package:test_sa/extensions/context_extension.dart';
|
|
// import 'package:test_sa/new_views/pages/new_gas_refill_request_page.dart';
|
|
// import 'package:test_sa/views/app_style/sizing.dart';
|
|
// import 'package:test_sa/views/pages/device_transfer/track_device_transfer.dart';
|
|
// import 'package:test_sa/views/pages/user/gas_refill/track_gas_refill.dart';
|
|
// import 'package:test_sa/views/pages/user/ppm/ppm_page.dart';
|
|
// import 'package:test_sa/views/pages/user/requests/create_service_request_page.dart';
|
|
// import 'package:test_sa/views/widgets/dialogs/dialog.dart';
|
|
//
|
|
// import '../../../models/enums/user_types.dart';
|
|
// import '../../widgets/land_page/land_page_item.dart';
|
|
// import '../device_transfer/create__asset_transfer_request.dart';
|
|
// import 'requests/requests_page.dart';
|
|
//
|
|
// @Deprecated("Use the page which is inside the [new_views/pages/land_page] folder")
|
|
// class LandPage extends StatefulWidget {
|
|
// static const String id = "/old-land-page";
|
|
//
|
|
// const LandPage({Key? key}) : super(key: key);
|
|
//
|
|
// @override
|
|
// State<LandPage> createState() => _LandPageState();
|
|
// }
|
|
//
|
|
// class _LandPageState extends State<LandPage> {
|
|
// double _height;
|
|
// double _width;
|
|
// UserProvider _userProvider;
|
|
// SettingProvider _settingProvider;
|
|
//
|
|
// // DepartmentsProvider _departmentsProvider;
|
|
// // DevicesProvider _devicesProvider;
|
|
// double _buttonHeight;
|
|
// bool firstTime = true;
|
|
//
|
|
// // ServiceRequestsProvider _serviceRequestsProvider;
|
|
// // PreventiveMaintenanceVisitsProvider _preventiveMaintenanceVisitsProvider;
|
|
// // RegularVisitsProvider _regularVisitsProvider;
|
|
// final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
|
|
//
|
|
// @override
|
|
// void initState() {
|
|
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
|
// try {
|
|
// FirebaseNotificationManger.initialized(context);
|
|
// } catch (error) {}
|
|
// });
|
|
// super.initState();
|
|
// }
|
|
//
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// String path = ModalRoute.of(context).settings.arguments;
|
|
// _height = MediaQuery.of(context).size.height;
|
|
// _width = MediaQuery.of(context).size.width;
|
|
// _settingProvider = Provider.of<SettingProvider>(context);
|
|
// _userProvider = Provider.of<UserProvider>(context);
|
|
// // _departmentsProvider = Provider.of<DepartmentsProvider>(context);
|
|
// // _devicesProvider = Provider.of<DevicesProvider>(context);
|
|
// // _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
|
|
// // _preventiveMaintenanceVisitsProvider = Provider.of<PreventiveMaintenanceVisitsProvider>(context);
|
|
// // _regularVisitsProvider = Provider.of<RegularVisitsProvider>(context);
|
|
// //
|
|
// if (firstTime) {
|
|
// if (path != null) {
|
|
// Navigator.of(context).pushNamed("/" + path.split("/").first, arguments: path.split("/").last);
|
|
// }
|
|
// firstTime = false;
|
|
// }
|
|
// _buttonHeight = 68 * AppStyle.getScaleFactor(context);
|
|
// return WillPopScope(
|
|
// onWillPop: () async {
|
|
// bool result = await showDialog(
|
|
// context: context,
|
|
// builder: (_) => AAlertDialog(
|
|
// // title: _subtitle.exit,
|
|
// title: context.translation.exit,
|
|
// // content: _subtitle.exitAlert,
|
|
// content: context.translation.sureExit,
|
|
// ));
|
|
// if (result == true) {
|
|
// if (Platform.isAndroid) {
|
|
// SystemChannels.platform.invokeMethod('SystemNavigator.pop');
|
|
// } else {
|
|
// exit(0);
|
|
// }
|
|
// }
|
|
// return false;
|
|
// },
|
|
// child: Scaffold(
|
|
// key: _scaffoldKey, //backgroundColor: Color(0xffF8F8F8),
|
|
// body: SafeArea(
|
|
// child: Stack(
|
|
// children: [
|
|
// ListView(
|
|
// padding: const EdgeInsets.all(16.0),
|
|
// children: [
|
|
// //AppNameBar(),
|
|
// // SizedBox(
|
|
// // height: _height/3.2,
|
|
// // width: _width,
|
|
// // child: CarouselSlider.builder(
|
|
// // options: CarouselOptions(
|
|
// // height: _height/3,
|
|
// // autoPlay: true,
|
|
// // viewportFraction: 1
|
|
// // ),
|
|
// // itemCount: 4,
|
|
// // itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) =>
|
|
// // Image(
|
|
// // //width: _width,
|
|
// // image: AssetImage("assets/images/$itemIndex.png"),
|
|
// // fit: BoxFit.cover,
|
|
// // )
|
|
// // ),
|
|
// // ),
|
|
// // SizedBox(
|
|
// // height: 48 * AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // Hero(
|
|
// // tag: "logo",
|
|
// // child: Image(
|
|
// // height: _height / 6,
|
|
// // image: const AssetImage("assets/images/logo.png"),
|
|
// // ),
|
|
// // ),
|
|
// GridView.count(
|
|
// shrinkWrap: true,
|
|
// physics: const ClampingScrollPhysics(),
|
|
// crossAxisCount: 2,
|
|
// crossAxisSpacing: 12,
|
|
// mainAxisSpacing: 12,
|
|
// childAspectRatio: 1,
|
|
// children: [
|
|
// if (_userProvider.user != null && _userProvider.user.type == UsersTypes.normal_user)
|
|
// LandPageItem(
|
|
// // text: _subtitle.newServiceRequest,
|
|
// text: context.translation.newServiceRequest,
|
|
// icon: FontAwesomeIcons.screwdriverWrench,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(CreateServiceRequestPage.id);
|
|
// },
|
|
// ),
|
|
// LandPageItem(
|
|
// // text: _subtitle.trackServiceRequest,
|
|
// text: context.translation.trackServiceRequest,
|
|
// icon: FontAwesomeIcons.listCheck,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(ServiceRequestsPage.id);
|
|
// },
|
|
// ),
|
|
// //if (_userProvider.user.type == UsersTypes.engineer)
|
|
// LandPageItem(
|
|
// // text: _subtitle.preventiveMaintenance,
|
|
// text: context.translation.preventiveMaintenance,
|
|
// icon: FontAwesomeIcons.personWalking,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(PpmPage.id);
|
|
// },
|
|
// ),
|
|
// //if (_userProvider.user.type == UsersTypes.engineer)
|
|
// // LandPageItem(
|
|
// // text: _subtitle.preventiveMaintenance,
|
|
// // icon: FontAwesomeIcons.toolbox,
|
|
// // onPressed: (){
|
|
// // Navigator.of(context).pushNamed(PreventiveMaintenanceVisitsPage.id);
|
|
// // },
|
|
// // ),
|
|
// if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.engineer)
|
|
// LandPageItem(
|
|
// text: context.translation.requestGasRefill,
|
|
// icon: FontAwesomeIcons.truckFast,
|
|
// onPressed: () {
|
|
// // Navigator.of(context).pushNamed(RequestGasRefill.id);
|
|
// Navigator.of(context).pushNamed(NewGasRefillRequestPage.routeName);
|
|
// },
|
|
// ),
|
|
// LandPageItem(
|
|
// text: context.translation.trackGasRefill,
|
|
// icon: Icons.content_paste_search,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(TrackGasRefillPage.id);
|
|
// },
|
|
// ),
|
|
// LandPageItem(
|
|
// text: context.translation.deviceTransfer,
|
|
// icon: FontAwesomeIcons.rightLeft,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(RequestDeviceTransfer.id);
|
|
// },
|
|
// ),
|
|
// LandPageItem(
|
|
// text: context.translation.trackAssetTransfer,
|
|
// icon: FontAwesomeIcons.peopleCarryBox,
|
|
// onPressed: () {
|
|
// Navigator.of(context).pushNamed(TrackDeviceTransferPage.id);
|
|
// },
|
|
// ),
|
|
// // if (_userProvider?.user != null && _userProvider?.user?.type != UsersTypes.normal_user)
|
|
// // LandPageItem(
|
|
// // text: "Create Sub Work Order",
|
|
// // svgPath: "assets/images/sub_workorder_icon.svg",
|
|
// // onPressed: () {
|
|
// // Navigator.of(context).pushNamed(SearchSubWorkOrderPage.id);
|
|
// // },
|
|
// // ),
|
|
// ],
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// // Align(
|
|
// // alignment: Alignment.topLeft,
|
|
// // child: ABackButton(
|
|
// // icon: Icons.power_settings_new_rounded,
|
|
// // onPressed: () async {
|
|
// // bool result = await showDialog(
|
|
// // context: context,
|
|
// // builder: (_) => const AAlertDialog(
|
|
// // // title: _subtitle.signOut,
|
|
// // title: "Sign Out",
|
|
// // // content: _subtitle.signOutAlert,
|
|
// // content: "Are you sure you want to exit?",
|
|
// // ));
|
|
// // if (result) {
|
|
// // // _devicesProvider.reset();
|
|
// // // _departmentsProvider.reset();
|
|
// // // _serviceRequestsProvider.reset();
|
|
// // // _regularVisitsProvider.reset();
|
|
// // // _preventiveMaintenanceVisitsProvider.reset();
|
|
// // _settingProvider.resetSettings();
|
|
// // _userProvider.reset();
|
|
// // Navigator.of(context).pop();
|
|
// // }
|
|
// // },
|
|
// // ),
|
|
// // ),
|
|
// // Align(
|
|
// // alignment: Alignment.topRight,
|
|
// // child: Padding(
|
|
// // padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
// // child: AIconButton(
|
|
// // iconData: Icons.menu,
|
|
// // color: AColors.primaryColor,
|
|
// // buttonSize: 42,
|
|
// // backgroundColor: AColors.white,
|
|
// // onPressed: () {
|
|
// // _scaffoldKey.currentState.openEndDrawer();
|
|
// // },
|
|
// // ),
|
|
// // ),
|
|
// // ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// // endDrawer: Drawer(
|
|
// // backgroundColor: Colors.white,
|
|
// // child: Column(
|
|
// // children: [
|
|
// // 40.height,
|
|
// // Row(
|
|
// // mainAxisAlignment: MainAxisAlignment.end,
|
|
// // children: [
|
|
// // const Icon(Icons.clear).onPress(() => Navigator.pop(context)),
|
|
// // ],
|
|
// // ).paddingOnly(start: 4, end: 14),
|
|
// // Row(
|
|
// // children: [
|
|
// // Container(
|
|
// // height: 50 * AppStyle.getScaleFactor(context),
|
|
// // width: 50 * AppStyle.getScaleFactor(context),
|
|
// // padding: EdgeInsets.all(4),
|
|
// // decoration: BoxDecoration(border: Border.all(color: Theme.of(context).primaryColor, width: 2), shape: BoxShape.circle),
|
|
// // child: ClipOval(
|
|
// // child: ClipOval(
|
|
// // child: Icon(
|
|
// // Icons.person,
|
|
// // size: 36,
|
|
// // color: Theme.of(context).colorScheme.primary,
|
|
// // ),
|
|
// // ),
|
|
// // ),
|
|
// // ),
|
|
// // 12.width,
|
|
// // Text(
|
|
// // _userProvider.user?.userName ?? "??",
|
|
// // style: Theme.of(context).textTheme.headline6.copyWith(
|
|
// // fontWeight: FontWeight.w600,
|
|
// // ),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ).expanded
|
|
// // ],
|
|
// // ).paddingOnly(start: 14, end: 14, top: 21, bottom: 21),
|
|
// // Divider(
|
|
// // height: 1,
|
|
// // thickness: 1,
|
|
// // color: AColors.greyEF,
|
|
// // ),
|
|
// // ListView(
|
|
// // children: [
|
|
// // Row(
|
|
// // children: [
|
|
// // Radio(
|
|
// // value: "en",
|
|
// // activeColor: AColors.grey3A,
|
|
// // focusColor: AColors.grey3A,
|
|
// // groupValue: _settingProvider.language,
|
|
// // onChanged: (value) {
|
|
// // _settingProvider.setLanguage(value);
|
|
// // }),
|
|
// // Text(
|
|
// // "English",
|
|
// // style: Theme.of(context).textTheme.bodyText1.copyWith(color: AColors.grey3A),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // Radio(
|
|
// // value: "ar",
|
|
// // activeColor: AColors.grey3A,
|
|
// // focusColor: AColors.grey3A,
|
|
// // groupValue: _settingProvider.language,
|
|
// // onChanged: (value) {
|
|
// // _settingProvider.setLanguage(value);
|
|
// // }),
|
|
// // Text(
|
|
// // "عربي",
|
|
// // style: Theme.of(context).textTheme.bodyText1.copyWith(color: AColors.grey3A),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // ],
|
|
// // ),
|
|
// // Row(
|
|
// // children: [
|
|
// // Radio(
|
|
// // value: true,
|
|
// // activeColor: AColors.grey3A,
|
|
// // focusColor: AColors.grey3A,
|
|
// // groupValue: _settingProvider.language,
|
|
// // onChanged: (value) {
|
|
// // _settingProvider.setDarkTheme(value);
|
|
// // }),
|
|
// // Text(
|
|
// // "Dark",
|
|
// // style: Theme.of(context).textTheme.bodyText1.copyWith(color: AColors.grey3A),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // Radio(
|
|
// // value: false,
|
|
// // activeColor: AColors.grey3A,
|
|
// // focusColor: AColors.grey3A,
|
|
// // groupValue: _settingProvider.language,
|
|
// // onChanged: (value) {
|
|
// // _settingProvider.setDarkTheme(value);
|
|
// // }),
|
|
// // Text(
|
|
// // "Light",
|
|
// // style: Theme.of(context).textTheme.bodyText1.copyWith(color: AColors.grey3A),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // ],
|
|
// // ),
|
|
// // // DrawerItem(
|
|
// // // icon: Icons.notifications,
|
|
// // // title: _subtitle.notifications,
|
|
// // // onPressed: () {
|
|
// // // Navigator.of(context).pushNamed(NotificationsPage.id);
|
|
// // // },
|
|
// // // ),
|
|
// // DrawerItem(
|
|
// // icon: Icons.mail,
|
|
// // // title: _subtitle.email,
|
|
// // title: "Email",
|
|
// // onPressed: () {
|
|
// // launch("mailto:customerservice@Test SA.com");
|
|
// // },
|
|
// // ),
|
|
// // // DrawerItem(
|
|
// // // icon: Icons.phone_in_talk,
|
|
// // // title: "${_subtitle.hotLine} 15564",
|
|
// // // onPressed: () {
|
|
// // // launch("tel:15564");
|
|
// // // },
|
|
// // // ),
|
|
// // // DrawerItem(
|
|
// // // icon: FontAwesomeIcons.linkedinIn,
|
|
// // // title: _subtitle.linkedIn,
|
|
// // // onPressed: () {
|
|
// // // launch("https://www.linkedin.com/company/Test SA/");
|
|
// // // },
|
|
// // // ),
|
|
// // // DrawerItem(
|
|
// // // icon: FontAwesomeIcons.globe,
|
|
// // // title: _subtitle.ourWebsite,
|
|
// // // onPressed: () {
|
|
// // // launch("https://www.Test SA.com/");
|
|
// // // },
|
|
// // // ),
|
|
// // DrawerItem(
|
|
// // icon: Icons.share,
|
|
// // // title: _subtitle.shareApp,
|
|
// // title: "Share App",
|
|
// // onPressed: () async {
|
|
// // PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
|
// // String shareLink = "\n https://play.google.com/store/apps/details?id=" + packageInfo.packageName + "\n https://apps.apple.com/us/app/";
|
|
// // Share.share(shareLink);
|
|
// // },
|
|
// // ),
|
|
// // ],
|
|
// // ).expanded,
|
|
// // Divider(height: 1, thickness: 1, color: AColors.greyEF),
|
|
// // Row(
|
|
// // mainAxisAlignment: MainAxisAlignment.center,
|
|
// // children: [
|
|
// // Text(
|
|
// // "Powered By Cloud Solutions",
|
|
// // style: Theme.of(context).textTheme.headline6.copyWith(fontWeight: FontWeight.w500, color: AColors.grey3A, fontSize: 12),
|
|
// // textScaleFactor: AppStyle.getScaleFactor(context),
|
|
// // ),
|
|
// // 6.width,
|
|
// // Image.asset("assets/images/cloud_logo.png", width: 32, height: 32)
|
|
// // ],
|
|
// // ).paddingOnly(start: 20, end: 20, top: 8, bottom: 8),
|
|
// // ],
|
|
// // ),
|
|
// // ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|