Revert the project to the previous structure with applying null safety

merge-requests/4/head
zaid_daoud 3 years ago
parent d9d26a0fe0
commit c1a3eedbf6

@ -6,10 +6,10 @@ PODS:
- Firebase/Messaging (10.3.0): - Firebase/Messaging (10.3.0):
- Firebase/CoreOnly - Firebase/CoreOnly
- FirebaseMessaging (~> 10.3.0) - FirebaseMessaging (~> 10.3.0)
- firebase_core (2.4.1): - firebase_core (2.6.1):
- Firebase/CoreOnly (= 10.3.0) - Firebase/CoreOnly (= 10.3.0)
- Flutter - Flutter
- firebase_messaging (14.2.1): - firebase_messaging (14.2.4):
- Firebase/Messaging (= 10.3.0) - Firebase/Messaging (= 10.3.0)
- firebase_core - firebase_core
- Flutter - Flutter
@ -79,8 +79,9 @@ PODS:
- nanopb/encode (2.30909.0) - nanopb/encode (2.30909.0)
- package_info (0.0.1): - package_info (0.0.1):
- Flutter - Flutter
- path_provider_ios (0.0.1): - path_provider_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS
- permission_handler_apple (9.0.4): - permission_handler_apple (9.0.4):
- Flutter - Flutter
- PromisesObjC (2.1.1) - PromisesObjC (2.1.1)
@ -89,8 +90,9 @@ PODS:
- MTBBarcodeScanner - MTBBarcodeScanner
- share (0.0.1): - share (0.0.1):
- Flutter - Flutter
- shared_preferences_ios (0.0.1): - shared_preferences_foundation (0.0.1):
- Flutter - Flutter
- FlutterMacOS
- speech_to_text (0.0.1): - speech_to_text (0.0.1):
- Flutter - Flutter
- Try - Try
@ -113,11 +115,11 @@ DEPENDENCIES:
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`) - package_info (from `.symlinks/plugins/package_info/ios`)
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`) - qr_code_scanner (from `.symlinks/plugins/qr_code_scanner/ios`)
- share (from `.symlinks/plugins/share/ios`) - share (from `.symlinks/plugins/share/ios`)
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/ios`)
- speech_to_text (from `.symlinks/plugins/speech_to_text/ios`) - speech_to_text (from `.symlinks/plugins/speech_to_text/ios`)
- sqflite (from `.symlinks/plugins/sqflite/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
@ -160,16 +162,16 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker_ios/ios" :path: ".symlinks/plugins/image_picker_ios/ios"
package_info: package_info:
:path: ".symlinks/plugins/package_info/ios" :path: ".symlinks/plugins/package_info/ios"
path_provider_ios: path_provider_foundation:
:path: ".symlinks/plugins/path_provider_ios/ios" :path: ".symlinks/plugins/path_provider_foundation/ios"
permission_handler_apple: permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios" :path: ".symlinks/plugins/permission_handler_apple/ios"
qr_code_scanner: qr_code_scanner:
:path: ".symlinks/plugins/qr_code_scanner/ios" :path: ".symlinks/plugins/qr_code_scanner/ios"
share: share:
:path: ".symlinks/plugins/share/ios" :path: ".symlinks/plugins/share/ios"
shared_preferences_ios: shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_ios/ios" :path: ".symlinks/plugins/shared_preferences_foundation/ios"
speech_to_text: speech_to_text:
:path: ".symlinks/plugins/speech_to_text/ios" :path: ".symlinks/plugins/speech_to_text/ios"
sqflite: sqflite:
@ -180,8 +182,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS: SPEC CHECKSUMS:
audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40 audioplayers_darwin: 877d9a4d06331c5c374595e46e16453ac7eafa40
Firebase: f92fc551ead69c94168d36c2b26188263860acd9 Firebase: f92fc551ead69c94168d36c2b26188263860acd9
firebase_core: bf59c32d2e53814f558efa20840c1902fa2fe461 firebase_core: 6242f038aefa4582e028536e71312f7e3a41e6bb
firebase_messaging: ee597229fc260f8fa491fa8f2d4a32dfbfa406fa firebase_messaging: ee61b8065c395a117864224e3031729e656232af
FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a FirebaseCore: 988754646ab3bd4bdcb740f1bfe26b9f6c0d5f2a
FirebaseCoreInternal: 29b76f784d607df8b2a1259d73c3f04f1210137b FirebaseCoreInternal: 29b76f784d607df8b2a1259d73c3f04f1210137b
FirebaseInstallations: e2f26126089dcf41e215f7b8925af8d953c7d602 FirebaseInstallations: e2f26126089dcf41e215f7b8925af8d953c7d602
@ -199,18 +201,18 @@ SPEC CHECKSUMS:
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431 nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02 path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce permission_handler_apple: 44366e37eaf29454a1e7b1b7d736c2cceaeb17ce
PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb PromisesObjC: ab77feca74fa2823e7af4249b8326368e61014cb
qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e qr_code_scanner: bb67d64904c3b9658ada8c402e8b4d406d5d796e
share: 0b2c3e82132f5888bccca3351c504d0003b3b410 share: 0b2c3e82132f5888bccca3351c504d0003b3b410
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad shared_preferences_foundation: 297b3ebca31b34ec92be11acd7fb0ba932c822ca
speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe speech_to_text: b43a7d99aef037bd758ed8e45d79bbac035d2dfe
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 Toast: 91b396c56ee72a5790816f40d3a94dd357abc196
Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96 Try: 5ef669ae832617b3cee58cb2c6f99fb767a4ff96
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de url_launcher_ios: fb12c43172927bb5cf75aeebd073f883801f1993
PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
COCOAPODS: 1.10.2 COCOAPODS: 1.11.3

@ -146,7 +146,7 @@ class MyApp extends StatelessWidget {
routes: { routes: {
SplashScreen.id: (_) => const SplashScreen(), SplashScreen.id: (_) => const SplashScreen(),
LandPage.id: (_) => const LandPage(), LandPage.id: (_) => const LandPage(),
Login.id: (_) => Login(), Login.id: (_) => const Login(),
Register.id: (_) => Register(), Register.id: (_) => Register(),
ProfilePage.id: (_) => ProfilePage(), ProfilePage.id: (_) => ProfilePage(),
ReportIssuesPage.id: (_) => const ReportIssuesPage(), ReportIssuesPage.id: (_) => const ReportIssuesPage(),

@ -83,11 +83,11 @@ class _LoginState extends State<Login> {
initialValue: _user.userName ?? "", initialValue: _user.userName ?? "",
hintText: subtitle?.name ?? "", hintText: subtitle?.name ?? "",
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: Theme.of(context).textTheme.bodyText1, style: Theme.of(context).textTheme.bodyLarge,
prefixIconData: Icons.account_circle, prefixIconData: Icons.account_circle,
validator: (value) => Validator.hasValue(value!) validator: (value) => Validator.hasValue(value ?? '')
? '' ? null
: subtitle?.nameValidateMessage ?? "", : subtitle?.nameValidateMessage,
textInputType: TextInputType.name, textInputType: TextInputType.name,
onSaved: (value) { onSaved: (value) {
_user.userName = value!; _user.userName = value!;
@ -102,9 +102,9 @@ class _LoginState extends State<Login> {
prefixIconData: Icons.vpn_key_sharp, prefixIconData: Icons.vpn_key_sharp,
textAlign: TextAlign.left, textAlign: TextAlign.left,
validator: (value) => validator: (value) =>
Validator.isValidPassword(value!) Validator.isValidPassword(value ?? '')
? '' ? null
: subtitle?.passwordValidateMessage ?? "", : subtitle?.passwordValidateMessage,
showPassword: () { showPassword: () {
_obscurePassword = !_obscurePassword; _obscurePassword = !_obscurePassword;
setState(() {}); setState(() {});
@ -119,8 +119,9 @@ class _LoginState extends State<Login> {
AButton( AButton(
text: subtitle?.signIn ?? "", text: subtitle?.signIn ?? "",
onPressed: () async { onPressed: () async {
if (!(_formKey.currentState?.validate() ?? false)) if (!(_formKey.currentState?.validate() ?? true)) {
return; return;
}
_formKey.currentState?.save(); _formKey.currentState?.save();
int? status = await _userProvider?.login( int? status = await _userProvider?.login(
user: _user, user: _user,
@ -135,7 +136,8 @@ class _LoginState extends State<Login> {
Navigator.of(context).pushNamed(LandPage.id); Navigator.of(context).pushNamed(LandPage.id);
} else { } else {
Fluttertoast.showToast( Fluttertoast.showToast(
msg: subtitle?.activationAlert ?? ""); msg: subtitle?.activationAlert ?? "",
);
} }
} else { } else {
String errorMessage = status == 400 String errorMessage = status == 400

@ -1,6 +1,5 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -73,7 +72,7 @@ class _LandPageState extends State<LandPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String path = ModalRoute.of(context)!.settings.arguments.toString(); String? path = ModalRoute.of(context)?.settings.arguments.toString();
_height = MediaQuery.of(context).size.height; _height = MediaQuery.of(context).size.height;
_width = MediaQuery.of(context).size.width; _width = MediaQuery.of(context).size.width;
_settingProvider = Provider.of<SettingProvider>(context); _settingProvider = Provider.of<SettingProvider>(context);
@ -81,12 +80,14 @@ class _LandPageState extends State<LandPage> {
_departmentsProvider = Provider.of<DepartmentsProvider>(context); _departmentsProvider = Provider.of<DepartmentsProvider>(context);
_devicesProvider = Provider.of<DevicesProvider>(context); _devicesProvider = Provider.of<DevicesProvider>(context);
_serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context); _serviceRequestsProvider = Provider.of<ServiceRequestsProvider>(context);
_preventiveMaintenanceVisitsProvider = Provider.of<PreventiveMaintenanceVisitsProvider>(context); _preventiveMaintenanceVisitsProvider =
Provider.of<PreventiveMaintenanceVisitsProvider>(context);
_regularVisitsProvider = Provider.of<RegularVisitsProvider>(context); _regularVisitsProvider = Provider.of<RegularVisitsProvider>(context);
Subtitle _subtitle = AppLocalization.of(context)!.subtitle!; Subtitle _subtitle = AppLocalization.of(context)!.subtitle!;
if (firstTime) { if (firstTime) {
if (path != null) { if (path != null) {
Navigator.of(context).pushNamed("/" + path.split("/").first, arguments: path.split("/").last); Navigator.of(context).pushNamed("/" + path.split("/").first,
arguments: path.split("/").last);
} }
firstTime = false; firstTime = false;
} }
@ -158,14 +159,16 @@ class _LandPageState extends State<LandPage> {
text: _subtitle.newServiceRequest, text: _subtitle.newServiceRequest,
icon: FontAwesomeIcons.tools, icon: FontAwesomeIcons.tools,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(CreateRequestPage.id); Navigator.of(context)
.pushNamed(CreateRequestPage.id);
}, },
), ),
LandPageItem( LandPageItem(
text: _subtitle.trackServiceRequest, text: _subtitle.trackServiceRequest,
icon: FontAwesomeIcons.tasks, icon: FontAwesomeIcons.tasks,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(ServiceRequestsPage.id); Navigator.of(context)
.pushNamed(ServiceRequestsPage.id);
}, },
), ),
//if (_userProvider.user.type == UsersTypes.engineer) //if (_userProvider.user.type == UsersTypes.engineer)
@ -189,28 +192,32 @@ class _LandPageState extends State<LandPage> {
text: "Request Gas Refill", text: "Request Gas Refill",
icon: FontAwesomeIcons.truckFast, icon: FontAwesomeIcons.truckFast,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(RequestGasRefill.id); Navigator.of(context)
.pushNamed(RequestGasRefill.id);
}, },
), ),
LandPageItem( LandPageItem(
text: "Track Gas Refill", text: "Track Gas Refill",
icon: Icons.content_paste_search, icon: Icons.content_paste_search,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(TrackGasRefillPage.id); Navigator.of(context)
.pushNamed(TrackGasRefillPage.id);
}, },
), ),
LandPageItem( LandPageItem(
text: "transfer Device", text: "transfer Device",
icon: FontAwesomeIcons.rightLeft, icon: FontAwesomeIcons.rightLeft,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(RequestDeviceTransfer.id); Navigator.of(context)
.pushNamed(RequestDeviceTransfer.id);
}, },
), ),
LandPageItem( LandPageItem(
text: "Track Device Transfer", text: "Track Device Transfer",
icon: FontAwesomeIcons.peopleCarryBox, icon: FontAwesomeIcons.peopleCarryBox,
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed(TrackDeviceTransferPage.id); Navigator.of(context)
.pushNamed(TrackDeviceTransferPage.id);
}, },
), ),
], ],
@ -243,7 +250,8 @@ class _LandPageState extends State<LandPage> {
Align( Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), padding:
const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
child: AIconButton( child: AIconButton(
iconData: Icons.menu, iconData: Icons.menu,
color: AColors.primaryColor, color: AColors.primaryColor,
@ -275,10 +283,17 @@ class _LandPageState extends State<LandPage> {
height: 50 * AppStyle.getScaleFactor(context), height: 50 * AppStyle.getScaleFactor(context),
width: 50 * AppStyle.getScaleFactor(context), width: 50 * AppStyle.getScaleFactor(context),
padding: EdgeInsets.all(4), padding: EdgeInsets.all(4),
decoration: BoxDecoration(border: Border.all(color: Theme.of(context).primaryColor, width: 2), shape: BoxShape.circle), decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).primaryColor, width: 2),
shape: BoxShape.circle),
child: ClipOval( child: ClipOval(
child: ClipOval( child: ClipOval(
child: Icon(Icons.person,size: 36,color: Theme.of(context).colorScheme.primary,), child: Icon(
Icons.person,
size: 36,
color: Theme.of(context).colorScheme.primary,
),
), ),
), ),
), ),
@ -311,7 +326,10 @@ class _LandPageState extends State<LandPage> {
}), }),
Text( Text(
"English", "English",
style: Theme.of(context).textTheme.bodyText1?.copyWith(color: AColors.grey3A), style: Theme.of(context)
.textTheme
.bodyText1
?.copyWith(color: AColors.grey3A),
textScaleFactor: AppStyle.getScaleFactor(context), textScaleFactor: AppStyle.getScaleFactor(context),
), ),
Radio( Radio(
@ -324,7 +342,10 @@ class _LandPageState extends State<LandPage> {
}), }),
Text( Text(
"عربي", "عربي",
style: Theme.of(context).textTheme.bodyText1?.copyWith(color: AColors.grey3A), style: Theme.of(context)
.textTheme
.bodyText1
?.copyWith(color: AColors.grey3A),
textScaleFactor: AppStyle.getScaleFactor(context), textScaleFactor: AppStyle.getScaleFactor(context),
), ),
], ],
@ -368,8 +389,12 @@ class _LandPageState extends State<LandPage> {
icon: Icons.share, icon: Icons.share,
title: _subtitle.shareApp, title: _subtitle.shareApp,
onPressed: () async { onPressed: () async {
PackageInfo packageInfo = await PackageInfo.fromPlatform(); PackageInfo packageInfo =
String shareLink = "\n https://play.google.com/store/apps/details?id=" + packageInfo.packageName + "\n https://apps.apple.com/us/app/"; 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); Share.share(shareLink);
}, },
), ),
@ -381,11 +406,15 @@ class _LandPageState extends State<LandPage> {
children: [ children: [
Text( Text(
"Powered By NewTrack", "Powered By NewTrack",
style: Theme.of(context).textTheme.headline6?.copyWith(fontWeight: FontWeight.w500, color: AColors.grey3A, fontSize: 12), style: Theme.of(context).textTheme.headline6?.copyWith(
fontWeight: FontWeight.w500,
color: AColors.grey3A,
fontSize: 12),
textScaleFactor: AppStyle.getScaleFactor(context), textScaleFactor: AppStyle.getScaleFactor(context),
), ),
6.width, 6.width,
Image.asset("assets/images/qr.jpeg", width: 32, height: 32, color: AColors.grey3A) Image.asset("assets/images/qr.jpeg",
width: 32, height: 32, color: AColors.grey3A)
], ],
).paddingOnly(left: 20, right: 20, top: 8, bottom: 8), ).paddingOnly(left: 20, right: 20, top: 8, bottom: 8),
], ],

@ -4,7 +4,7 @@ import '../app_style/sizing.dart';
class ATextFormField extends StatefulWidget { class ATextFormField extends StatefulWidget {
final Function(String?)? onSaved; final Function(String?)? onSaved;
final String Function(String?)? validator; final String? Function(String?)? validator;
final Function(String)? onChange; final Function(String)? onChange;
final bool? obscureText; final bool? obscureText;
final VoidCallback? showPassword; final VoidCallback? showPassword;

Loading…
Cancel
Save