From b0a207008e9c5115cff336e704e63be9b2e6bba8 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 24 Aug 2020 15:39:09 +0300 Subject: [PATCH 01/10] first step qr reader --- lib/config/config.dart | 15 +++++-- .../model/scan_qr/scan_qr_request_model.dart | 44 +++++++++++++++++++ lib/core/service/client/base_app_client.dart | 15 ++++++- lib/core/service/pending_orders_service.dart | 26 +++++++++++ .../viewModels/pending_orders_view_model.dart | 11 +++++ lib/pages/dashboard/dashboard_screen.dart | 32 ++++++++++++-- 6 files changed, 133 insertions(+), 10 deletions(-) create mode 100644 lib/core/model/scan_qr/scan_qr_request_model.dart diff --git a/lib/config/config.dart b/lib/config/config.dart index 2a6f133..679ef20 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,15 +1,22 @@ import 'package:flutter/cupertino.dart'; -const MAX_SMALL_SCREEN = 660; - +/// End points const BASE_URL = 'https://uat.hmgwebservices.com/Services'; - 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'; +/// Body Constant +const CHANNEL = 9; + + +/// design constant +const MAX_SMALL_SCREEN = 660; -const GET_ALL_ORDERS = '/Patients.svc/REST/PatientER_Delivery_GetAllOrder'; class AppGlobal { static BuildContext context; } + + diff --git a/lib/core/model/scan_qr/scan_qr_request_model.dart b/lib/core/model/scan_qr/scan_qr_request_model.dart new file mode 100644 index 0000000..53c0284 --- /dev/null +++ b/lib/core/model/scan_qr/scan_qr_request_model.dart @@ -0,0 +1,44 @@ +class ScanQrRequestModel { + int deliveryOrderID; + int driverID; + int createdBy; + int channel; + int groupID; + String tokenID; + String userID; + String mobileNo; + + ScanQrRequestModel( + {this.deliveryOrderID, + this.driverID, + this.createdBy, + this.channel, + this.groupID, + this.tokenID, + this.userID, + this.mobileNo}); + + ScanQrRequestModel.fromJson(Map json) { + deliveryOrderID = json['DeliveryOrderID']; + driverID = json['DriverID']; + createdBy = json['CreatedBy']; + channel = json['Channel']; + groupID = json['GroupID']; + tokenID = json['TokenID']; + userID = json['UserID']; + mobileNo = json['MobileNo']; + } + + Map toJson() { + final Map data = new Map(); + data['DeliveryOrderID'] = this.deliveryOrderID; + data['DriverID'] = this.driverID; + data['CreatedBy'] = this.createdBy; + data['Channel'] = this.channel; + data['GroupID'] = this.groupID; + data['TokenID'] = this.tokenID; + data['UserID'] = this.userID; + data['MobileNo'] = this.mobileNo; + return data; + } +} diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 5008fe5..e53f646 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -1,6 +1,8 @@ import 'dart:convert'; import 'package:driverapp/config/config.dart'; +import 'package:driverapp/config/shared_pref_kay.dart'; +import 'package:driverapp/core/model/authentication/authenticated_user.dart'; import 'package:driverapp/uitl/app_shared_preferences.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:http/http.dart' as http; @@ -23,8 +25,17 @@ class BaseAppClient { String url = BASE_URL + endPoint; try { - //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); - // String token = await sharedPref.getString(TOKEN); + Map profile = await sharedPref.getObject(USER_PROFILE); + String token = await sharedPref.getString(TOKEN); + if (profile != null) { + AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile); + body['DriverID'] = doctorProfile?.userID; + body['CreatedBy'] = doctorProfile?.userID; + body['UserID'] = doctorProfile?.userID; + body['MobileNo'] = doctorProfile?.mobileNumber; + } + + body['Channel'] = CHANNEL; print("URL : $url"); print("Body : ${json.encode(body)}"); diff --git a/lib/core/service/pending_orders_service.dart b/lib/core/service/pending_orders_service.dart index f4024a3..eb08d8f 100644 --- a/lib/core/service/pending_orders_service.dart +++ b/lib/core/service/pending_orders_service.dart @@ -1,10 +1,12 @@ import 'package:driverapp/config/config.dart'; import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart'; +import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/base_service.dart'; class PendingOrdersService extends BaseService { List _orders = List(); List get orders => _orders; + bool isOrderInserted; PendingOrders _requestGetPendingOrders = PendingOrders( driverID: 1111, @@ -14,9 +16,11 @@ class PendingOrdersService extends BaseService { tokenID: "@dm!n", userID: "1111", mobileNo: "0541710575", + firstName: "dfdfdf" ); Future getPendingOrders() async { + hasError = false; await baseAppClient.post(GET_ALL_ORDERS, onSuccess: (dynamic response, int statusCode) { _orders.clear(); @@ -28,4 +32,26 @@ class PendingOrdersService extends BaseService { super.error = error; }, body: _requestGetPendingOrders.toJson()); } + + + Future insertOrder() async { + ScanQrRequestModel _scanQrRequestModel = ScanQrRequestModel(deliveryOrderID: 129, groupID: 0); + hasError = false; + try { + await baseAppClient.post(SCAN_QR, + onSuccess: (dynamic response, int statusCode) { + isOrderInserted = response["PatientER_Delivery_IsOrderInserted"]; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _scanQrRequestModel.toJson()); + } catch (e) { + + hasError = true; + super.error = error; + throw e; + } + } + + } diff --git a/lib/core/viewModels/pending_orders_view_model.dart b/lib/core/viewModels/pending_orders_view_model.dart index 0f66bba..903ede5 100644 --- a/lib/core/viewModels/pending_orders_view_model.dart +++ b/lib/core/viewModels/pending_orders_view_model.dart @@ -18,4 +18,15 @@ class PendingOrdersViewModel extends BaseViewModel { } else setState(ViewState.Idle); } + + + Future insertOrder() async { + setState(ViewState.ErrorLocal); + await _pendingOrdersService.insertOrder(); + if (_pendingOrdersService.hasError) { + error = _pendingOrdersService.error; + setState(ViewState.ErrorLocal); + } else + setState(ViewState.Idle); + } } diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 94ff6ae..a9e8bef 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -1,5 +1,8 @@ +import 'package:barcode_scan/platform_wrapper.dart'; import 'package:driverapp/config/size_config.dart'; +import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/viewModels/pending_orders_view_model.dart'; +import 'package:driverapp/uitl/utils.dart'; import 'package:flutter/material.dart'; import '../base/base_view.dart'; import 'package:flutter/cupertino.dart'; @@ -238,10 +241,15 @@ class _DashboardScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - 'SCAN', - style: TextStyle( - fontSize: 35.0, color: Colors.white), + InkWell( + onTap:(){ + _scanQrAndGetPatient(context,model); + }, + child: Text( + 'SCAN', + style: TextStyle( + fontSize: 35.0, color: Colors.white), + ), ), Padding( padding: EdgeInsets.only(top: 6.0), @@ -392,4 +400,20 @@ class _DashboardScreenState extends State { ), ); } + + _scanQrAndGetPatient(BuildContext context,PendingOrdersViewModel model) async { + /// When give qr we will change this method to get data + /// var result = await BarcodeScanner.scan(); + /// int patientID = get from qr result + var result = await BarcodeScanner.scan(); + // if (result.rawContent == "") { + List listOfParams = result.rawContent.split(','); + String patientType = "1"; + await model.insertOrder(); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } + + } + } From bf79a6427e47e576cd842f716924a95d71936639 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 24 Aug 2020 15:49:32 +0300 Subject: [PATCH 02/10] refactor orders Concept --- ...rders_service.dart => orders_service.dart} | 26 ++++++++++++------- ...view_model.dart => orders_view_model.dart} | 6 ++--- lib/locator.dart | 8 +++--- lib/pages/dashboard/dashboard_screen.dart | 11 +++++--- lib/pages/orders/pending_orders_page.dart | 6 ++--- 5 files changed, 33 insertions(+), 24 deletions(-) rename lib/core/service/{pending_orders_service.dart => orders_service.dart} (68%) rename lib/core/viewModels/{pending_orders_view_model.dart => orders_view_model.dart} (80%) diff --git a/lib/core/service/pending_orders_service.dart b/lib/core/service/orders_service.dart similarity index 68% rename from lib/core/service/pending_orders_service.dart rename to lib/core/service/orders_service.dart index eb08d8f..a6e8541 100644 --- a/lib/core/service/pending_orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -3,7 +3,7 @@ import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/base_service.dart'; -class PendingOrdersService extends BaseService { +class OrdersService extends BaseService { List _orders = List(); List get orders => _orders; bool isOrderInserted; @@ -21,21 +21,27 @@ class PendingOrdersService extends BaseService { Future getPendingOrders() async { hasError = false; - await baseAppClient.post(GET_ALL_ORDERS, - onSuccess: (dynamic response, int statusCode) { - _orders.clear(); - response['PatientER_Delivery_GetAllOrderList'].forEach((order) { - _orders.add(PendingOrders.fromJson(order)); - }); - }, onFailure: (String error, int statusCode) { + try { + await baseAppClient.post(GET_ALL_ORDERS, + onSuccess: (dynamic response, int statusCode) { + _orders.clear(); + response['PatientER_Delivery_GetAllOrderList'].forEach((order) { + _orders.add(PendingOrders.fromJson(order)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestGetPendingOrders.toJson()); + } catch (e) { hasError = true; super.error = error; - }, body: _requestGetPendingOrders.toJson()); + throw e; + } } Future insertOrder() async { - ScanQrRequestModel _scanQrRequestModel = ScanQrRequestModel(deliveryOrderID: 129, groupID: 0); + ScanQrRequestModel _scanQrRequestModel = ScanQrRequestModel(deliveryOrderID: 1200, groupID: 0); hasError = false; try { await baseAppClient.post(SCAN_QR, diff --git a/lib/core/viewModels/pending_orders_view_model.dart b/lib/core/viewModels/orders_view_model.dart similarity index 80% rename from lib/core/viewModels/pending_orders_view_model.dart rename to lib/core/viewModels/orders_view_model.dart index 903ede5..8ce412b 100644 --- a/lib/core/viewModels/pending_orders_view_model.dart +++ b/lib/core/viewModels/orders_view_model.dart @@ -1,11 +1,11 @@ import 'package:driverapp/core/enum/viewstate.dart'; -import 'package:driverapp/core/service/pending_orders_service.dart'; +import 'package:driverapp/core/service/orders_service.dart'; import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart'; import '../../locator.dart'; import 'base_view_model.dart'; -class PendingOrdersViewModel extends BaseViewModel { - PendingOrdersService _pendingOrdersService = locator(); +class OrdersViewModel extends BaseViewModel { + OrdersService _pendingOrdersService = locator(); List get orders => _pendingOrdersService.orders; diff --git a/lib/locator.dart b/lib/locator.dart index e12abbf..a10e30e 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -2,9 +2,9 @@ import 'package:get_it/get_it.dart'; import 'core/service/authentication_service.dart'; import 'core/service/hospital_service.dart'; -import 'core/service/pending_orders_service.dart'; +import 'core/service/orders_service.dart'; import 'core/viewModels/authentication_view_model.dart'; -import 'core/viewModels/pending_orders_view_model.dart'; +import 'core/viewModels/orders_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; GetIt locator = GetIt.instance; @@ -14,10 +14,10 @@ void setupLocator() { /// Services locator.registerLazySingleton(() => HospitalService()); locator.registerLazySingleton(() => AuthenticationService()); - locator.registerLazySingleton(() => PendingOrdersService()); + locator.registerLazySingleton(() => OrdersService()); /// View Model locator.registerFactory(() => HospitalViewModel()); locator.registerFactory(() => AuthenticationViewModel()); - locator.registerFactory(() => PendingOrdersViewModel()); + locator.registerFactory(() => OrdersViewModel()); } diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index a9e8bef..a6d2b5f 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -1,7 +1,8 @@ import 'package:barcode_scan/platform_wrapper.dart'; import 'package:driverapp/config/size_config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; -import 'package:driverapp/core/viewModels/pending_orders_view_model.dart'; +import 'package:driverapp/core/viewModels/orders_view_model.dart'; +import 'package:driverapp/uitl/app_toast.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:flutter/material.dart'; import '../base/base_view.dart'; @@ -18,10 +19,10 @@ class DashboardScreen extends StatefulWidget { class _DashboardScreenState extends State { @override Widget build(BuildContext context) { - return BaseView( + return BaseView( onModelReady: (model) => model.getPendingOrders(), builder: - (BuildContext context, PendingOrdersViewModel model, Widget child) => + (BuildContext context, OrdersViewModel model, Widget child) => Scaffold( backgroundColor: Color(0xffF4F9FA), body: Column( @@ -401,7 +402,7 @@ class _DashboardScreenState extends State { ); } - _scanQrAndGetPatient(BuildContext context,PendingOrdersViewModel model) async { + _scanQrAndGetPatient(BuildContext context,OrdersViewModel model) async { /// When give qr we will change this method to get data /// var result = await BarcodeScanner.scan(); /// int patientID = get from qr result @@ -412,6 +413,8 @@ class _DashboardScreenState extends State { await model.insertOrder(); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); + }else{ + AppToast.showSuccessToast(message: "Order Added"); } } diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index f7caff9..aa353f8 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:driverapp/config/size_config.dart'; -import 'package:driverapp/core/viewModels/pending_orders_view_model.dart'; +import 'package:driverapp/core/viewModels/orders_view_model.dart'; import '../base/base_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; @@ -13,10 +13,10 @@ class OrdersListScreen extends StatefulWidget { class _OrdersListScreenState extends State { @override Widget build(BuildContext context) { - return BaseView( + return BaseView( onModelReady: (model) => model.getPendingOrders(), builder: - (BuildContext context, PendingOrdersViewModel model, Widget child) => + (BuildContext context, OrdersViewModel model, Widget child) => Scaffold( appBar: AppBar( centerTitle: true, From 4f0bf61fefc106d7bb9c97d1880f0185c6e0336f Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Mon, 24 Aug 2020 15:59:52 +0300 Subject: [PATCH 03/10] Pending Orders list --- lib/pages/dashboard/dashboard_screen.dart | 366 ++++++++++++---------- lib/pages/orders/pending_orders_page.dart | 94 ++++++ 2 files changed, 294 insertions(+), 166 deletions(-) diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 94ff6ae..b9a81c4 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -22,6 +22,8 @@ class _DashboardScreenState extends State { Scaffold( backgroundColor: Color(0xffF4F9FA), body: Column( + // mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, @@ -30,152 +32,171 @@ class _DashboardScreenState extends State { padding: EdgeInsets.all(16.0), child: Column( children: [ - Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Have a great day ,', - style: TextStyle(fontSize: 12.5), - ), - Padding( - padding: EdgeInsets.only(top: 4.5), - child: Text( - 'Driver Name', - style: TextStyle( - fontWeight: FontWeight.w400, fontSize: 25.0), + SafeArea( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Have a great day ,', + style: TextStyle(fontSize: 12.5), ), - ), - ], + Padding( + padding: EdgeInsets.only(top: 4.5), + child: Text( + 'Driver Name', + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 25.0), + ), + ), + ], + ), ), ], ), ), Padding( padding: EdgeInsets.all(16.0), - child: Column( - children: [ - CircleAvatar( - radius: 25.5, - backgroundColor: Color(0xff30B7B9), - child: CircleAvatar( + child: SafeArea( + child: Column( + children: [ + 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, + ), ), ), - ), - ], + ], + ), ), ), ], ), Row( children: [ - Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0), - child: Container( - height: MediaQuery.of(context).size.height * 0.15, - width: MediaQuery.of(context).size.width * 0.43, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.0), - gradient: LinearGradient( - colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(12.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Text( - 'You Have', - style: TextStyle( - color: Colors.white, fontSize: 10.0), - ), - Text( - '5', - style: TextStyle( - color: Colors.white, fontSize: 25.0), - ), - Text( - 'Undelivered \n Packages', - style: TextStyle( - color: Colors.white, fontSize: 10.0), - ) - ], + Expanded( + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.15, + width: MediaQuery.of(context).size.width * 0.44, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + gradient: LinearGradient( + colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + 'You Have', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ), + Text( + '5', + style: TextStyle( + color: Colors.white, fontSize: 25.0), + ), + Expanded( + child: Text( + 'Undelivered \n Packages', + style: TextStyle( + color: Colors.white, + fontSize: 10.0), + ), + ) + ], + ), ), - ), - Padding( - padding: EdgeInsets.all(4.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(right: 9.5), - child: Image.asset( - 'assets/images/closed_box.png', - height: - MediaQuery.of(context).size.height * + Expanded( + child: Padding( + padding: EdgeInsets.all(4.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Image.asset( + 'assets/images/closed_box.png', + height: MediaQuery.of(context) + .size + .height * 0.09, - width: - MediaQuery.of(context).size.width * + width: MediaQuery.of(context) + .size + .width * 0.20, - //fit: BoxFit.cover, - )), - ], - ), - ) - ], + //fit: BoxFit.cover, + )), + ], + ), + ), + ) + ], + ), ), - ), - ) - ], + ) + ], + ), ), Column( children: [ Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0), + padding: EdgeInsets.symmetric(horizontal: 10.0), child: Container( height: MediaQuery.of(context).size.height * 0.15, - width: MediaQuery.of(context).size.width * 0.43, + width: MediaQuery.of(context).size.width * 0.44, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.0), + borderRadius: BorderRadius.circular(15.0), gradient: LinearGradient( colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), ), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Padding( - padding: EdgeInsets.all(12.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Text( - 'You Have', - style: TextStyle( - color: Colors.white, fontSize: 10.0), - ), - Text( - '25', - style: TextStyle( - color: Colors.white, fontSize: 25.0), - ), - Text( - 'unWanted\n Packge', - style: TextStyle( - color: Colors.white, fontSize: 10.0), - ) - ], + Expanded( + child: Padding( + padding: EdgeInsets.all(12.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Text( + 'You Have', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ), + Text( + '25', + style: TextStyle( + color: Colors.white, fontSize: 25.0), + ), + Expanded( + child: Text( + 'unWanted\n Packge', + style: TextStyle( + color: Colors.white, + fontSize: 10.0), + ), + ) + ], + ), ), ), Padding( @@ -186,9 +207,9 @@ class _DashboardScreenState extends State { Image.asset( 'assets/images/open_box.png', height: MediaQuery.of(context).size.height * - 0.11, + 0.10, width: MediaQuery.of(context).size.width * - 0.24, + 0.20, scale: 0.9, fit: BoxFit.cover, ), @@ -204,16 +225,16 @@ class _DashboardScreenState extends State { ], ), Padding( - padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 12.0), + padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0), child: Row( children: [ Expanded( child: InkWell( child: Container( - height: 140, - width: 350, + height: MediaQuery.of(context).size.height * 0.16, + width: MediaQuery.of(context).size.width * 0.50, decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12.0), + borderRadius: BorderRadius.circular(15.0), gradient: LinearGradient(colors: [ Color(0xff48C0BC), Color(0xff17AFB8) @@ -230,7 +251,7 @@ class _DashboardScreenState extends State { MediaQuery.of(context).size.width * 0.25, height: MediaQuery.of(context).size.height * 0.14, - fit: BoxFit.fitHeight, + fit: BoxFit.cover, ) ], ), @@ -266,7 +287,7 @@ class _DashboardScreenState extends State { ), ), Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 1.0), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -313,73 +334,86 @@ class _DashboardScreenState extends State { shrinkWrap: true, scrollDirection: Axis.vertical, itemCount: //model.orders == null ? 0 : model.orders.length, - 2, + 3, itemBuilder: (BuildContext context, int index) { return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.0), + padding: EdgeInsets.symmetric(horizontal: 12.2), child: RoundedContainer( - height: SizeConfig.heightMultiplier * 10.5, + height: MediaQuery.of(context).size.height * 0.108, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(left: 22.0), - child: Image.asset( - 'assets/images/location.png'), - ) - ], - ), - if (model.orders.length != 0) - Column( - crossAxisAlignment: CrossAxisAlignment.start, + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 20.0), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0), - ), - Text( - 'Olaya ST, Behind kfc next to king-\ndom tower 2nd floor n.o 247', - style: TextStyle(color: Colors.black45), + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png'), ) ], ), + ), + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ', + style: + TextStyle(color: Colors.black45), + ), + ) + ], + ), + ), Padding( padding: EdgeInsets.all(10.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - CircleAvatar( - backgroundColor: Colors.black45, - radius: 30.0, + Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 28.9, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 14.0), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), ), ), ), ) ], ), - ) + ), ], ), ), diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index f7caff9..9544fa6 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -25,6 +25,100 @@ class _OrdersListScreenState extends State { 'Your Delivery Que', ), ), + body: Column( + children: [ + Text( + 'Nearest', + style: TextStyle(color: Color(0xff30B7B9), fontSize: 18.0), + ), + ListView.builder( + itemCount: model.orders == null ? 0 : model.orders.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: RoundedContainer( + height: MediaQuery.of(context).size.height * 0.11, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(left: 22.0), + child: + Image.asset('assets/images/location.png'), + ) + ], + ), + ), + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ', + style: TextStyle(color: Colors.black45), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: CircleAvatar( + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), + ), + ), + ), + ) + ], + ), + ), + ], + ), + ), + ); + }), + ], + ), ), ); } From 2dfe4ca1dd5ad63dc85ed9740df4c3c7c8b934f8 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 24 Aug 2020 16:02:32 +0300 Subject: [PATCH 04/10] fix bug --- lib/core/service/orders_service.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index a6e8541..90bb8a7 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -16,7 +16,6 @@ class OrdersService extends BaseService { tokenID: "@dm!n", userID: "1111", mobileNo: "0541710575", - firstName: "dfdfdf" ); Future getPendingOrders() async { From aa2d4e9ab82a67432a92026f029e9ff051c9be19 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 24 Aug 2020 16:40:59 +0300 Subject: [PATCH 05/10] add token --- lib/core/service/client/base_app_client.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index e53f646..dac8406 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -31,6 +31,7 @@ class BaseAppClient { AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile); body['DriverID'] = doctorProfile?.userID; body['CreatedBy'] = doctorProfile?.userID; + body['TokenID'] = token; body['UserID'] = doctorProfile?.userID; body['MobileNo'] = doctorProfile?.mobileNumber; } From 699de4df42630e6a5aa1f929245e7f55ad4be387 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 24 Aug 2020 16:45:36 +0300 Subject: [PATCH 06/10] add token --- lib/core/service/client/base_app_client.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index dac8406..50835f1 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -31,8 +31,8 @@ class BaseAppClient { AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile); body['DriverID'] = doctorProfile?.userID; body['CreatedBy'] = doctorProfile?.userID; + body['UserID'] = '${doctorProfile?.userID}'; body['TokenID'] = token; - body['UserID'] = doctorProfile?.userID; body['MobileNo'] = doctorProfile?.mobileNumber; } From 37eb412b231af22ccb4727eed1792ca0dfcc763f Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 25 Aug 2020 16:20:32 +0300 Subject: [PATCH 07/10] use AppScaffold rather than of scaffold --- lib/pages/authentication/login_page.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/pages/authentication/login_page.dart b/lib/pages/authentication/login_page.dart index 9d37032..b43dfbb 100644 --- a/lib/pages/authentication/login_page.dart +++ b/lib/pages/authentication/login_page.dart @@ -11,6 +11,7 @@ import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/buttons/secondary_button.dart'; import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:driverapp/widgets/input/text_field.dart'; +import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -28,7 +29,8 @@ class LoginPage extends StatelessWidget { return AnimatedSwitcher( duration: Duration(microseconds: 350), child: BaseView( - builder: (_, model, widget) => Scaffold( + builder: (_, model, widget) => AppScaffold( + isShowAppBar: false, body: SingleChildScrollView( child: Center( child: Column( From dcedc989e18641426a093b5c8fd70ad459b99ef2 Mon Sep 17 00:00:00 2001 From: hussam al-habibeh Date: Wed, 26 Aug 2020 08:19:53 +0300 Subject: [PATCH 08/10] updates --- lib/config/localized_values.dart | 24 ++- .../pending_orders/pending_orders_model.dart | 26 +-- lib/pages/dashboard/dashboard_screen.dart | 177 ++++++++++-------- lib/pages/orders/pending_orders_page.dart | 168 +++++++++-------- lib/uitl/translations_delegate_base.dart | 18 +- 5 files changed, 234 insertions(+), 179 deletions(-) diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5cfdfbe..2d54262 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -11,7 +11,7 @@ const Map> localizedValues = { 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, - 'booking':{'en': 'Booking','ar':'حجز'}, + 'booking': {'en': 'Booking', 'ar': 'حجز'}, 'enterId': {'en': 'User Name', 'ar': 'اسم المستخدم'}, 'pleaseEnterYourID': { 'en': 'Please enter your ', @@ -26,13 +26,19 @@ const Map> localizedValues = { 'en': 'Please insert username and password to login', 'ar': 'الرجاء إدخال اسم المستخدم وكلمة المرور لتسجيل الدخول' }, - 'forgotPassword': { - 'en': 'Forgot Password?', - 'ar': 'هل نسيت كلمة المرور ؟' + 'forgotPassword': {'en': 'Forgot Password?', 'ar': 'هل نسيت كلمة المرور ؟'}, + 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, + 'haveGreatDay': {'en': 'have a great day ,', 'ar': 'أتمنى لك يوما جميلا '}, + 'youHave': {'en': 'You Have', 'ar': 'يوجد لديك'}, + 'deliveredPackages': {'en': 'Delivered Packages', 'ar': 'الطرود المسلمة'}, + 'seeAll': {'en': 'See All', 'ar': 'اظهار الكل'}, + 'nearestDropOffs': {'en': 'nearest drop-offs', 'ar': 'أقرب نقطة إنزال'}, + 'undeliveredPackages': { + 'en': 'Undelivered Packages', + 'ar': 'الطرود التي لم يتم تسليمها' }, - 'login': { - 'en': 'Login', - 'ar': 'تسجيل الدخول' - } - + 'away': {'en': 'away', 'ar': 'بعيدا'}, + 'scan': {'en': 'Scan', 'ar': 'مسح'}, + 'scan2': {'en': 'away', 'ar': 'بعيدا'}, + 'scanDb': {'en': 'away', 'ar': 'بعيدا'}, }; diff --git a/lib/core/model/pending_orders/pending_orders_model.dart b/lib/core/model/pending_orders/pending_orders_model.dart index c2ef9e3..b6dfc6e 100644 --- a/lib/core/model/pending_orders/pending_orders_model.dart +++ b/lib/core/model/pending_orders/pending_orders_model.dart @@ -11,18 +11,21 @@ class PendingOrders { String firstName; String lastName; String mobileNumber; + int distanceInKilometers; - PendingOrders( - {this.driverID, - this.searchKey, - this.pageSize, - this.pageIndex, - this.tokenID, - this.userID, - this.mobileNo, - this.firstName, - this.lastName, - this.mobileNumber}); + PendingOrders({ + this.driverID, + this.searchKey, + this.pageSize, + this.pageIndex, + this.tokenID, + this.userID, + this.mobileNo, + this.firstName, + this.lastName, + this.mobileNumber, + this.distanceInKilometers, + }); PendingOrders.fromJson(Map json) { driverID = json['DriverID']; @@ -35,6 +38,7 @@ class PendingOrders { firstName = json['FirstName']; lastName = json['LastName']; mobileNumber = json['MobileNumber']; + distanceInKilometers = json['DistanceInKilometers']; } Map toJson() { diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index b9a81c4..5a00639 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -6,6 +6,7 @@ import 'package:flutter/cupertino.dart'; import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; +import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; class DashboardScreen extends StatefulWidget { @override @@ -15,12 +16,12 @@ class DashboardScreen extends StatefulWidget { class _DashboardScreenState extends State { @override Widget build(BuildContext context) { + int orderId; return BaseView( onModelReady: (model) => model.getPendingOrders(), builder: (BuildContext context, PendingOrdersViewModel model, Widget child) => - Scaffold( - backgroundColor: Color(0xffF4F9FA), + AppScaffold( body: Column( // mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -210,7 +211,6 @@ class _DashboardScreenState extends State { 0.10, width: MediaQuery.of(context).size.width * 0.20, - scale: 0.9, fit: BoxFit.cover, ), ], @@ -328,98 +328,113 @@ class _DashboardScreenState extends State { ], ), ), - Column( - children: [ - ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: //model.orders == null ? 0 : model.orders.length, - 3, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: RoundedContainer( - height: MediaQuery.of(context).size.height * 0.108, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(left: 22.0), - child: Image.asset( - 'assets/images/location.png'), - ) - ], - ), - ), - if (model.orders.length != 0) + Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: //model.orders == null ? 0 : model.orders.length, + 3, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: InkWell( + child: RoundedContainer( + height: MediaQuery.of(context).size.height * 0.108, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Expanded( - flex: 3, + flex: 1, child: Column( - crossAxisAlignment: - CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0), - ), - Expanded( - child: Text( - 'Olaya ST, Behind kfc next to king ', - style: - TextStyle(color: Colors.black45), + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png', + height: MediaQuery.of(context) + .size + .height * + 0.10, + width: MediaQuery.of(context) + .size + .width * + 0.09, ), ) ], ), ), - Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ,Olaya ST ', + style: TextStyle( + color: Colors.black45), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: FontWeight.w600), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: + const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: + FontWeight.w600), + ), ), ), ), - ), - ) - ], + ) + ], + ), ), - ), - ], + ], + ), ), - ), - ); - }) - ], + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + )), + ); + }), ) ], ), diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index 9544fa6..1060bf0 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -27,96 +27,112 @@ class _OrdersListScreenState extends State { ), body: Column( children: [ - Text( - 'Nearest', - style: TextStyle(color: Color(0xff30B7B9), fontSize: 18.0), + Center( + child: Text( + 'Nearest', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 18.0, + fontWeight: FontWeight.w400), + ), ), - ListView.builder( - itemCount: model.orders == null ? 0 : model.orders.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: RoundedContainer( - height: MediaQuery.of(context).size.height * 0.11, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Padding( - padding: EdgeInsets.only(left: 22.0), - child: - Image.asset('assets/images/location.png'), - ) - ], - ), - ), - if (model.orders.length != 0) + Expanded( + child: ListView.builder( + itemCount: model.orders == null ? 0 : model.orders.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: RoundedContainer( + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.107 + : MediaQuery.of(context).size.height * 0.18, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ Expanded( - flex: 3, + flex: 1, child: Column( - crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, children: [ - Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0), - ), - Expanded( - child: Text( - 'Olaya ST, Behind kfc next to king ', - style: TextStyle(color: Colors.black45), + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png', + height: + MediaQuery.of(context).size.height * + 0.101, ), - ) + ), ], ), ), - Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, + if (model.orders.length != 0) + Expanded( + flex: 3, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ', + style: TextStyle(color: Colors.black45), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: FontWeight.w600), + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), + ), ), ), ), - ), - ) - ], + ) + ], + ), ), - ), - ], + ], + ), ), - ), - ); - }), + ); + }), + ), ], ), ), diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 400292e..b497c1a 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -49,9 +49,23 @@ class TranslationBase { String get english => localizedValues['english'][locale.languageCode]; String get arabic => localizedValues['arabic'][locale.languageCode]; - String get enterCredentialsMsg => localizedValues['enterCredentialsMsg'][locale.languageCode]; - String get forgotPassword => localizedValues['forgotPassword'][locale.languageCode]; + String get enterCredentialsMsg => + localizedValues['enterCredentialsMsg'][locale.languageCode]; + String get forgotPassword => + localizedValues['forgotPassword'][locale.languageCode]; String get login => localizedValues['login'][locale.languageCode]; + String get haveGreatDay => + localizedValues['haveGreatDay'][locale.languageCode]; + String get youHave => localizedValues['youHave'][locale.languageCode]; + String get deliveredPackages => + localizedValues['deliveredPackages'][locale.languageCode]; + String get seeAll => localizedValues['seeAll'][locale.languageCode]; + String get nearestDropOffs => + localizedValues['nearestDropOffs'][locale.languageCode]; + String get undeliveredPackages => + localizedValues['undeliveredPackages'][locale.languageCode]; + String get away => localizedValues['away'][locale.languageCode]; + String get scan => localizedValues['scan'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { From f1813b0443c10e2309687975aad3ba203b96a344 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 26 Aug 2020 10:08:14 +0300 Subject: [PATCH 09/10] fix login issue --- lib/core/service/client/base_app_client.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core/service/client/base_app_client.dart b/lib/core/service/client/base_app_client.dart index 50835f1..d7c6e5e 100644 --- a/lib/core/service/client/base_app_client.dart +++ b/lib/core/service/client/base_app_client.dart @@ -34,9 +34,10 @@ class BaseAppClient { body['UserID'] = '${doctorProfile?.userID}'; body['TokenID'] = token; body['MobileNo'] = doctorProfile?.mobileNumber; + body['Channel'] = CHANNEL; } - body['Channel'] = CHANNEL; + print("URL : $url"); print("Body : ${json.encode(body)}"); From 7029cc2dd6be3e3eac4b79eb309c35353bd255c6 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Wed, 26 Aug 2020 11:08:54 +0300 Subject: [PATCH 10/10] fix issues after merge --- lib/pages/dashboard/dashboard_screen.dart | 131 +++++++++++----------- 1 file changed, 64 insertions(+), 67 deletions(-) diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 8a3cff3..360618f 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -1,20 +1,16 @@ import 'package:barcode_scan/platform_wrapper.dart'; -import 'package:driverapp/config/size_config.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; -import 'package:driverapp/uitl/app_toast.dart'; -import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; import 'package:driverapp/pages/orders/pending_orders_page.dart'; +import 'package:driverapp/uitl/app_toast.dart'; +import 'package:driverapp/uitl/utils.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 '../base/base_view.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:driverapp/app-icons/driver_app_icons.dart'; -import 'package:driverapp/widgets/others/rounded_container.dart'; -import 'package:driverapp/pages/orders/pending_orders_page.dart'; -import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; class DashboardScreen extends StatefulWidget { @override @@ -385,70 +381,71 @@ class _DashboardScreenState extends State { child: Column( crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0), - ), - Expanded( + children: [ + Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Expanded( + child: Text( + 'Olaya ST, Behind kfc next to king ,Olaya ST ', + style: TextStyle(color: Colors.black45), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Expanded( + child: CircleAvatar( + backgroundColor: Colors.black45, + radius: 28.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 25.1, + child: Padding( + padding: const EdgeInsets.all(8.0), child: Text( - 'Olaya ST, Behind kfc next to king ,Olaya ST ', + '3 K.m \n away', style: TextStyle( - color: Colors.black45), - ), - ) - ], - ), - ), - Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Colors.black45, - radius: 28.0, - child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.1, - child: Padding( - padding: - const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 12.5, - fontWeight: - FontWeight.w600), - ), - ), + color: Color(0xff30B7B9), + fontSize: 12.5, + fontWeight: FontWeight.w600), ), ), - ) - ], - ), - ), - ], + ), + ), + ) + ], + ), ), - ), - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrdersListScreen()), - )), - ); - }), + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InformationPage(model.orders[index]))); + }, + ), + ); + }, + ), ) ], ),