diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..9702d5e --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,179 @@ +PODS: + - barcode_scan (0.0.1): + - Flutter + - MTBBarcodeScanner + - SwiftProtobuf + - connectivity (0.0.1): + - Flutter + - Reachability + - connectivity_for_web (0.1.0): + - Flutter + - connectivity_macos (0.0.1): + - Flutter + - device_info (0.0.1): + - Flutter + - Flutter (1.0.0) + - flutter_flexible_toast (0.0.1): + - Flutter + - flutter_local_notifications (0.0.1): + - Flutter + - flutter_plugin_android_lifecycle (0.0.1): + - Flutter + - hexcolor (0.0.1): + - Flutter + - image_cropper (0.0.3): + - Flutter + - TOCropViewController (~> 2.5.4) + - image_picker (0.0.1): + - Flutter + - local_auth (0.0.1): + - Flutter + - map_launcher (0.0.1): + - Flutter + - maps_launcher (0.0.1): + - Flutter + - MTBBarcodeScanner (5.0.11) + - path_provider_linux (0.0.1): + - Flutter + - "permission_handler (5.0.1+1)": + - Flutter + - Reachability (3.2) + - shared_preferences (0.0.1): + - Flutter + - shared_preferences_linux (0.0.1): + - Flutter + - shared_preferences_macos (0.0.1): + - Flutter + - shared_preferences_web (0.0.1): + - Flutter + - SwiftProtobuf (1.11.0) + - TOCropViewController (2.5.4) + - url_launcher (0.0.1): + - Flutter + - url_launcher_linux (0.0.1): + - Flutter + - url_launcher_macos (0.0.1): + - Flutter + - url_launcher_web (0.0.1): + - Flutter + +DEPENDENCIES: + - barcode_scan (from `.symlinks/plugins/barcode_scan/ios`) + - connectivity (from `.symlinks/plugins/connectivity/ios`) + - connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`) + - connectivity_macos (from `.symlinks/plugins/connectivity_macos/ios`) + - device_info (from `.symlinks/plugins/device_info/ios`) + - Flutter (from `Flutter`) + - flutter_flexible_toast (from `.symlinks/plugins/flutter_flexible_toast/ios`) + - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) + - flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`) + - hexcolor (from `.symlinks/plugins/hexcolor/ios`) + - image_cropper (from `.symlinks/plugins/image_cropper/ios`) + - image_picker (from `.symlinks/plugins/image_picker/ios`) + - local_auth (from `.symlinks/plugins/local_auth/ios`) + - map_launcher (from `.symlinks/plugins/map_launcher/ios`) + - maps_launcher (from `.symlinks/plugins/maps_launcher/ios`) + - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) + - permission_handler (from `.symlinks/plugins/permission_handler/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) + - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) + - shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`) + - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + - url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`) + - url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`) + - url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`) + +SPEC REPOS: + trunk: + - MTBBarcodeScanner + - Reachability + - SwiftProtobuf + - TOCropViewController + +EXTERNAL SOURCES: + barcode_scan: + :path: ".symlinks/plugins/barcode_scan/ios" + connectivity: + :path: ".symlinks/plugins/connectivity/ios" + connectivity_for_web: + :path: ".symlinks/plugins/connectivity_for_web/ios" + connectivity_macos: + :path: ".symlinks/plugins/connectivity_macos/ios" + device_info: + :path: ".symlinks/plugins/device_info/ios" + Flutter: + :path: Flutter + flutter_flexible_toast: + :path: ".symlinks/plugins/flutter_flexible_toast/ios" + flutter_local_notifications: + :path: ".symlinks/plugins/flutter_local_notifications/ios" + flutter_plugin_android_lifecycle: + :path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios" + hexcolor: + :path: ".symlinks/plugins/hexcolor/ios" + image_cropper: + :path: ".symlinks/plugins/image_cropper/ios" + image_picker: + :path: ".symlinks/plugins/image_picker/ios" + local_auth: + :path: ".symlinks/plugins/local_auth/ios" + map_launcher: + :path: ".symlinks/plugins/map_launcher/ios" + maps_launcher: + :path: ".symlinks/plugins/maps_launcher/ios" + path_provider_linux: + :path: ".symlinks/plugins/path_provider_linux/ios" + permission_handler: + :path: ".symlinks/plugins/permission_handler/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_linux: + :path: ".symlinks/plugins/shared_preferences_linux/ios" + shared_preferences_macos: + :path: ".symlinks/plugins/shared_preferences_macos/ios" + shared_preferences_web: + :path: ".symlinks/plugins/shared_preferences_web/ios" + url_launcher: + :path: ".symlinks/plugins/url_launcher/ios" + url_launcher_linux: + :path: ".symlinks/plugins/url_launcher_linux/ios" + url_launcher_macos: + :path: ".symlinks/plugins/url_launcher_macos/ios" + url_launcher_web: + :path: ".symlinks/plugins/url_launcher_web/ios" + +SPEC CHECKSUMS: + barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479 + connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 + connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b + connectivity_macos: e2e9731b6b22dda39eb1b128f6969d574460e191 + device_info: d7d233b645a32c40dfdc212de5cf646ca482f175 + Flutter: 0e3d915762c693b495b44d77113d4970485de6ec + flutter_flexible_toast: 0547e740cae0c33bb7c51bcd931233f4584e1143 + flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186 + flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35 + hexcolor: fdfb9c4258ad96e949c2dbcdf790a62194b8aa89 + image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4 + image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09 + local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd + map_launcher: e325db1261d029ff33e08e03baccffe09593ffea + maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92 + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 + permission_handler: eac8e15b4a1a3fba55b761d19f3f4e6b005d15b6 + Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 + shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d + shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 + shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087 + shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9 + SwiftProtobuf: f889fe5772f90ef7d7b8aac352d1fddf39650713 + TOCropViewController: 2a1ae1242600b1f2d996fd91a5268b2309a33b5c + url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef + url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0 + url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313 + url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c + +PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a + +COCOAPODS: 1.9.3 diff --git a/lib/config/config.dart b/lib/config/config.dart index 679ef20..b86765f 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -6,15 +6,15 @@ const GET_PROJECT = '/Lists.svc/REST/GetProject'; const LOGIN = "/Authentication.svc/REST/CheckDriverAuthentication"; const GET_ALL_ORDERS = '/Patients.svc/REST/PatientER_Delivery_GetAllOrder'; const SCAN_QR = '/Patients.svc/REST/PatientER_Delivery_OrderInsert'; +const UPDATE_ORDER_STATUS = + '/Patients.svc/REST/PatientER_Delivery_UpdateOrderStatus'; /// Body Constant const CHANNEL = 9; - /// design constant const MAX_SMALL_SCREEN = 660; - class AppGlobal { static BuildContext context; } diff --git a/lib/core/model/pending_orders/pending_orders_req_model.dart b/lib/core/model/orders/pending_orders_req_model.dart similarity index 100% rename from lib/core/model/pending_orders/pending_orders_req_model.dart rename to lib/core/model/orders/pending_orders_req_model.dart diff --git a/lib/core/model/pending_orders/pending_orders_res_model.dart b/lib/core/model/orders/pending_orders_res_model.dart similarity index 100% rename from lib/core/model/pending_orders/pending_orders_res_model.dart rename to lib/core/model/orders/pending_orders_res_model.dart diff --git a/lib/core/model/orders/update_order_status_request_model.dart b/lib/core/model/orders/update_order_status_request_model.dart new file mode 100644 index 0000000..d7cc743 --- /dev/null +++ b/lib/core/model/orders/update_order_status_request_model.dart @@ -0,0 +1,44 @@ +class UpdateOrderStatusRequestModel { + int deliveryOrderID; + int deliveryOrderStatus; + String rejectionReason; + String cancleReason; + int changeBy; + String tokenID; + String userID; + String mobileNo; + + UpdateOrderStatusRequestModel( + {this.deliveryOrderID, + this.deliveryOrderStatus, + this.rejectionReason, + this.cancleReason, + this.changeBy, + this.tokenID, + this.userID, + this.mobileNo}); + + UpdateOrderStatusRequestModel.fromJson(Map json) { + deliveryOrderID = json['DeliveryOrderID']; + deliveryOrderStatus = json['DeliveryOrderStatus']; + rejectionReason = json['RejectionReason']; + cancleReason = json['CancleReason']; + changeBy = json['ChangeBy']; + tokenID = json['TokenID']; + userID = json['UserID']; + mobileNo = json['MobileNo']; + } + + Map toJson() { + final Map data = new Map(); + data['DeliveryOrderID'] = this.deliveryOrderID; + data['DeliveryOrderStatus'] = this.deliveryOrderStatus; + data['RejectionReason'] = this.rejectionReason; + data['CancleReason'] = this.cancleReason; + data['ChangeBy'] = this.changeBy; + data['TokenID'] = this.tokenID; + data['UserID'] = this.userID; + data['MobileNo'] = this.mobileNo; + return data; + } +} diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index cf513e0..5af7599 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -1,6 +1,7 @@ import 'package:driverapp/config/config.dart'; -import 'package:driverapp/core/model/pending_orders/pending_orders_req_model.dart'; -import 'package:driverapp/core/model/pending_orders/pending_orders_res_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'; @@ -9,15 +10,12 @@ class OrdersService extends BaseService { List get orders => _orders; bool isOrderInserted; + bool isOrderStatusUpdated; PendingOrders _requestGetPendingOrders = PendingOrders( - driverID: 1111, searchKey: "", pageSize: 0, pageIndex: 0, - tokenID: "@dm!n", - userID: "1111", - mobileNo: "0541710575", ); Future getPendingOrders() async { @@ -59,4 +57,22 @@ class OrdersService extends BaseService { throw e; } } + + Future updateOrderStatus( + UpdateOrderStatusRequestModel updateOrderStatusRequestModel) async { + hasError = false; + try { + await baseAppClient.post(UPDATE_ORDER_STATUS, + onSuccess: (dynamic response, int statusCode) { + isOrderStatusUpdated = response["PatientER_Delivery_IsOrderUpdated"]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: updateOrderStatusRequestModel.toJson()); + } catch (e) { + hasError = true; + super.error = error; + throw e; + } + } } diff --git a/lib/core/viewModels/orders_view_model.dart b/lib/core/viewModels/orders_view_model.dart index 8e25b6c..b526f16 100644 --- a/lib/core/viewModels/orders_view_model.dart +++ b/lib/core/viewModels/orders_view_model.dart @@ -1,20 +1,22 @@ import 'package:driverapp/core/enum/viewstate.dart'; -import 'package:driverapp/core/model/pending_orders/pending_orders_res_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/service/orders_service.dart'; import '../../locator.dart'; import 'base_view_model.dart'; class OrdersViewModel extends BaseViewModel { - OrdersService _pendingOrdersService = locator(); + OrdersService _OrdersService = locator(); - List get orders => _pendingOrdersService.orders; + List get orders => _OrdersService.orders; + bool isBottomSheetAppear = false; Future getPendingOrders() async { setState(ViewState.Busy); - await _pendingOrdersService.getPendingOrders(); - if (_pendingOrdersService.hasError) { - error = _pendingOrdersService.error; + await _OrdersService.getPendingOrders(); + if (_OrdersService.hasError) { + error = _OrdersService.error; setState(ViewState.Error); } else setState(ViewState.Idle); @@ -22,11 +24,33 @@ class OrdersViewModel extends BaseViewModel { Future insertOrder() async { setState(ViewState.ErrorLocal); - await _pendingOrdersService.insertOrder(); - if (_pendingOrdersService.hasError) { - error = _pendingOrdersService.error; + await _OrdersService.insertOrder(); + if (_OrdersService.hasError) { + error = _OrdersService.error; setState(ViewState.ErrorLocal); } else setState(ViewState.Idle); } + + + Future updateOrderStatus( + UpdateOrderStatusRequestModel updateOrderStatusRequestModel) async { + setState(ViewState.BusyLocal); + await _OrdersService.updateOrderStatus(updateOrderStatusRequestModel); + if (_OrdersService.hasError) { + error = _OrdersService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } + + showBottomSheet() { + isBottomSheetAppear = true; + setState(ViewState.Idle); + } + + hideBottomSheet() { + isBottomSheetAppear = false; + setState(ViewState.Idle); + } } diff --git a/lib/main.dart b/lib/main.dart index 84e790c..d181377 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -64,7 +64,7 @@ class MyApp extends StatelessWidget { backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Color.fromRGBO(69, 183, 174, 1.0), + primaryColor: Color(0xff3ABBBA), cursorColor: Color.fromRGBO(78, 62, 253, 1.0), iconTheme: IconThemeData(), dividerColor: Color.fromRGBO(112, 112, 112, 1.0), diff --git a/lib/pages/authentication/login_page.dart b/lib/pages/authentication/login_page.dart index 9be0280..657a9cd 100644 --- a/lib/pages/authentication/login_page.dart +++ b/lib/pages/authentication/login_page.dart @@ -237,7 +237,7 @@ class LoginPage extends StatelessWidget { ), SizedBox( height: 30, - ) + ), ], )) ], diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart index 8fab34f..e56656c 100644 --- a/lib/pages/delivery/delivery_confirmed_page.dart +++ b/lib/pages/delivery/delivery_confirmed_page.dart @@ -1,3 +1,4 @@ +import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/delivery/customer_brief_card.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -15,7 +16,7 @@ class DeliveryConfirmedPage extends StatelessWidget { return AppScaffold( body: SafeArea( child: Container( - color: Color(0xff41bdbb), + color: Theme.of(context).primaryColor, child: ListView( children: [ Column( @@ -39,21 +40,11 @@ class DeliveryConfirmedPage extends StatelessWidget { child: Column( children: [ Container( - width: MediaQuery - .of(context) - .size - .width, - //300, - height: MediaQuery - .of(context) - .size - .width * 0.7, - //300, + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width * 0.7, padding: EdgeInsets.only( - top: MediaQuery - .of(context) - .size - .width * 0.2, //60, + top: MediaQuery.of(context).size.width * + 0.2, ), decoration: BoxDecoration( color: Colors.white10, @@ -66,17 +57,14 @@ class DeliveryConfirmedPage extends StatelessWidget { size: 60, ), Text( - TranslationBase - .of(context) - .deliveryInfo, + TranslationBase.of(context).deliveryInfo, style: TextStyle( color: Colors.white, fontSize: 20, fontWeight: FontWeight.bold), ), Text( - TranslationBase - .of(context) + TranslationBase.of(context) .confirmationSent, style: TextStyle( color: Colors.white, @@ -94,25 +82,13 @@ class DeliveryConfirmedPage extends StatelessWidget { Stack( children: [ Container( - width: MediaQuery - .of(context) - .size - .width, //400, - height: MediaQuery - .of(context) - .size - .width, //500, + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, ), Container( - width: MediaQuery - .of(context) - .size - .width, + width: MediaQuery.of(context).size.width, //800, - height: MediaQuery - .of(context) - .size - .width * 1.2, + height: MediaQuery.of(context).size.width * 1.2, //440, margin: EdgeInsets.only(top: 60), decoration: BoxDecoration( @@ -127,10 +103,8 @@ class DeliveryConfirmedPage extends StatelessWidget { children: [ Container( margin: EdgeInsets.only( - bottom: MediaQuery - .of(context) - .size - .width * 0.15, //50 + bottom: MediaQuery.of(context).size.width * + 0.15, //50 ), child: Column( children: [ @@ -139,52 +113,29 @@ class DeliveryConfirmedPage extends StatelessWidget { color: Colors.orangeAccent, shape: RoundedRectangleBorder( borderRadius: - new BorderRadius.circular(10.0), + new BorderRadius.circular(10.0), + ), + label: Text( + TranslationBase.of(context).addNoteBtn, + style: TextStyle(color: Colors.white), ), icon: Icon( Icons.mode_edit, color: Colors.white, ), - label: Text( - TranslationBase - .of(context) - .addNoteBtn, - style: TextStyle(color: Colors.white), - ), onPressed: () {}, ), SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.1, //20, + height: MediaQuery.of(context).size.width * + 0.1, //20, ), - FlatButton( - color: Color(0xff41bdbb), - padding: - EdgeInsets.only( - right: MediaQuery - .of(context) - .size - .width * 0.25, //100, - left: MediaQuery - .of(context) - .size - .width * 0.25, //100 - ), - shape: RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(18.0), - side: - BorderSide(color: Color(0xff41bdbb)), - ), - child: Text( - TranslationBase - .of(context) + Container( + margin: EdgeInsets.all(10), + child: SecondaryButton( + label: TranslationBase.of(context) .nextDelivery, - style: TextStyle(color: Colors.white), + onTap: () {}, ), - onPressed: () {}, ), ], ), @@ -192,14 +143,13 @@ class DeliveryConfirmedPage extends StatelessWidget { ], ), ), - CustomerBrief( + CustomerBriefCard( itemId: item.patientID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, - deliveryTime: item.orderCreatedOn - ), + deliveryTime: item.orderCreatedOn), ], ), ], diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index 41436af..96fdfe7 100644 --- a/lib/pages/delivery/information_page.dart +++ b/lib/pages/delivery/information_page.dart @@ -1,342 +1 @@ -import 'package:driverapp/app-icons/driver_app_icons.dart'; -import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; -import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; -import 'package:driverapp/widgets/bottom_sheet/custom_bottom_sheet.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 '../../uitl/translations_delegate_base.dart'; -import '../../widgets/others/app_scaffold_widget.dart'; - -class InformationPage extends StatelessWidget { - final dynamic item; - - InformationPage(this.item); - - @override - Widget build(BuildContext context) { - return AppScaffold( - body: Container( - color: Color(0xff41bdbb), - child: Container( - color: Color(0xff41bdbb), - child: ListView( - children: [ - Column( - children: [ - Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only( - right: MediaQuery - .of(context) - .size - .width * 0.15, //50 - ), - child: IconButton( - color: Colors.white, - iconSize: 50, - icon: Icon(Icons.arrow_back), - onPressed: () { - Navigator.pop(context); - }, - ), - ), - Container( - child: Text( - TranslationBase - .of(context) - .deliveryInfo, - style: TextStyle( - color: Colors.white, - fontSize: 20, - ), - ), - ), - ], - ), - Stack( - children: [ - Container( - width: MediaQuery - .of(context) - .size - .width, //400, - height: MediaQuery - .of(context) - .size - .width, //500, - ), - Container( - width: MediaQuery - .of(context) - .size - .width * 1, - //800, - height: MediaQuery - .of(context) - .size - .width * 1.5, - //700, - margin: EdgeInsets.only( - top: MediaQuery - .of(context) - .size - .width * 0.3, //100 - ), - decoration: BoxDecoration( - color: Colors.white, - 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.2, //170, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - delivery_info_button( - btnColor: Color(0xfff44336), - btnIcon: Icon( - Icons.near_me, - size: 30, - color: Colors.white, - ), - btnName: TranslationBase - .of(context) - .location, - btnFunction: () {}, - ), - delivery_info_button( - btnColor: Colors.green, - btnIcon: Icon( - Icons.whatshot, - size: 30, - color: Colors.white, - ), - btnName: 'Whatsapp', - btnFunction: () {}, - ), - delivery_info_button( - btnColor: Colors.orangeAccent, - btnIcon: Icon( - Icons.mail_outline, - size: 30, - color: Colors.white, - ), - btnName: TranslationBase - .of(context) - .sms, - btnFunction: () {}, - ), - delivery_info_button( - btnColor: Color(0xff41bdbb), - btnIcon: Icon( - Icons.phone, - size: 30, - color: Colors.white, - ), - btnName: TranslationBase - .of(context) - .call, - btnFunction: () {}, - ), - ], - ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.1, //30, - ), - Container( - margin: EdgeInsets.only( - left: MediaQuery - .of(context) - .size - .width * 0.05, //15, - right: MediaQuery - .of(context) - .size - .width * 0.02, //15 - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase - .of(context) - .packageContent, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 20), - ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.05, //20, - ), - Column( - children: List.generate( - item.itemsQuantitiesList.length, - (index) { - return package_content( - packageName: item - .itemsQuantitiesList[index] - .itemName - .toString(), - //'Panadol Extra 50 tablet', - packageCount: item - .itemsQuantitiesList[index] - .quantity - .toString(), - ); - }), - ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.01, //10, - ), - ], - ), - ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.1, //30, - ), - FlatButton( - color: Color(0xff41bdbb), - padding: EdgeInsets.only( - right: MediaQuery - .of(context) - .size - .width * 0.3, //100, - left: MediaQuery - .of(context) - .size - .width * 0.3, //100, - bottom: MediaQuery - .of(context) - .size - .width * 0.035, //15, - top: MediaQuery - .of(context) - .size - .width * 0.035, //15 - ), - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(30.0), - side: BorderSide(color: Color(0xff41bdbb)), - ), - child: Text( - TranslationBase - .of(context) - .clientReached, - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 16), - ), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - DeliveryConfirmedPage(item))); - }, - ), - ], - ), - ), - CustomerBrief( - itemId: item.patientID, - customerFirstName: item.firstName, - customerLastName: item.lastName, - mobileNo: item.mobileNumber, - totalPayment: item.amount, - deliveryTime: item.orderCreatedOn), - ], - ), - ], - ), - ], - ), - ), - ), - bottomSheet: CustomBottomSheet( - children: [ - SizedBox( - height: 10, - ), - Center( - child: Texts( - 'Select Action', - color: Colors.black, - fontSize: 22, - ), - ), - SizedBox( - height: 10, - ), - FractionallySizedBox( - widthFactor: 0.9, - child: Column( - children: [ - SizedBox( - height: 3, - child: Container( - color: Hexcolor("#D5D5D5"), - ), - ), - SizedBox( - height: 6, - ), - ActionSheetButton( - label: "Delivered", icon: DriverApp.deliverd_icon), - SizedBox( - height: 6, - ), - ActionSheetButton( - label: "Not Available", - icon: DriverApp.not_available, - ), - SizedBox( - height: 6, - ), - ActionSheetButton( - label: "Rejected", - icon: DriverApp.rejected_icon, - ), - SizedBox( - height: 6, - ), - ActionSheetButton( - label: "Not Reachable", - icon: DriverApp.not_reachable_icon, - ), - ], - ), - ), - ], - ), - ); - } -} +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/bottom_sheet/custom_bottom_sheet.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 '../../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) { return BaseView( builder: (_, model, w) => AppScaffold( isShowAppBar: true, appBarColor: Theme.of(context).primaryColor, arrowColor: Colors.white, titleColor: Colors.white, appBarTitle: TranslationBase.of(context).deliveryInfo, body: Container( color: Theme.of(context).primaryColor, child: Container( color: Theme.of(context).primaryColor, 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).size.width * 1.5, margin: EdgeInsets.only( top: MediaQuery.of(context).size.width * 0.23, ), 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.53, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Color(0xffED1C24), btnIcon: Icon( Icons.near_me, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).location, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Color(0xFF61B260), btnIcon: Icon( Icons.whatshot, size: 30, color: Colors.white, ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Color(0xFFFCB657), btnIcon: Icon( Icons.mail_outline, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Theme.of(context).primaryColor, btnIcon: Icon( Icons.phone, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).call, btnFunction: () {}, ), ], ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), 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.length, (index) { return packageContent( packageName: item .itemsQuantitiesList[index] .itemName .toString(), packageCount: item .itemsQuantitiesList[index] .quantity .toString(), ); }), ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.01, ), ], ), ), SizedBox( height: MediaQuery.of(context).size.width * 0.1, ), Container( margin: EdgeInsets.all(10), child: SecondaryButton( label: TranslationBase.of(context).clientReached, onTap: () { model.showBottomSheet(); }, ), ), ], ), ), CustomerBriefCard( itemId: item.patientID, customerFirstName: item.firstName, customerLastName: item.lastName, mobileNo: item.mobileNumber, totalPayment: item.amount, deliveryTime: item.orderCreatedOn), ], ), ], ), ], ), ), ), bottomSheet: !model.isBottomSheetAppear ? Container( width: 0, height: 0, ) : CustomBottomSheet(children: [ SizedBox( height: 10, ), Center( child: Texts( 'Select Action', color: Colors.black, fontSize: 22, ), ), SizedBox( height: 10, ), FractionallySizedBox( widthFactor: 0.9, child: Column( children: [ SizedBox( height: 3, child: Container( color: Hexcolor("#D5D5D5"), ), ), SizedBox( height: 6, ), ActionSheetButton( label: "Delivered", icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 1, model); }, ), SizedBox( height: 6, ), ActionSheetButton( label: "Not Available", icon: DriverApp.not_available, onTap: () { selectAction(context, 2, model); }, ), SizedBox( height: 6, ), ActionSheetButton( label: "Rejected", icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox( height: 6, ), ActionSheetButton( label: "Not Reachable", icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 4, model); }, ), ], )), ]), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 1: orderStatusText = "Delivered"; break; case 2: orderStatusText = "Not Available"; break; case 3: orderStatusText = "Rejected"; break; case 4: orderStatusText = "Not Reachable"; 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.push( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file diff --git a/lib/widgets/bottom_sheet/action_sheet_button.dart b/lib/widgets/bottom_sheet/action_sheet_button.dart index 51c91f7..23d7e98 100644 --- a/lib/widgets/bottom_sheet/action_sheet_button.dart +++ b/lib/widgets/bottom_sheet/action_sheet_button.dart @@ -1,3 +1,4 @@ +import 'package:driverapp/config/size_config.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -13,7 +14,9 @@ class ActionSheetButton extends StatelessWidget { return InkWell( onTap: onTap, child: Container( - height: MediaQuery.of(context).size.height * 0.07, + height: SizeConfig.isMobilePortrait + ? MediaQuery.of(context).size.height * 0.07 + : MediaQuery.of(context).size.height * 0.14, decoration: BoxDecoration( border: Border.all(color: Colors.blue), borderRadius: BorderRadius.circular(6), diff --git a/lib/widgets/data_display/dialog/custom_dialog.dart b/lib/widgets/data_display/dialog/custom_dialog.dart new file mode 100644 index 0000000..88ad467 --- /dev/null +++ b/lib/widgets/data_display/dialog/custom_dialog.dart @@ -0,0 +1,93 @@ +import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/viewModels/orders_view_model.dart'; +import 'package:driverapp/pages/base/base_view.dart'; +import 'package:driverapp/widgets/buttons/secondary_button.dart'; +import 'package:flutter/material.dart'; + +import '../text.dart'; + +class CustomDialog extends StatelessWidget { +// final Widget child; + final String orderStatusText; + final Function callService; + final OrdersViewModel model; + + CustomDialog({this.orderStatusText, this.callService, this.model}); + + @override + Widget build(BuildContext context) { + return BaseView( + builder: (_, model, w) => Center( + child: Container( + height: MediaQuery.of(context).size.height * 0.35, + width: MediaQuery.of(context).size.width * 0.95, + child: Dialog( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15), + ), + elevation: 0.0, + backgroundColor: Colors.white, + child: Container( + child: Column( + children: [ + SizedBox( + height: 30, + ), + Text( + 'you have selected:', + style: TextStyle( + fontWeight: FontWeight.w500, + color: Colors.black, + fontSize: 15.0), + ), + Text( + orderStatusText, + style: TextStyle( + color: Theme.of(context).primaryColor, fontSize: 18.0), + ), + SizedBox( + height: 40, + ), + FractionallySizedBox( + widthFactor: 0.8, + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Texts( + 'Are you sure?', + color: Colors.black, + fontSize: 20, + ), + SizedBox( + height: 10, + ), + SecondaryButton( + label: "Confirm", + loading: model.state == ViewState.BusyLocal, + onTap: () { + model.setState(ViewState.BusyLocal); + callService(); + }, + ), + SizedBox( + height: 10, + ), + SecondaryButton( + label: "Cancel", + onTap: () { + model.hideBottomSheet(); + Navigator.of(context).pop(); + }, + ), + ], + ), + ) + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/delivery/customer_brief_card.dart b/lib/widgets/delivery/customer_brief_card.dart index 8ba11ea..05bb430 100644 --- a/lib/widgets/delivery/customer_brief_card.dart +++ b/lib/widgets/delivery/customer_brief_card.dart @@ -3,7 +3,7 @@ import 'package:flutter/material.dart'; import '../../uitl/date_uitl.dart'; import '../../uitl/translations_delegate_base.dart'; -class CustomerBrief extends StatelessWidget { +class CustomerBriefCard extends StatelessWidget { final String itemId; final String time; final String customerFirstName; @@ -15,7 +15,7 @@ class CustomerBrief extends StatelessWidget { final double longitude; final double latitude; - CustomerBrief( + CustomerBriefCard( {this.itemId, this.time, this.customerFirstName, @@ -32,14 +32,14 @@ class CustomerBrief extends StatelessWidget { return Center( child: Container( width: 350, - height: 300, + height: 270, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only( - topLeft: Radius.circular(45), - topRight: Radius.circular(45), - bottomRight: Radius.circular(45), - bottomLeft: Radius.circular(45)), + topLeft: Radius.circular(30), + topRight: Radius.circular(30), + bottomRight: Radius.circular(30), + bottomLeft: Radius.circular(30)), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.3), @@ -50,37 +50,35 @@ class CustomerBrief extends StatelessWidget { ], ), child: Container( - padding: EdgeInsets.only(left: 30, top: 10, right: 30), + padding: EdgeInsets.only(left: 30, top: 20, right: 30), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( - child: Text('ID: ${itemId}'), + flex: 3, + child: Text( + 'ID: ${itemId}', + style: TextStyle(color: Color(0xFFADACAD)), + ), ), Expanded( - child: Container( - margin: EdgeInsets.only(left: 83), - width: 10, - height: 60, - decoration: BoxDecoration( - border: Border.all( - width: 2.0, - color: Color(0xff41bdbb), - ), - borderRadius: BorderRadius.only( - topLeft: Radius.circular(45), - topRight: Radius.circular(45), - bottomRight: Radius.circular(45), - bottomLeft: Radius.circular(45), - ), - ), - child: Container( - margin: EdgeInsets.only(left: 12, top: 10), - child: Text( - '3 min away', - style: TextStyle(color: Color(0xff41bdbb)), + child: CircleAvatar( + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.only(left: 3), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), ), ), ), @@ -89,24 +87,32 @@ class CustomerBrief extends StatelessWidget { ), Text( '${customerFirstName} ${customerLastName}', - style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900), ), Text( mobileNo, - style: TextStyle(color: Colors.lightBlue), + style: TextStyle(color: Color(0xFF50BDC5)), ), SizedBox( height: 10, ), Text( - 'Olaya street, behind KFC resturant, next to kingdom towers 2ND floor ofice 277', - style: TextStyle(fontWeight: FontWeight.w600), + 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', + style: TextStyle( + color: Color(0xFF464748), fontWeight: FontWeight.w600), ), SizedBox( height: 10, ), - Divider( - color: Colors.grey, + SizedBox( + height: 10.0, + child: Center( + child: Container( + margin: EdgeInsetsDirectional.only(start: 1.0, end: 1.0), + height: 1.0, + color: Colors.grey, + ), + ), ), SizedBox( height: 20, @@ -115,15 +121,22 @@ class CustomerBrief extends StatelessWidget { children: [ Row( children: [ - Text( - TranslationBase.of(context).payment, + Expanded( + flex: 2, + child: Text( + TranslationBase.of(context).payment, + textAlign: TextAlign.start, + ), ), SizedBox( width: 170, ), - Text( - totalPayment.toString(), //'SAR 70', - style: TextStyle(fontWeight: FontWeight.bold), + Expanded( + child: Text( + totalPayment.toString(), + textAlign: TextAlign.end, + style: TextStyle(fontWeight: FontWeight.w600), + ), ), ], ), @@ -132,19 +145,19 @@ class CustomerBrief extends StatelessWidget { ), Row( children: [ - Text( - TranslationBase.of(context).delivryTime, + Expanded( + flex: 1, + child: Text( + TranslationBase.of(context).delivryTime, + textAlign: TextAlign.start, + ), ), - SizedBox( - width: 50, + Expanded( + child: Text( + '${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}', + textAlign: TextAlign.end, + style: TextStyle(fontWeight: FontWeight.w600)), ), - Text( - '${DateUtil.getMonthDayYearDateFormatted( - DateUtil.convertStringToDate( - deliveryTime))} ${(DateUtil - .convertStringToHours(deliveryTime))}', - //'05 Aug 20 - 10:00 AM', - style: TextStyle(fontWeight: FontWeight.bold)), ], ) ], diff --git a/lib/widgets/delivery/delivery_action_button.dart b/lib/widgets/delivery/delivery_action_button.dart index 4e05314..3571218 100644 --- a/lib/widgets/delivery/delivery_action_button.dart +++ b/lib/widgets/delivery/delivery_action_button.dart @@ -1,12 +1,12 @@ import 'package:flutter/material.dart'; -class delivery_info_button extends StatelessWidget { +class DeliveryInfoButton extends StatelessWidget { final Color btnColor; final Icon btnIcon; final Function btnFunction; final String btnName; - delivery_info_button( + DeliveryInfoButton( {this.btnColor, this.btnIcon, this.btnFunction, this.btnName}); @override Widget build(BuildContext context) { @@ -16,8 +16,14 @@ class delivery_info_button extends StatelessWidget { child: Column( children: [ SizedBox( - height: 50, - width: 60, // specific value + height: MediaQuery + .of(context) + .size + .width * 0.14, + width: MediaQuery + .of(context) + .size + .width * 0.165, // specific value child: RaisedButton( padding: EdgeInsets.only(left: 2), color: btnColor, @@ -29,7 +35,10 @@ class delivery_info_button extends StatelessWidget { ), ), SizedBox( - height: 10, + height: MediaQuery + .of(context) + .size + .width * 0.05, ), Text( btnName, diff --git a/lib/widgets/delivery/package_content.dart b/lib/widgets/delivery/package_content.dart index 0958b98..46f93aa 100644 --- a/lib/widgets/delivery/package_content.dart +++ b/lib/widgets/delivery/package_content.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; -class package_content extends StatelessWidget { +class packageContent extends StatelessWidget { final String packageName; final String packageCount; - package_content({this.packageName, this.packageCount}); + packageContent({this.packageName, this.packageCount}); @override Widget build(BuildContext context) { diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index f4d69a0..98a990c 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -15,6 +15,7 @@ class AppScaffold extends StatelessWidget { final Widget bottomSheet; final Color titleColor; final Color arrowColor; + final Color appBarColor; AppScaffold( {@required this.body, @@ -24,14 +25,16 @@ class AppScaffold extends StatelessWidget { this.baseViewModel, this.bottomSheet, this.titleColor, - this.arrowColor}); + this.arrowColor, + this.appBarColor, + }); @override Widget build(BuildContext context) { AppGlobal.context = context; return SafeArea( child: Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, + backgroundColor: appBarColor ?? Theme.of(context).scaffoldBackgroundColor, appBar: isShowAppBar ? AppBar( elevation: 0,