From f7e464567a988f59715df69aa260f7925157cccb Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Tue, 15 Sep 2020 11:23:35 +0300 Subject: [PATCH] elham commit --- android/app/src/debug/AndroidManifest.xml | 2 +- android/app/src/main/AndroidManifest.xml | 14 +- .../com/cloud/driverapp/MainActivity.kt | 2 +- .../main/res/drawable/launch_background.xml | 13 +- android/app/src/main/res/values/styles.xml | 19 +- android/app/src/profile/AndroidManifest.xml | 2 +- .../AppIcon.appiconset/Contents.json | Bin 2519 -> 2133 bytes lib/app-icons/driver_app_icons.dart | 47 ++- lib/config/config.dart | 9 + lib/config/shared_pref_kay.dart | 2 - lib/config/size_config.dart | 2 +- .../authentication/authenticated_user.dart | 24 +- .../model/authentication/login_request.dart | 2 +- lib/core/model/hospitals/hospitals_model.dart | 30 +- .../request_get_hospitals_model.dart | 20 +- ...res_model.dart => deliverd_order_res.dart} | 2 +- lib/core/service/base_service.dart | 2 +- lib/core/service/client/base_app_client.dart | 2 +- lib/core/service/hospital_service.dart | 2 +- lib/core/service/orders_service.dart | 11 +- .../viewModels/authentication_view_model.dart | 4 + lib/core/viewModels/orders_view_model.dart | 4 +- lib/locator.dart | 3 +- lib/pages/authentication/login_page.dart | 278 +++++++++--------- lib/pages/dashboard/dashboard_screen.dart | 273 ++++------------- .../delivery/delivery_confirmed_page.dart | 117 +++++--- lib/pages/delivery/information_page.dart | 2 +- lib/pages/landing/replay_page.dart | 4 +- lib/pages/orders/deliverd_orders_page.dart | 147 ++------- lib/pages/orders/pending_orders_page.dart | 104 +------ .../{setting.dart => setting_page.dart} | 59 ++-- lib/uitl/app_toast.dart | 1 - lib/uitl/date_uitl.dart | 5 - lib/uitl/translations_delegate_base.dart | 8 + lib/uitl/utils.dart | 12 + lib/widgets/buttons/button.dart | 2 +- lib/widgets/buttons/mini_button.dart | 4 +- lib/widgets/buttons/secondary_button.dart | 31 +- .../data_display/circle-container.dart | 2 +- .../data_display/list/flexible_container.dart | 1 + lib/widgets/data_display/text.dart | 3 +- lib/widgets/delivery/customer_brief_card.dart | 253 ++++++++-------- .../delivery/delivery_action_button.dart | 1 + .../delivery/distance_in_kilometers.dart | 44 +++ lib/widgets/delivery/package_content.dart | 2 +- lib/widgets/drawer/app_drawer_widget.dart | 2 - lib/widgets/order/order_info_card.dart | 100 +++++++ lib/widgets/others/app_scaffold_widget.dart | 57 ++-- lib/widgets/others/close_back.dart | 11 +- lib/widgets/others/rounded_container.dart | 51 ++-- lib/widgets/transitions/fade_page.dart | 47 ++- pubspec.yaml | 8 +- test/widget_test.dart | 3 +- 53 files changed, 856 insertions(+), 994 deletions(-) rename lib/core/model/orders/{deliverd_order_res_model.dart => deliverd_order_res.dart} (99%) rename lib/pages/setting/{setting.dart => setting_page.dart} (80%) create mode 100644 lib/widgets/delivery/distance_in_kilometers.dart create mode 100644 lib/widgets/order/order_info_card.dart diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 989b30e..e829f99 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -3,5 +3,5 @@ - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index cdbc90e..72e5ced 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -21,21 +21,19 @@ while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" /> + android:name="io.flutter.embedding.android.SplashScreenDrawable" + android:resource="@drawable/launch_background" /> - - + + - - - - - - +import 'package:driverapp/config/config.dart';import 'package:driverapp/core/model/orders/next_order_request_model.dart';import 'package:driverapp/core/model/orders/pending_orders_req_model.dart';import 'package:driverapp/core/model/orders/pending_orders_res_model.dart';import 'package:driverapp/core/model/orders/update_order_status_request_model.dart';import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart';import 'pack \ No newline at end of file diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index 1f83a33..e47faa9 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -1,18 +1 @@ - - - - - - - +import 'package:barcode_scan/platform_wrapper.dart';import 'package:driverapp/config/config.dart';import 'package:driverapp/config/size_config.dart';import 'package:driverapp/core/enum/viewstate.dart';import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart';import 'package:driverapp/core/viewModels/authentication_view_model.dart';import 'package:driverapp/core/viewModels/orders_view_model.dart';import 'package:driverapp/pages/delivery/information_page.dart';import 'package:driverapp/pages/orders/deliverd_orders_page.dart';import 'package:driverapp/pages/orders/pending_orders_page.dart';import 'package:driverapp/pages/setting/setting_page.dart';import 'package:driverapp/uitl/app_toast.dart';import 'package:driverapp/uitl/translations_delegate_base.dart';import 'package:driverapp/uitl/utils.dart';import 'package:driverapp/widgets/order/order_info_card.dart';import 'package:driverapp/widgets/others/app_scaffold_w \ No newline at end of file diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 989b30e..e829f99 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -3,5 +3,5 @@ - + diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab2d9dea668a4f83df94d525897d9e68dd..5a9af2de9a9652e486c88418b8fc5ce96b82ccbe 100644 GIT binary patch literal 2133 zcmeHHO-~y!5bb%T{SUrnBcTn=aSLfl=mDu8sHw^URV!mpvZHwImF*<~)c@YGcLNQO zR$MD`SUaAtH_y+5bz`h&gNBP0UqT@*UW4ULGZMza=o(@D*+@`sWUK`1%5YNF;V75f z`oX(2!M!=wD3{>-*e*kfdSObzt$azmuc-EjV3khr#lk3AcDY}kM1x-&yDG1^gV@d9 z6bsdQ4|XKl2CPSI{^?nB@<;wa%>y}kJ_;4%XSZyc2*sUar=SA&@@pjeoNj}`#)FoQ z%{?VvwCW=A$?nqRgCSRo64Io68W{bVus~sPpAFgZgzfXphIEU+(qxNdpWiN?qo;Kz zkD&EuHz~xQBvZ%k< zQl~@`*)EuDc#tNsELie?uJi$WRENb}2doDzDuNqoq{&Is%zN1p7IgEBlsZKV!lNO4CmVD*$V;=5QXl=(yQt?< ziukE%VjI3Cdew-%|5ugt_&vSGcIwU%7UE}v{A`lH(PZOS{%idve47sP(|_SZ_CJJv z!2ain&H?w&hC}XO5I#VEk>~=T--bi<2jK(skJKMp`MeyfK9KAiu6}dr%jDh+`ht~b zE*+qKB=4r_F6#m39)J$ezAp5-@OS(A&6(D2gCQ?Y06IYXL$%LI_BmnJ0F zrn$Kasp6WpZ|uacP0j5RbeU<+k@QyR)fgen#ZDTR<@^x-V6Ea(n4Z)bB~0H>2iaOD Orb}5dW23sLi@pGAY)(u7 diff --git a/lib/app-icons/driver_app_icons.dart b/lib/app-icons/driver_app_icons.dart index b55144c..150ea13 100644 --- a/lib/app-icons/driver_app_icons.dart +++ b/lib/app-icons/driver_app_icons.dart @@ -11,7 +11,7 @@ /// fonts: /// - asset: fonts/DriverApp.ttf /// -/// +/// /// import 'package:flutter/widgets.dart'; @@ -21,19 +21,34 @@ class DriverApp { static const _kFontFam = 'DriverApp'; static const _kFontPkg = null; - static const IconData location_1 = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData logo = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData closed_box = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData location = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData open_box = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData phone_call = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData qr = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData not_available = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData rejected_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData not_reachable_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData group_74 = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData message = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData whatsapp = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData call = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData deliverd_icon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData location_1 = + IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData logo = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData closed_box = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData location = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData open_box = + IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData phone_call = + IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr = + IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData not_available = + IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData rejected_icon = + IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData not_reachable_icon = + IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData group_74 = + IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData message = + IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData whatsapp = + IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData call = + IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData deliverd_icon = + IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/lib/config/config.dart b/lib/config/config.dart index 0c92975..850adf6 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,4 +1,5 @@ import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; /// End points const BASE_URL = 'https://uat.hmgwebservices.com/Services'; @@ -23,3 +24,11 @@ const MAX_SMALL_SCREEN = 660; class AppGlobal { static BuildContext context; } + +const LINEAR_GRADIENT = LinearGradient( + colors: [ + Color(0xff45B7AE), + Color(0xff119FA9), + ], +// stops: [0.0, 1.0], +); diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index b1bfbc9..59f4f0f 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,5 +1,3 @@ const TOKEN = 'token'; const APP_LANGUAGE = 'language'; const USER_PROFILE = 'user-profile'; - - diff --git a/lib/config/size_config.dart b/lib/config/size_config.dart index e7e1b41..6a18f3a 100644 --- a/lib/config/size_config.dart +++ b/lib/config/size_config.dart @@ -41,7 +41,7 @@ class SizeConfig { } _blockWidth = screenWidth / 100; _blockHeight = screenHeight / 100; - + textMultiplier = _blockHeight; imageSizeMultiplier = _blockWidth; heightMultiplier = _blockHeight; diff --git a/lib/core/model/authentication/authenticated_user.dart b/lib/core/model/authentication/authenticated_user.dart index 0329bd5..d791ddc 100644 --- a/lib/core/model/authentication/authenticated_user.dart +++ b/lib/core/model/authentication/authenticated_user.dart @@ -15,18 +15,18 @@ class AuthenticatedUser { AuthenticatedUser( {this.iD, - this.userID, - this.password, - this.userName, - this.roleID, - this.name, - this.active, - this.createdOn, - this.createdBy, - this.editedOn, - this.editedBy, - this.mobileNumber, - this.realRoleID}); + this.userID, + this.password, + this.userName, + this.roleID, + this.name, + this.active, + this.createdOn, + this.createdBy, + this.editedOn, + this.editedBy, + this.mobileNumber, + this.realRoleID}); AuthenticatedUser.fromJson(Map json) { iD = json['ID']; diff --git a/lib/core/model/authentication/login_request.dart b/lib/core/model/authentication/login_request.dart index 0e08b82..fbbccde 100644 --- a/lib/core/model/authentication/login_request.dart +++ b/lib/core/model/authentication/login_request.dart @@ -15,4 +15,4 @@ class LoginRequest { data['Password'] = this.password; return data; } -} \ No newline at end of file +} diff --git a/lib/core/model/hospitals/hospitals_model.dart b/lib/core/model/hospitals/hospitals_model.dart index a0628c6..a8308de 100644 --- a/lib/core/model/hospitals/hospitals_model.dart +++ b/lib/core/model/hospitals/hospitals_model.dart @@ -18,21 +18,21 @@ class HospitalsModel { HospitalsModel( {this.desciption, - this.desciptionN, - this.iD, - this.legalName, - this.legalNameN, - this.name, - this.nameN, - this.phoneNumber, - this.setupID, - this.distanceInKilometers, - this.isActive, - this.latitude, - this.longitude, - this.mainProjectID, - this.projectOutSA, - this.usingInDoctorApp}); + this.desciptionN, + this.iD, + this.legalName, + this.legalNameN, + this.name, + this.nameN, + this.phoneNumber, + this.setupID, + this.distanceInKilometers, + this.isActive, + this.latitude, + this.longitude, + this.mainProjectID, + this.projectOutSA, + this.usingInDoctorApp}); HospitalsModel.fromJson(Map json) { desciption = json['Desciption']; diff --git a/lib/core/model/hospitals/request_get_hospitals_model.dart b/lib/core/model/hospitals/request_get_hospitals_model.dart index be16365..b836d41 100644 --- a/lib/core/model/hospitals/request_get_hospitals_model.dart +++ b/lib/core/model/hospitals/request_get_hospitals_model.dart @@ -13,16 +13,16 @@ class RequestGetHospitalsModel { RequestGetHospitalsModel( {this.latitude, - this.longitude, - this.versionID, - this.channel, - this.languageID, - this.iPAdress, - this.generalid, - this.patientOutSA, - this.sessionID, - this.isDentalAllowedBackend, - this.deviceTypeID}); + this.longitude, + this.versionID, + this.channel, + this.languageID, + this.iPAdress, + this.generalid, + this.patientOutSA, + this.sessionID, + this.isDentalAllowedBackend, + this.deviceTypeID}); RequestGetHospitalsModel.fromJson(Map json) { latitude = json['Latitude']; diff --git a/lib/core/model/orders/deliverd_order_res_model.dart b/lib/core/model/orders/deliverd_order_res.dart similarity index 99% rename from lib/core/model/orders/deliverd_order_res_model.dart rename to lib/core/model/orders/deliverd_order_res.dart index 46807f8..eec0584 100644 --- a/lib/core/model/orders/deliverd_order_res_model.dart +++ b/lib/core/model/orders/deliverd_order_res.dart @@ -135,7 +135,7 @@ class ItemsQuantitiesList { String itemName; String itemNameN; int productID; - int quantity; + var quantity; ItemsQuantitiesList( {this.itemName, this.itemNameN, this.productID, this.quantity}); diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index 33ce779..d2b010a 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -23,4 +23,4 @@ class BaseService { AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); } } -} \ No newline at end of file +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 8c3602b..962c26c 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -16,7 +16,7 @@ AppSharedPreferences sharedPref = new AppSharedPreferences(); /// body: null); class BaseAppClient { - post( + post( String endPoint, { Map body, Function(dynamic response, int statusCode) onSuccess, diff --git a/lib/core/service/hospital_service.dart b/lib/core/service/hospital_service.dart index ad99ea9..21d6a43 100644 --- a/lib/core/service/hospital_service.dart +++ b/lib/core/service/hospital_service.dart @@ -24,7 +24,7 @@ class HospitalService extends BaseService { Future getHospitals() async { await baseAppClient.post(GET_PROJECT, onSuccess: (dynamic response, int statusCode) { - _hospitals.clear(); + _hospitals.clear(); response['ListProject'].forEach((hospital) { _hospitals.add(HospitalsModel.fromJson(hospital)); }); diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index 60cc4a6..d389caa 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -1,21 +1,22 @@ import 'package:driverapp/config/config.dart'; +import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; import 'package:driverapp/core/model/orders/next_order_request_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_req_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/base_service.dart'; -import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:location/location.dart'; -import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart'; class OrdersService extends BaseService { List _orders = List(); List _nextOrdersList = List(); - List _deliverdOrderList = List(); + List _deliverdOrderList = List(); + List get orders => _orders; - List get deliverdOrderList => _deliverdOrderList; + + List get deliverdOrderList => _deliverdOrderList; List get nextOrdersList => _nextOrdersList; bool isOrderInserted; @@ -127,7 +128,7 @@ class OrdersService extends BaseService { onSuccess: (dynamic response, int statusCode) { _deliverdOrderList.clear(); response['PatientER_Delivery_GetAllDeliverdOrderList'].forEach((order) { - _deliverdOrderList.add(DeliverdOrderResModel.fromJson(order)); + _deliverdOrderList.add(DeliverdOrderModel.fromJson(order)); }); }, onFailure: (String error, int statusCode) { hasError = true; diff --git a/lib/core/viewModels/authentication_view_model.dart b/lib/core/viewModels/authentication_view_model.dart index 158e428..4d94ec4 100644 --- a/lib/core/viewModels/authentication_view_model.dart +++ b/lib/core/viewModels/authentication_view_model.dart @@ -81,6 +81,10 @@ class AuthenticationViewModel with ChangeNotifier { } logout() async { + isLoading = false; + isError = false; + isLogin = false; await sharedPref.clear(); + notifyListeners(); } } diff --git a/lib/core/viewModels/orders_view_model.dart b/lib/core/viewModels/orders_view_model.dart index 028656e..4d825b4 100644 --- a/lib/core/viewModels/orders_view_model.dart +++ b/lib/core/viewModels/orders_view_model.dart @@ -5,7 +5,7 @@ import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/orders_service.dart'; -import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart'; + import '../../locator.dart'; import 'base_view_model.dart'; @@ -14,7 +14,7 @@ class OrdersViewModel extends BaseViewModel { List get orders => _ordersService.orders; - List get deliverdOrders => + List get deliverdOrders => _ordersService.deliverdOrderList; List get nextOrdersList => _ordersService.nextOrdersList; diff --git a/lib/locator.dart b/lib/locator.dart index d1b2ba3..66afadd 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -3,6 +3,7 @@ import 'package:get_it/get_it.dart'; import 'core/service/authentication_service.dart'; import 'core/service/hospital_service.dart'; import 'core/service/orders_service.dart'; +import 'core/viewModels/authentication_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; import 'core/viewModels/orders_view_model.dart'; @@ -17,6 +18,6 @@ void setupLocator() { /// View Model locator.registerFactory(() => HospitalViewModel()); - // locator.registerFactory(() => AuthenticationViewModel()); + locator.registerFactory(() => AuthenticationViewModel()); locator.registerFactory(() => OrdersViewModel()); } diff --git a/lib/pages/authentication/login_page.dart b/lib/pages/authentication/login_page.dart index 79046f7..76fd886 100644 --- a/lib/pages/authentication/login_page.dart +++ b/lib/pages/authentication/login_page.dart @@ -44,59 +44,57 @@ class LoginPage extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ FractionallySizedBox( - widthFactor: 0.80, - child: Column( - children: [ - SizedBox( - height: 40, - ), - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - child: Icon( - DriverApp.logo, - size: 70, - color: Theme.of(context).primaryColor, - ), - margin: EdgeInsets.only( - right: projectViewModel.isArabic - ? 0 - : MediaQuery.of(context).size.width * - 0.15, - left: !projectViewModel.isArabic - ? 0 - : MediaQuery.of(context).size.width * - 0.15), - ), - ], - ), - SizedBox( - height: 20, - ), - Column( - children: [ - Text( - "Driver", - style: TextStyle( - fontSize: 50, fontWeight: FontWeight.bold), - ), - Text( - "Delivery", - style: TextStyle(fontSize: 36, letterSpacing: 1), + widthFactor: 0.80, + child: Column( + children: [ + SizedBox( + height: 40, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + child: Icon( + DriverApp.logo, + size: 70, + color: Theme.of(context).primaryColor, ), - Text( - "APP", - style: TextStyle( - fontSize: 33, - letterSpacing: 33, - fontWeight: FontWeight.w400), - ), - ], - ), - SizedBox( - height: 30, - ), + margin: EdgeInsets.only( + right: projectViewModel.isArabic + ? 0 + : MediaQuery.of(context).size.width * 0.15, + left: !projectViewModel.isArabic + ? 0 + : MediaQuery.of(context).size.width * 0.15), + ), + ], + ), + SizedBox( + height: 20, + ), + Column( + children: [ + Text( + "Driver", + style: TextStyle( + fontSize: 50, fontWeight: FontWeight.bold), + ), + Text( + "Delivery", + style: TextStyle(fontSize: 36, letterSpacing: 1), + ), + Text( + "APP", + style: TextStyle( + fontSize: 33, + letterSpacing: 33, + fontWeight: FontWeight.w400), + ), + ], + ), + SizedBox( + height: 30, + ), // Row( // mainAxisAlignment: MainAxisAlignment.center, @@ -143,101 +141,100 @@ class LoginPage extends StatelessWidget { // : Colors.transparent), // ], // ), - SizedBox( - height: 10, - ), - Form( - key: loginFormKey, - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Padding( - padding: - const EdgeInsets.symmetric(horizontal: 20), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Expanded( - child: Text( - TranslationBase.of(context) - .enterCredentialsMsg, - style: TextStyle( - fontSize: 13, color: Colors.grey), - ), - ), - SizedBox( - height: 10, - ) - ], - ), - ), - SizedBox( - height: 10, - ), - Container( - child: TextFields( - hintText: TranslationBase.of(context).enterId, - validator: (value) { - if (value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterYourID; - } - return null; - }, - onSaved: (value) { - loginRequest.userID = - int.parse(value.trim()); - }, - ), - ), - SizedBox( - height: 20, - ), - Container( - child: TextFields( - borderRadiusValue: 6, - hintText: - TranslationBase.of(context).enterPassword, - validator: (value) { - if (value.isEmpty) { - return TranslationBase.of(context) - .pleaseEnterPassword; - } - return null; - }, - onSaved: (value) { - loginRequest.password = value; - }, - type: 'password', - ), - ), - SizedBox( - height: 25, - ), - Row( + SizedBox( + height: 10, + ), + Form( + key: loginFormKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 20), + child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Text( - TranslationBase.of(context).forgotPassword, - style: TextStyle( - fontSize: 14, - color: Theme.of(context).primaryColor), + Expanded( + child: Text( + TranslationBase.of(context) + .enterCredentialsMsg, + style: TextStyle( + fontSize: 13, color: Colors.grey), + ), ), + SizedBox( + height: 10, + ) ], ), - ], - ), + ), + SizedBox( + height: 10, + ), + Container( + child: TextFields( + hintText: TranslationBase.of(context).enterId, + validator: (value) { + if (value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterYourID; + } + return null; + }, + onSaved: (value) { + loginRequest.userID = int.parse(value.trim()); + }, + ), + ), + SizedBox( + height: 20, + ), + Container( + child: TextFields( + borderRadiusValue: 6, + hintText: + TranslationBase.of(context).enterPassword, + validator: (value) { + if (value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterPassword; + } + return null; + }, + onSaved: (value) { + loginRequest.password = value; + }, + type: 'password', + ), + ), + SizedBox( + height: 25, + ), +//ToDo when forget page functions ready +// Row( +// mainAxisAlignment: MainAxisAlignment.end, +// children: [ +// Text( +// TranslationBase.of(context).forgotPassword, +// style: TextStyle( +// fontSize: 14, +// color: Theme.of(context).primaryColor), +// ), +// ], +// ), + ], ), - ], - ), - ), - SizedBox( - height: 20, + ), + ], ), - SizedBox( - height: 10, - ), - + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 10, + ), Container( margin: EdgeInsets.all(10), height: MediaQuery.of(context).size.height * 0.22, @@ -263,5 +260,4 @@ class LoginPage extends StatelessWidget { ), ); } - } diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index f0fe1be..a0a9acd 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -1,4 +1,5 @@ import 'package:barcode_scan/platform_wrapper.dart'; +import 'package:driverapp/config/config.dart'; import 'package:driverapp/config/size_config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; @@ -7,14 +8,13 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; import 'package:driverapp/pages/orders/deliverd_orders_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; -import 'package:driverapp/pages/setting/setting.dart'; +import 'package:driverapp/pages/setting/setting_page.dart'; import 'package:driverapp/uitl/app_toast.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/uitl/utils.dart'; -import 'package:driverapp/widgets/data_display/circle-container.dart'; +import 'package:driverapp/widgets/order/order_info_card.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/network_base_view.dart'; -import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -93,23 +93,27 @@ class _DashboardScreenState extends State { child: Column( children: [ InkWell( - child:CircleAvatar( - radius: 25.5, - backgroundColor: Color(0xff30B7B9), child: CircleAvatar( + radius: 25.5, backgroundColor: Color(0xff30B7B9), - maxRadius: 26.0, - child: Image.asset( - 'assets/images/driver.png', - fit: BoxFit.contain, - ),), + child: CircleAvatar( + backgroundColor: Color(0xff30B7B9), + maxRadius: 26.0, + child: Image.asset( + 'assets/images/driver.png', + fit: BoxFit.contain, + ), + ), ), - onTap: (){ + onTap: () { Navigator.push( context, MaterialPageRoute( - builder: (context) => - SettingPage(driverName:_authenticationViewModel.user.userName, driverID:_authenticationViewModel.user.userID))); + builder: (context) => SettingPage( + driverName: _authenticationViewModel + .user.userName, + driverID: _authenticationViewModel + .user.userID))); }, ), ], @@ -133,10 +137,7 @@ class _DashboardScreenState extends State { width: MediaQuery.of(context).size.width * 0.44, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient(colors: [ - Color(0xff17AFB8), - Color(0xff49C1BC) - ]), + gradient: LINEAR_GRADIENT, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -243,10 +244,7 @@ class _DashboardScreenState extends State { width: MediaQuery.of(context).size.width * 0.45, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient(colors: [ - Color(0xff17AFB8), - Color(0xff49C1BC) - ]), + gradient: LINEAR_GRADIENT, ), child: InkWell( onTap: () => Navigator.push( @@ -279,7 +277,7 @@ class _DashboardScreenState extends State { ), ), Text( - '5', + '3', style: TextStyle( color: Colors.white, fontSize: @@ -288,7 +286,7 @@ class _DashboardScreenState extends State { ), Text( TranslationBase.of(context) - .undeliveredPackages, + .deliveredPackages, style: TextStyle( color: Colors.white, fontSize: MediaQuery.of(context) @@ -310,8 +308,9 @@ class _DashboardScreenState extends State { width: 100, height: 100, decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), + color: Colors.white10, + shape: BoxShape.circle, + ), child: Column( mainAxisAlignment: MainAxisAlignment.center, @@ -360,30 +359,14 @@ class _DashboardScreenState extends State { _scanQrAndGetPatient(context, model); }, child: Container( - height: MediaQuery - .of(context) - .orientation == - Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.18 - : MediaQuery - .of(context) - .size - .height * 0.30, - width: MediaQuery - .of(context) - .size - .width * 0.50, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.30, + width: MediaQuery.of(context).size.width * 0.50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient( - colors: [ - Hexcolor("#45B7AE"), - Hexcolor("#119FA9") - ], - ), + gradient: LINEAR_GRADIENT, ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -396,32 +379,29 @@ class _DashboardScreenState extends State { width: MediaQuery.of(context).size.width * 0.26, height: MediaQuery.of(context) - .orientation == - Orientation.portrait + .orientation == + Orientation.portrait ? MediaQuery.of(context).size.height * - 0.14 + 0.14 : MediaQuery.of(context).size.height * - 0.28, + 0.28, fit: BoxFit.contain, ) ], ), Column( mainAxisAlignment: - MainAxisAlignment.spaceEvenly, + MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only(top: 8.0), child: Text( - TranslationBase - .of(context) - .scan, + TranslationBase.of(context).scan, style: TextStyle( - fontSize: MediaQuery - .of(context) - .orientation == - Orientation.landscape + fontSize: MediaQuery.of(context) + .orientation == + Orientation.landscape ? SizeConfig.textMultiplier * 6.0 : SizeConfig.textMultiplier * 4.0, color: Colors.white, @@ -432,14 +412,12 @@ class _DashboardScreenState extends State { Padding( padding: EdgeInsets.only(top: 0.0), child: Text( - TranslationBase - .of(context) + TranslationBase.of(context) .toAddPackageToQue, style: TextStyle( - fontSize: MediaQuery - .of(context) - .orientation == - Orientation.landscape + fontSize: MediaQuery.of(context) + .orientation == + Orientation.landscape ? SizeConfig.textMultiplier * 3.0 : SizeConfig.textMultiplier * 2.0, color: Colors.white, @@ -465,8 +443,7 @@ class _DashboardScreenState extends State { children: [ Column( children: [ - Text( - TranslationBase.of(context).nearestDropOffs, + Text(TranslationBase.of(context).nearestDropOffs, style: TextStyle( fontSize: 18.0, color: Hexcolor("#343333"), @@ -492,12 +469,11 @@ class _DashboardScreenState extends State { ), ], ), - onTap: () => - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrdersListScreen()), - ), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + ), ), ], ), @@ -514,142 +490,23 @@ class _DashboardScreenState extends State { ? 0 : model.orders.length < 3 ? model.orders.length : 3, itemBuilder: (BuildContext context, int index) { + model.orders.length == 0 + ? Text( + "There's No Orders To Deliver", + style: TextStyle(color: Colors.red), + ) + : Text(""); return Padding( padding: EdgeInsets.symmetric(horizontal: 0.2), - child: InkWell( - child: Container( - child: RoundedContainer( - showShadow: true, - raduis: 25.0, - height: MediaQuery - .of(context) - .orientation == - Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * 0.120 - : MediaQuery - .of(context) - .size - .height * 0.209, - child: Row( - mainAxisAlignment: - MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: - MainAxisAlignment.start, - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery - .of(context) - .orientation == - Orientation.portrait - ? MediaQuery - .of(context) - .size - .height * - 0.06 - : MediaQuery - .of(context) - .size - .height * - 0.11, - width: MediaQuery - .of(context) - .orientation == - Orientation.portrait - ? MediaQuery - .of(context) - .size - .width * - 0.05 - : MediaQuery - .of(context) - .size - .width * - 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) - Expanded( - flex: 5, - child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle( - fontSize: 18.0, - color: Hexcolor("#343333"), - fontWeight: FontWeight.bold), - ), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - Expanded( - child: Text( - model.orders[index].orderID - .toString(), - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), - ), - ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - borderWidth: 1.5, - child: Text( - model.orders[index].distanceInKilometers - .toString() + - '\nK.m\naway', - style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), - ), - ), - ), - ], - ), - ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InformationPage(model.orders[index]))); - }, - ), + child: OrderInfoCard( + order: model.orders[index], + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => InformationPage( + model.orders[index]))); + }), ); }, ), diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart index c2e6f54..ae882a4 100644 --- a/lib/pages/delivery/delivery_confirmed_page.dart +++ b/lib/pages/delivery/delivery_confirmed_page.dart @@ -1,3 +1,4 @@ +import 'package:driverapp/config/config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/next_order_request_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; @@ -23,13 +24,14 @@ class DeliveryConfirmedPage extends StatelessWidget { Widget build(BuildContext context) { return BaseView( builder: (_, model, w) => AppScaffold( + isAppBarGradient: true, isShowAppBar: true, appBarColor: Theme.of(context).primaryColor, arrowColor: Colors.white, titleColor: Colors.white, body: SafeArea( child: Container( - color: Theme.of(context).primaryColor, + decoration: BoxDecoration(gradient: LINEAR_GRADIENT), child: ListView( children: [ Stack( @@ -41,9 +43,12 @@ class DeliveryConfirmedPage extends StatelessWidget { children: [ Container( width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 0.7, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.width * 0.7 + : MediaQuery.of(context).size.width * 0.5, padding: EdgeInsets.only( - top: MediaQuery.of(context).size.width * 0.12, + top: MediaQuery.of(context).size.width * 0.14, ), decoration: BoxDecoration( color: Colors.white10, @@ -61,7 +66,7 @@ class DeliveryConfirmedPage extends StatelessWidget { 0.03, ), Text( - TranslationBase.of(context).deliveryInfo, + 'Delivery Confirmed', style: TextStyle( color: Colors.white, fontSize: 20, @@ -88,15 +93,21 @@ class DeliveryConfirmedPage extends StatelessWidget { ), ], ), +// Container( +// width: MediaQuery.of(context).size.width, +// height: MediaQuery.of(context).size.width, +// ), Container( width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width, - ), - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 1.0, + height: MediaQuery.of(context).orientation == + Orientation.landscape + ? MediaQuery.of(context).size.width * 0.6 + : MediaQuery.of(context).size.width * 1.0, margin: EdgeInsets.only( - top: MediaQuery.of(context).size.width * 0.75, + top: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.width * 0.70 + : MediaQuery.of(context).size.width * 0.60, ), decoration: BoxDecoration( color: Colors.white, @@ -105,48 +116,61 @@ class DeliveryConfirmedPage extends StatelessWidget { topRight: Radius.circular(80)), ), child: Column( - mainAxisAlignment: MainAxisAlignment.end, + mainAxisAlignment: MediaQuery.of(context).orientation == + Orientation.landscape + ? MainAxisAlignment.center + : MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.width * 0.09, + bottom: MediaQuery.of(context).size.width * 0.00, ), - child: Column( - children: [ - FlatButton.icon( - padding: EdgeInsets.all(8), - color: Colors.orangeAccent, - shape: RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10.0), - ), - label: Text( - TranslationBase.of(context).addNoteBtn, - style: TextStyle(color: Colors.white), + child: Padding( + padding: MediaQuery.of(context).orientation == + Orientation.landscape + ? EdgeInsets.only(top: 60.0) + : EdgeInsets.only(top: 30.0), + child: Column( + children: [ + FlatButton.icon( + padding: EdgeInsets.all(14.0), + color: Colors.orangeAccent, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10.0), + ), + label: Text( + TranslationBase.of(context).addNoteBtn, + style: TextStyle( + color: Colors.white, fontSize: 20.0), + ), + icon: Icon( + Icons.mode_edit, + color: Colors.white, + ), + onPressed: () {}, ), - icon: Icon( - Icons.mode_edit, - color: Colors.white, + SizedBox( + height: MediaQuery.of(context).size.width * + 0.00, //20, ), - onPressed: () {}, - ), - SizedBox( - height: MediaQuery.of(context).size.width * - 0.02, //20, - ), - Container( - margin: EdgeInsets.all(10), - child: SecondaryButton( - label: TranslationBase.of(context) - .nextDelivery, - loading: model.state == ViewState.BusyLocal, - onTap: () { - getNextOrder(context, model); - }, + Padding( + padding: const EdgeInsets.only(top: 30.0), + child: Container( + margin: EdgeInsets.all(10), + child: SecondaryButton( + label: TranslationBase.of(context) + .nextDelivery, + loading: + model.state == ViewState.BusyLocal, + onTap: () { + getNextOrder(context, model); + }, + ), + ), ), - ), - ], + ], + ), ), ), ], @@ -154,7 +178,10 @@ class DeliveryConfirmedPage extends StatelessWidget { ), Container( margin: EdgeInsets.only( - top: MediaQuery.of(context).size.width * 0.6, + top: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.width * 0.6 + : MediaQuery.of(context).size.width * 0.4, ), child: CustomerBriefCard( itemId: item.orderID, diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index 6860891..5a4951a 100644 --- a/lib/pages/delivery/information_page.dart +++ b/lib/pages/delivery/information_page.dart @@ -1 +1 @@ -import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { showDeliveryOptions(OrdersViewModel model) { showModalBottomSheet( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), context: context, builder: (BuildContext bc) { return ListView( children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.45, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), )) ], ), ), ], ); }); } return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Color(0xff45B7AE), arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Colors.red, child: Container( color: Color(0xff45B7AE), child: ListView( children: [ Column( children: [ Stack( children: [ // Container( // width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.width, // ), Container( width: MediaQuery.of(context).size.width * 1, height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 1.9 : MediaQuery.of(context).size.width * 1.1, margin: EdgeInsets.only( top: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 0.23 : MediaQuery.of(context).size.width * 0.13), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ SizedBox( height: MediaQuery.of(context).size.width * 0.4, //MediaQuery.of(context).size.width * 0.005, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white, //Color(0xffED1C24), btnIcon: Icon(DriverApp.location_1, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xffED1C24)), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); }, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xFF5EA34A), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Color(0xffFFA540), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors .white, //Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: MediaQuery.of(context).orientation == Orientation.portrait ? 50 : 90, color: Theme.of(context).primaryColor, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch("tel://" + item.mobileNumber), ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.08, ), Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( TranslationBase.of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.05, ), Padding( padding: const EdgeInsets.only(left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item .itemsQuantitiesList.length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( child: SecondaryButton( label: TranslationBase.of(context).clientReached, onTap: () { showDeliveryOptions(model); }, ), ), ], ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ), ], ), ], ), ], ), ), ), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase.of(context).delivered; break; case 4: orderStatusText = TranslationBase.of(context).deliveredAccepted; break; case 5: orderStatusText = TranslationBase.of(context).deliveredRejected; break; case 6: orderStatusText = TranslationBase.of(context).canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model, ); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel( deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file +import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/config/config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/dialog/custom_dialog.dart'; import 'package:driverapp/widgets/data_display/text.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:driverapp/widgets/delivery/delivery_action_button.dart'; import 'package:driverapp/widgets/delivery/package_content.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:maps_launcher/maps_launcher.dart'; import 'package:url_launcher/url_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { showDeliveryOptions(OrdersViewModel model) { showModalBottomSheet( backgroundColor: Colors.white, shape: RoundedRectangleBorder( borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), context: context, builder: (BuildContext bc) { return ListView( children: [ Container( decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), child: Column( mainAxisSize: MainAxisSize.min, children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: MediaQuery.of(context).orientation == Orientation.portrait ? 0.9 : 0.98, child: Container( height: MediaQuery.of(context).size.height * 0.45, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(50.0), topRight: Radius.circular(50.0), ), ), width: double.infinity, child: ListView( children: [ Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 15, ), ActionSheetButton( label: TranslationBase.of(context).delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox(height: 15), ActionSheetButton( label: TranslationBase.of(context).canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox(height: 15), ], ), ], ), ), ) ], ), ), ], ); }); } return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Color(0xff49C1BC), arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, isAppBarGradient: true, body: Container( child: Container( decoration: BoxDecoration(gradient: LINEAR_GRADIENT), child: ListView( children: [ Column( children: [ Stack( children: [ // Container( // width: MediaQuery.of(context).size.width, // height: MediaQuery.of(context).size.width, // ), Padding( padding: const EdgeInsets.only(top: 75.0), child: Container( width: MediaQuery.of(context).size.width * 1.0, height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.70 : MediaQuery.of(context).size.height * 1.7, margin: EdgeInsets.only( top: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.width * 0.23 : MediaQuery.of(context).size.width * 0.13), decoration: BoxDecoration( color: Theme.of(context).scaffoldBackgroundColor, borderRadius: BorderRadius.only( topLeft: Radius.circular(45), topRight: Radius.circular(45)), ), child: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ SizedBox( height: MediaQuery.of(context).orientation == Orientation.portrait ? MediaQuery.of(context).size.height * 0.05 : MediaQuery.of(context).size.height * 0.29, //MediaQuery.of(context).size.width * 0.005, ), Padding( padding: MediaQuery.of(context).orientation == Orientation.portrait ? EdgeInsets.only(top: 60.0) : EdgeInsets.only(top: 15.0), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white, //Color(0xffED1C24), btnIcon: Icon(DriverApp.location_1, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xffED1C24)), btnName: TranslationBase.of(context) .location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); }, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xFF5EA34A), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white, //Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Color(0xffFFA540), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white, //Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: MediaQuery.of(context) .orientation == Orientation.portrait ? 50 : 90, color: Theme.of(context).primaryColor, ), btnName: TranslationBase.of(context).call, btnFunction: () => launch( "tel://" + item.mobileNumber), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.08, ), Container( margin: EdgeInsets.only( left: MediaQuery.of(context).size.width * 0.05, right: MediaQuery.of(context).size.width * 0.05, ), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: const EdgeInsets.only(left: 8), child: Text( TranslationBase.of(context) .packageContent, style: TextStyle( fontWeight: FontWeight.w900, fontSize: 20), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.05, ), Padding( padding: const EdgeInsets.only(left: 10), child: Column( children: List.generate( item.itemsQuantitiesList != null ? item.itemsQuantitiesList .length : 0, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: MediaQuery.of(context).orientation == Orientation.portrait ? EdgeInsets.all(8.0) : EdgeInsets.symmetric(horizontal: 12.0), child: SecondaryButton( label: TranslationBase.of(context) .clientReached, onTap: () { showDeliveryOptions(model); }, ), ), ], ), ), ), CustomerBriefCard( itemId: item.orderID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn, longitude: item.longitude, latitude: item.latitude, ), ], ), ], ), ], ), ), ), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase.of(context).delivered; break; case 4: orderStatusText = TranslationBase.of(context).deliveredAccepted; break; case 5: orderStatusText = TranslationBase.of(context).deliveredRejected; break; case 6: orderStatusText = TranslationBase.of(context).canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model, ); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel( deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.pushReplacement( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file diff --git a/lib/pages/landing/replay_page.dart b/lib/pages/landing/replay_page.dart index e3445e4..712d83e 100644 --- a/lib/pages/landing/replay_page.dart +++ b/lib/pages/landing/replay_page.dart @@ -8,10 +8,8 @@ class ReplayPage extends StatelessWidget { Widget build(BuildContext context) { return AppScaffold( body: Center( - child: InkWell(onTap: () {}, - child: Texts('Replay Page')), + child: InkWell(onTap: () {}, child: Texts('Replay Page')), ), ); } } - diff --git a/lib/pages/orders/deliverd_orders_page.dart b/lib/pages/orders/deliverd_orders_page.dart index c9c0fbe..adbd957 100644 --- a/lib/pages/orders/deliverd_orders_page.dart +++ b/lib/pages/orders/deliverd_orders_page.dart @@ -1,11 +1,9 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; -import 'package:driverapp/pages/delivery/information_page.dart'; -import 'package:driverapp/widgets/data_display/circle-container.dart'; +import 'package:driverapp/widgets/order/order_info_card.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; -import 'package:driverapp/widgets/others/rounded_container.dart'; +import 'package:driverapp/widgets/others/network_base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../base/base_view.dart'; @@ -29,123 +27,32 @@ class _DeliverdOrdersPageState extends State { SizedBox( height: 20, ), - Expanded( - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: model.deliverdOrders == null - ? 0 - : model.deliverdOrders.length, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: InkWell( - child: RoundedContainer( - raduis: 25.0, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.120 - : MediaQuery.of(context).size.height * 0.209, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: - EdgeInsets.only(left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * - 0.06 - : MediaQuery.of(context).size.height * - 0.11, - width: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context).size.width * - 0.05 - : MediaQuery.of(context).size.width * - 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) - Expanded( - flex: 5, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.deliverdOrders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle( - fontSize: 18.0, - color: Hexcolor("#343333"), - fontWeight: FontWeight.bold), - ), - ), - Text( - model.deliverdOrders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - Expanded( - child: Text( - model.deliverdOrders[index].orderID - .toString(), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), - ), - ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - child: Text( - model.deliverdOrders[index] - .distanceInKilometers - .toString() + - '\nK.m\naway', - style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), - ), - ), - ), - ], - ), + model.deliverdOrders.length == 0 + ? Text("There's No Orders To Deliver", + style: TextStyle(color: Colors.red)) + : Text(""), + NetworkBaseView( + baseViewModel: model, + child: Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.deliverdOrders == null + ? 0 + : model.deliverdOrders.length, + itemBuilder: (BuildContext context, int index) { + model.deliverdOrders.length == 0 + ? Text("There's No Orders To Deliver", + style: TextStyle(color: Colors.red)) + : Text(""); + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: OrderInfoCard( + order: model.deliverdOrders[index], ), -// onTap: () { -// Navigator.push( -// context, -// MaterialPageRoute( -// builder: (context) => -// InformationPage(model.orders[index]))); -// }, - ), - ); - }, + ); + }, + ), ), ), ], diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index 20d7d31..c1b46e7 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -1,12 +1,10 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; -import 'package:driverapp/widgets/data_display/circle-container.dart'; +import 'package:driverapp/widgets/order/order_info_card.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; -import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; import '../base/base_view.dart'; @@ -30,6 +28,9 @@ class _OrdersListScreenState extends State { SizedBox( height: 20, ), + model.orders.length == 0 + ? Text("There's No Orders To Deliver") + : Text(""), Expanded( child: ListView.builder( shrinkWrap: true, @@ -38,101 +39,8 @@ class _OrdersListScreenState extends State { itemBuilder: (BuildContext context, int index) { return Padding( padding: EdgeInsets.symmetric(horizontal: 12.2), - child: InkWell( - child: RoundedContainer( - raduis: 25.0, - height: MediaQuery.of(context).orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * 0.120 - : MediaQuery.of(context).size.height * 0.209, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: - EdgeInsets.only(left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context).size.height * - 0.06 - : MediaQuery.of(context).size.height * - 0.11, - width: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context).size.width * - 0.05 - : MediaQuery.of(context).size.width * - 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) - Expanded( - flex: 5, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle( - fontSize: 18.0, - color: Hexcolor("#343333"), - fontWeight: FontWeight.bold), - ), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - Expanded( - child: Text( - model.orders[index].orderID.toString(), - style: TextStyle( - fontSize: 18.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), - ), - ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - child: Text( - model.orders[index].distanceInKilometers - .toString() + - '\nK.m\naway', - style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), - ), - ), - ), - ], - ), - ), + child: OrderInfoCard( + order: model.orders[index], onTap: () { Navigator.push( context, diff --git a/lib/pages/setting/setting.dart b/lib/pages/setting/setting_page.dart similarity index 80% rename from lib/pages/setting/setting.dart rename to lib/pages/setting/setting_page.dart index 63c8830..7962ff7 100644 --- a/lib/pages/setting/setting.dart +++ b/lib/pages/setting/setting_page.dart @@ -1,11 +1,12 @@ import 'package:driverapp/core/viewModels/authentication_view_model.dart'; -import 'package:driverapp/pages/authentication/login_page.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; +import '../../root_page.dart'; + class SettingPage extends StatelessWidget { final String driverName; //_authenticationViewModel.user.userName final int driverID; @@ -39,38 +40,40 @@ class SettingPage extends StatelessWidget { maxRadius: 200.0, child: Image.asset( 'assets/images/driver.png', - height: MediaQuery.of(context).size.width * 1 , + height: MediaQuery.of(context).size.width * 1, width: MediaQuery.of(context).size.width * 1, fit: BoxFit.contain, ), ), ), ), - SizedBox(height: MediaQuery.of(context).size.width *0.05,), + SizedBox( + height: MediaQuery.of(context).size.width * 0.05, + ), Container( child: Text( driverName, style: TextStyle( fontSize: 40, fontWeight: FontWeight.w600, - color: Colors.white - ), + color: Colors.white), ), ), - SizedBox(height: MediaQuery.of(context).size.width *0.05,), + SizedBox( + height: MediaQuery.of(context).size.width * 0.05, + ), Container( child: Text( 'ID: ${driverID.toString()}', - style: TextStyle( - fontSize: 20, - color: Colors.white - ), + style: TextStyle(fontSize: 20, color: Colors.white), ), ), ], ), ), - SizedBox(height: MediaQuery.of(context).size.width *0.1,), + SizedBox( + height: MediaQuery.of(context).size.width * 0.1, + ), Container( margin: EdgeInsets.only(left: 35), child: Column( @@ -79,11 +82,9 @@ class SettingPage extends StatelessWidget { InkWell( onTap: () async { await _authenticationViewModel.logout(); - Navigator.push( + Navigator.pushReplacement( context, - MaterialPageRoute( - builder: (context) => LoginPage() - ), + MaterialPageRoute(builder: (context) => RootPage()), ); }, child: Column( @@ -98,23 +99,25 @@ class SettingPage extends StatelessWidget { size: 40, color: Colors.white, ), - SizedBox(width: MediaQuery.of(context).size.width *0.05,), + SizedBox( + width: MediaQuery.of(context).size.width * 0.05, + ), Text( TranslationBase.of(context).logout, style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, - fontSize: 18 - ), + fontSize: 18), ), ], ), ), SizedBox( - height: MediaQuery.of(context).size.width *0.05, + height: MediaQuery.of(context).size.width * 0.05, child: Center( child: Container( - margin: EdgeInsetsDirectional.only(start: 0, end: 30), + margin: + EdgeInsetsDirectional.only(start: 0, end: 30), height: 1.0, color: Colors.white, ), @@ -123,7 +126,9 @@ class SettingPage extends StatelessWidget { ], ), ), - SizedBox(height: MediaQuery.of(context).size.width*0.05,), + SizedBox( + height: MediaQuery.of(context).size.width * 0.05, + ), InkWell( child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -145,8 +150,7 @@ class SettingPage extends StatelessWidget { style: TextStyle( fontWeight: FontWeight.w500, color: Colors.white, - fontSize: 18 - ), + fontSize: 18), ), ], ), @@ -155,13 +159,16 @@ class SettingPage extends StatelessWidget { height: 10.0, child: Center( child: Container( - margin: EdgeInsetsDirectional.only(start: 0, end: 30), + margin: + EdgeInsetsDirectional.only(start: 0, end: 30), height: 1.0, color: Colors.white, ), ), ), - SizedBox(height: MediaQuery.of(context).size.width*0.05,), + SizedBox( + height: MediaQuery.of(context).size.width * 0.05, + ), ], ), ), @@ -173,4 +180,4 @@ class SettingPage extends StatelessWidget { ), ); } -} \ No newline at end of file +} diff --git a/lib/uitl/app_toast.dart b/lib/uitl/app_toast.dart index 8e45e3c..585f601 100644 --- a/lib/uitl/app_toast.dart +++ b/lib/uitl/app_toast.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; class AppToast { - /// show long toast message /// [message] to show for user /// [timeInSeconds] how many second the toast will appear to the user diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index e050210..d8cb682 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -1,5 +1,4 @@ class DateUtil { - /// convert String To Date function /// [date] String we want to convert static DateTime convertStringToDate(String date) { @@ -91,7 +90,6 @@ class DateUtil { } } - /// get data formatted like Apr 26,2020 /// [dateTime] convert DateTime to data formatted static String getMonthDayYearDateFormatted(DateTime dateTime) { @@ -105,7 +103,6 @@ class DateUtil { return ""; } - /// get data formatted like 26/4/2020 /// [dateTime] convert DateTime to data formatted static String getDayMonthYearDateFormatted(DateTime dateTime) { @@ -120,7 +117,6 @@ class DateUtil { return ""; } - static String convertStringToHours(String date) { DateTime stringDate = convertStringToDate(date); DateTime dateTime = DateTime.parse(stringDate.toString()); @@ -128,5 +124,4 @@ class DateUtil { hours = hours.substring(10, 16); return hours; } - } diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index f23f283..183dde2 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -39,13 +39,18 @@ class TranslationBase { String get logout => localizedValues['logout'][locale.languageCode]; String get booking => localizedValues['booking'][locale.languageCode]; + String get enterId => localizedValues['enterId'][locale.languageCode]; + String get pleaseEnterYourID => localizedValues['pleaseEnterYourID'][locale.languageCode]; + String get enterPassword => localizedValues['enterPassword'][locale.languageCode]; + String get pleaseEnterPassword => localizedValues['pleaseEnterPassword'][locale.languageCode]; + String get english => localizedValues['english'][locale.languageCode]; String get arabic => localizedValues['arabic'][locale.languageCode]; @@ -55,6 +60,7 @@ class TranslationBase { String get forgotPassword => localizedValues['forgotPassword'][locale.languageCode]; + String get login => localizedValues['login'][locale.languageCode]; String get haveGreatDay => @@ -103,8 +109,10 @@ class TranslationBase { String get confirmationSent => localizedValues['confirmationSent'][locale.languageCode]; + String get yourDeliveryQue => localizedValues['yourDeliveryQue'][locale.languageCode]; + String get toAddPackageToQue => localizedValues['toAddPackageToQue'][locale.languageCode]; diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart index 6919cff..5fbc743 100644 --- a/lib/uitl/utils.dart +++ b/lib/uitl/utils.dart @@ -49,4 +49,16 @@ class Utils { LocationData currentLocation = await location.getLocation(); return currentLocation; } + + static formatStringToPascalCase(String name) { + List names = name.split(" "); + List formattedNamesList = []; + names.forEach((name) { + name = name.toLowerCase(); + name = name != "" ? name[0].toUpperCase() + name.substring(1) : ""; + + formattedNamesList.add(name); + }); + return formattedNamesList.join(' '); + } } diff --git a/lib/widgets/buttons/button.dart b/lib/widgets/buttons/button.dart index d63babb..6aa32f5 100644 --- a/lib/widgets/buttons/button.dart +++ b/lib/widgets/buttons/button.dart @@ -103,7 +103,7 @@ class _ButtonState extends State