diff --git a/lib/core/service/orders_service.dart b/lib/core/service/orders_service.dart index d1f4f22..d95c7fe 100644 --- a/lib/core/service/orders_service.dart +++ b/lib/core/service/orders_service.dart @@ -5,12 +5,15 @@ import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/model/scan_qr/scan_qr_request_model.dart'; import 'package:driverapp/core/service/base_service.dart'; +import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; class OrdersService extends BaseService { List _orders = List(); List _nextOrdersList = List(); + List _deliverdOrderList = List(); List get orders => _orders; + List get deliverdOrderList => _deliverdOrderList; List get nextOrdersList => _nextOrdersList; bool isOrderInserted; @@ -21,6 +24,13 @@ class OrdersService extends BaseService { pageSize: 0, pageIndex: 0, ); + DeliverdOrderModel _requestGetDeliverdOrders = DeliverdOrderModel( + searchKey: "", + pageSize: 0, + pageIndex: 0, + latitude: "24.640000", + longitude: "46.753000", + ); Future getPendingOrders() async { hasError = false; @@ -96,4 +106,25 @@ class OrdersService extends BaseService { throw e; } } + + Future getDeliverdList() async { + hasError = false; + try { + await baseAppClient.post(GET_ALL_DELIVERD_ORDER, + onSuccess: (dynamic response, int statusCode) { + _deliverdOrderList.clear(); + response['PatientER_Delivery_GetAllDeliverdOrderList'].forEach((order) { + _deliverdOrderList.add(DeliverdOrderModel.fromJson(order)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestGetPendingOrders.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 83a5549..4d825b4 100644 --- a/lib/core/viewModels/orders_view_model.dart +++ b/lib/core/viewModels/orders_view_model.dart @@ -1,4 +1,5 @@ import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart'; import 'package:driverapp/core/model/orders/next_order_request_model.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; @@ -13,6 +14,9 @@ class OrdersViewModel extends BaseViewModel { List get orders => _ordersService.orders; + List get deliverdOrders => + _ordersService.deliverdOrderList; + List get nextOrdersList => _ordersService.nextOrdersList; bool isBottomSheetAppear = false; @@ -26,6 +30,16 @@ class OrdersViewModel extends BaseViewModel { setState(ViewState.Idle); } + Future getDeliverdOrders() async { + setState(ViewState.Busy); + await _ordersService.getDeliverdList(); + if (_ordersService.hasError) { + error = _ordersService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } + Future insertOrder(ScanQrRequestModel _scanQrRequestModel) async { setState(ViewState.ErrorLocal); await _ordersService.insertOrder(_scanQrRequestModel); diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index c7068d8..8b9d0a5 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -17,6 +17,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; import 'package:provider/provider.dart'; +import 'package:driverapp/pages/orders/deliverd_orders_page.dart'; import '../base/base_view.dart'; @@ -49,564 +50,572 @@ class _DashboardScreenState extends State { body: Container( height: MediaQuery.of(context).size.height * .95, child: ListView( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Padding( - padding: EdgeInsets.all(16.0), - child: Column( - children: [ - SafeArea( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - TranslationBase.of(context).haveGreatDay, - style: TextStyle( - fontSize: 14.5, - color: Color(0xff636363), - fontWeight: FontWeight.w300), - ), - Padding( - padding: EdgeInsets.only(top: 4.5), - child: Text( - _authenticationViewModel.user.userName, - style: TextStyle( - fontWeight: FontWeight.w400, - fontSize: 25.0), - ), - ), - ], - ), - ), - ], - ), - ), - Padding( - padding: EdgeInsets.all(16.0), - child: SafeArea( + Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + SafeArea( child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - CircleAvatar( - radius: 25.5, - backgroundColor: Color(0xff30B7B9), - child: CircleAvatar( - backgroundColor: Color(0xff30B7B9), - maxRadius: 26.0, - child: Image.asset( - 'assets/images/driver.png', - fit: BoxFit.contain, - ), + Text( + TranslationBase.of(context).haveGreatDay, + style: TextStyle( + fontSize: 14.5, + color: Color(0xff636363), + fontWeight: FontWeight.w300), + ), + Padding( + padding: EdgeInsets.only(top: 4.5), + child: Text( + _authenticationViewModel.user.userName, + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: 25.0), ), ), ], ), ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(16.0), + child: SafeArea( + child: Column( + children: [ + CircleAvatar( + radius: 25.5, + backgroundColor: Color(0xff30B7B9), + child: CircleAvatar( + backgroundColor: Color(0xff30B7B9), + maxRadius: 26.0, + child: Image.asset( + 'assets/images/driver.png', + fit: BoxFit.contain, + ), + ), + ), + ], ), - ], + ), ), - Row( - children: [ - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Container( - height: MediaQuery.of(context).orientation == + ], + ), + Row( + children: [ + Expanded( + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.16 - : MediaQuery.of(context).size.height * 0.30, - 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: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(2.0), - child: Column( - mainAxisAlignment: + ? MediaQuery.of(context).size.height * 0.16 + : MediaQuery.of(context).size.height * 0.30, + 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: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(2.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Text( - TranslationBase.of(context).youHave, - style: TextStyle( - color: Colors.white, - fontSize: MediaQuery.of(context) - .orientation == + children: [ + Text( + TranslationBase.of(context).youHave, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * + ? SizeConfig.textMultiplier * 2.2 - : SizeConfig.textMultiplier * + : SizeConfig.textMultiplier * 1.3, - ), - ), - Text( - '5', - style: TextStyle( - color: Colors.white, - fontSize: + ), + ), + Text( + '5', + style: TextStyle( + color: Colors.white, + fontSize: SizeConfig.textMultiplier * 3.0), - ), - Text( - TranslationBase.of(context) - .undeliveredPackages, - style: TextStyle( - color: Colors.white, - fontSize: MediaQuery.of(context) - .orientation == + ), + Text( + TranslationBase.of(context) + .undeliveredPackages, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * + ? SizeConfig.textMultiplier * 2.2 - : SizeConfig.textMultiplier * + : SizeConfig.textMultiplier * 1.3, - ), - ) - ], - ), - ), + ), + ) + ], ), - Padding( - padding: EdgeInsets.only(right: 9.5), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), - child: Column( - mainAxisAlignment: + ), + ), + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Container( + width: 100, + height: 100, + decoration: BoxDecoration( + color: Colors.white10, + shape: BoxShape.circle), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/closed_box.png', - height: MediaQuery.of(context) - .orientation == + children: [ + Image.asset( + 'assets/images/closed_box.png', + height: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .height * + ? MediaQuery.of(context) + .size + .height * 0.09 - : MediaQuery.of(context) - .size - .height * + : MediaQuery.of(context) + .size + .height * 0.20, - width: MediaQuery.of(context) + width: MediaQuery.of(context) .size .width * - 0.20, - scale: 0.9, - fit: BoxFit.contain, - ), - ], + 0.20, + scale: 0.9, + fit: BoxFit.contain, ), - ), + ], ), - ], + ), ), - ), - ) - ], - ), - ), - Expanded( - child: Column( - children: [ - Padding( - padding: EdgeInsets.symmetric(horizontal: 10.0), - child: Container( - height: MediaQuery.of(context).orientation == + ], + ), + ), + ) + ], + ), + ), + Expanded( + child: Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 10.0), + child: Container( + height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.16 - : MediaQuery.of(context).size.height * 0.30, - width: MediaQuery.of(context).size.width * 0.45, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient(colors: [ - Color(0xff17AFB8), - Color(0xff49C1BC) - ]), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - child: Padding( - padding: EdgeInsets.all(2.0), - child: Column( - mainAxisAlignment: - MainAxisAlignment.spaceEvenly, - children: [ - Text( - TranslationBase.of(context).youHave, - style: TextStyle( - color: Colors.white, - fontSize: MediaQuery.of(context) - .orientation == - Orientation.landscape - ? SizeConfig.textMultiplier * - 2.2 - : SizeConfig.textMultiplier * - 1.3, - ), - ), - Text( - '5', - style: TextStyle( - color: Colors.white, - fontSize: - SizeConfig.textMultiplier * - 3.0), + ? MediaQuery.of(context).size.height * 0.16 + : MediaQuery.of(context).size.height * 0.30, + width: MediaQuery.of(context).size.width * 0.45, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + gradient: LinearGradient(colors: [ + Color(0xff17AFB8), + Color(0xff49C1BC) + ]), + ), + child: InkWell( + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + DeliverdOrdersPage())), + child: Row( + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Padding( + padding: EdgeInsets.all(2.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Text( + TranslationBase.of(context).youHave, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == + Orientation.landscape + ? SizeConfig.textMultiplier * + 2.2 + : SizeConfig.textMultiplier * + 1.3, ), - Text( - TranslationBase.of(context) - .undeliveredPackages, - style: TextStyle( + ), + Text( + '5', + style: TextStyle( color: Colors.white, - fontSize: MediaQuery.of(context) - .orientation == - Orientation.landscape - ? SizeConfig.textMultiplier * - 2.2 - : SizeConfig.textMultiplier * - 1.3, - ), - ) - ], - ), + fontSize: + SizeConfig.textMultiplier * + 3.0), + ), + Text( + TranslationBase.of(context) + .undeliveredPackages, + style: TextStyle( + color: Colors.white, + fontSize: MediaQuery.of(context) + .orientation == + Orientation.landscape + ? SizeConfig.textMultiplier * + 2.2 + : SizeConfig.textMultiplier * + 1.3, + ), + ) + ], ), ), - Padding( - padding: EdgeInsets.only(right: 9.5), - child: Container( - width: 100, - height: 100, - decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/opend_box.png', - height: MediaQuery.of(context) - .orientation == - Orientation.portrait - ? MediaQuery.of(context) - .size - .height * - 0.09 - : MediaQuery.of(context) - .size - .height * - 0.20, - width: MediaQuery.of(context) - .size - .width * - 0.20, - scale: 0.9, - fit: BoxFit.contain, - ), - ], - ), + ), + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Container( + width: 100, + height: 100, + decoration: BoxDecoration( + color: Colors.white10, + shape: BoxShape.circle), + child: Column( + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/opend_box.png', + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context) + .size + .height * + 0.09 + : MediaQuery.of(context) + .size + .height * + 0.20, + width: MediaQuery.of(context) + .size + .width * + 0.20, + scale: 0.9, + fit: BoxFit.contain, + ), + ], ), ), - ], - ), + ), + ], ), - ) - ], - ), - ), - ], + ), + ), + ) + ], + ), ), - Padding( - padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0), - child: Row( - children: [ - Expanded( - child: InkWell( - child: Container( - height: MediaQuery.of(context).orientation == + ], + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 15.0), + child: Row( + children: [ + Expanded( + child: InkWell( + child: Container( + height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.18 - : MediaQuery.of(context).size.height * 0.30, - width: MediaQuery.of(context).size.width * 0.50, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(15.0), - gradient: LinearGradient( - colors: [ - Hexcolor("#45B7AE"), - Hexcolor("#119FA9") - ], - ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.30, + width: MediaQuery.of(context).size.width * 0.50, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15.0), + gradient: LinearGradient( + colors: [ + Hexcolor("#45B7AE"), + Hexcolor("#119FA9") + ], + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - 'assets/images/qr_code.png', - width: MediaQuery.of(context).size.width * - 0.26, - height: MediaQuery.of(context) - .orientation == + Image.asset( + 'assets/images/qr_code.png', + width: MediaQuery.of(context).size.width * + 0.26, + height: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * + ? MediaQuery.of(context).size.height * 0.14 - : MediaQuery.of(context).size.height * + : MediaQuery.of(context).size.height * 0.28, - fit: BoxFit.contain, - ) - ], - ), - Column( - mainAxisAlignment: + fit: BoxFit.contain, + ) + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - InkWell( - onTap: () { - _scanQrAndGetPatient(context, model); - }, - child: Padding( - padding: EdgeInsets.only(top: 8.0), - child: Text( - TranslationBase.of(context).scan, - style: TextStyle( - fontSize: MediaQuery.of(context) - .orientation == + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + InkWell( + onTap: () { + _scanQrAndGetPatient(context, model); + }, + child: Padding( + padding: EdgeInsets.only(top: 8.0), + child: Text( + TranslationBase.of(context).scan, + style: TextStyle( + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * 6.0 - : SizeConfig.textMultiplier * 4.0, - color: Colors.white, - fontWeight: FontWeight.w400, - ), - ), + ? SizeConfig.textMultiplier * 6.0 + : SizeConfig.textMultiplier * 4.0, + color: Colors.white, + fontWeight: FontWeight.w400, ), ), - Padding( - padding: EdgeInsets.only(top: 0.0), - child: Text( - TranslationBase.of(context) - .toAddPackageToQue, - style: TextStyle( - fontSize: MediaQuery.of(context) - .orientation == + ), + ), + Padding( + padding: EdgeInsets.only(top: 0.0), + child: Text( + TranslationBase.of(context) + .toAddPackageToQue, + style: TextStyle( + fontSize: MediaQuery.of(context) + .orientation == Orientation.landscape - ? SizeConfig.textMultiplier * 3.0 - : SizeConfig.textMultiplier * 2.0, - color: Colors.white, - letterSpacing: 0.2, - wordSpacing: 0.5, - ), - ), + ? SizeConfig.textMultiplier * 3.0 + : SizeConfig.textMultiplier * 2.0, + color: Colors.white, + letterSpacing: 0.2, + wordSpacing: 0.5, ), - ], - ) + ), + ), ], - ), - ), + ) + ], ), - ) - ], - ), - ), - NetworkBaseView( - baseViewModel: model, - child: Padding( - padding: + ), + ), + ) + ], + ), + ), + NetworkBaseView( + baseViewModel: model, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( children: [ - Column( - children: [ - Text( - TranslationBase.of(context).nearestDropOffs, - style: TextStyle( - fontSize: 21.0, - fontWeight: FontWeight.w400, - ), - ), - ], + Text( + TranslationBase.of(context).nearestDropOffs, + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w400, + ), ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( - child: Row( - children: [ - Text( - TranslationBase.of(context).seeAll, - style: TextStyle( - fontSize: 14.5, color: Color(0xff42B6AD)), - ), - Icon( - Icons.arrow_forward_ios, - size: 15.0, - color: Color(0xff42B6AD), - ), - ], + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + child: Row( + children: [ + Text( + TranslationBase.of(context).seeAll, + style: TextStyle( + fontSize: 14.5, color: Color(0xff42B6AD)), ), - onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrdersListScreen()), + Icon( + Icons.arrow_forward_ios, + size: 15.0, + color: Color(0xff42B6AD), ), - ), - ], + ], + ), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + ), ), ], ), - ), + ], ), - NetworkBaseView( - baseViewModel: model, - child: Expanded( - child: ListView.builder( - shrinkWrap: true, - scrollDirection: Axis.vertical, - itemCount: model.orders == null - ? 0 - : model.orders.length < 3 ? model.orders.length : 3, - itemBuilder: (BuildContext context, int index) { - return Padding( - padding: EdgeInsets.symmetric(horizontal: 12.2), - child: InkWell( - child: RoundedContainer( - raduis: 25.0, - height: MediaQuery.of(context).orientation == + ), + ), + NetworkBaseView( + baseViewModel: model, + child: Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.orders == null + ? 0 + : model.orders.length < 3 ? model.orders.length : 3, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: InkWell( + child: RoundedContainer( + raduis: 25.0, + height: MediaQuery.of(context).orientation == Orientation.portrait - ? MediaQuery.of(context).size.height * 0.120 - : MediaQuery.of(context).size.height * 0.209, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Expanded( - flex: 1, - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: + ? MediaQuery.of(context).size.height * 0.120 + : MediaQuery.of(context).size.height * 0.209, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only( - left: 15.0, top: 14.0), - child: Image.asset( - 'assets/images/location.png', - height: MediaQuery.of(context) - .orientation == + children: [ + Padding( + padding: EdgeInsets.only( + left: 15.0, top: 14.0), + child: Image.asset( + 'assets/images/location.png', + height: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .height * + ? MediaQuery.of(context) + .size + .height * 0.06 - : MediaQuery.of(context) - .size - .height * + : MediaQuery.of(context) + .size + .height * 0.11, - width: MediaQuery.of(context) - .orientation == + width: MediaQuery.of(context) + .orientation == Orientation.portrait - ? MediaQuery.of(context) - .size - .width * + ? MediaQuery.of(context) + .size + .width * 0.05 - : MediaQuery.of(context) - .size - .width * + : MediaQuery.of(context) + .size + .width * 0.09, - ), - ) - ], - ), - ), - if (model.orders.length != 0) - Expanded( - flex: 5, - child: Column( - crossAxisAlignment: + ), + ) + ], + ), + ), + if (model.orders.length != 0) + Expanded( + flex: 5, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Padding( - padding: EdgeInsets.only(top: 20.0), - child: Text( - model.orders[index].firstName + - ' ' + - model.orders[index].lastName, - style: TextStyle(fontSize: 18.0), - ), - ), - Text( - model.orders[index].mobileNumber, - style: TextStyle( - color: Color(0xff30B7B9), - fontWeight: FontWeight.w600, - fontSize: 15.0, - ), - ), - Expanded( - child: Text( - model.orders[index].orderID - .toString(), - style: TextStyle( - fontSize: 15.0, - fontWeight: FontWeight.w400, - letterSpacing: 8.0), - ), - ), - ], + children: [ + Padding( + padding: EdgeInsets.only(top: 20.0), + child: Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 18.0), + ), ), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: CircleContainer( - borderWidth: 0.9, - child: Text( - model.orders[index].distanceInKilometers - .toString() + - ' K.m\naway', + Text( + model.orders[index].mobileNumber, style: TextStyle( - color: Color(0xff42B6AD), - fontWeight: FontWeight.w800, - fontStyle: FontStyle.normal), + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0, + ), ), - ), + Expanded( + child: Text( + model.orders[index].orderID + .toString(), + style: TextStyle( + fontSize: 15.0, + fontWeight: FontWeight.w400, + letterSpacing: 8.0), + ), + ), + ], ), - ], + ), + Padding( + padding: EdgeInsets.all(8.0), + child: CircleContainer( + borderWidth: 0.9, + child: Text( + model.orders[index].distanceInKilometers + .toString() + + ' K.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.normal), + ), + ), ), - ), - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - InformationPage(model.orders[index]))); - }, + ], ), - ); - }, - ), - ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InformationPage(model.orders[index]))); + }, + ), + ); + }, ), - ], + ), ), - ), + ], ), + ), + ), ); } diff --git a/lib/pages/orders/deliverd_orders_page.dart b/lib/pages/orders/deliverd_orders_page.dart new file mode 100644 index 0000000..db4119f --- /dev/null +++ b/lib/pages/orders/deliverd_orders_page.dart @@ -0,0 +1,147 @@ +import 'package:driverapp/core/viewModels/orders_view_model.dart'; +import 'package:driverapp/pages/delivery/information_page.dart'; +import 'package:driverapp/uitl/translations_delegate_base.dart'; +import 'package:driverapp/widgets/data_display/circle-container.dart'; +import 'package:driverapp/widgets/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'; + +class DeliverdOrdersPage extends StatefulWidget { + @override + _DeliverdOrdersPageState createState() => _DeliverdOrdersPageState(); +} + +class _DeliverdOrdersPageState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getDeliverdOrders(), + builder: (BuildContext context, OrdersViewModel model, Widget child) => + AppScaffold( + isShowAppBar: true, + appBarTitle: TranslationBase.of(context).yourDeliveryQue, + titleColor: Colors.black, + body: Column( + children: [ + Expanded( + child: ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: model.orders == null ? 0 : model.orders.length, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.2), + child: InkWell( + child: RoundedContainer( + raduis: 25.0, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.120 + : MediaQuery.of(context).size.height * 0.209, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + flex: 1, + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: + EdgeInsets.only(left: 15.0, top: 14.0), + child: Image.asset( + 'assets/images/location.png', + height: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * + 0.06 + : MediaQuery.of(context).size.height * + 0.11, + width: MediaQuery.of(context) + .orientation == + Orientation.portrait + ? MediaQuery.of(context).size.width * + 0.05 + : MediaQuery.of(context).size.width * + 0.09, + ), + ) + ], + ), + ), + if (model.orders.length != 0) + Expanded( + flex: 5, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(top: 20.0), + child: Text( + model.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( + model.orders[index].orderID.toString(), + style: TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.w400, + letterSpacing: 8.0), + ), + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(8.0), + child: CircleContainer( + borderWidth: 0.8, + child: Text( + model.orders[index].distanceInKilometers + .toString() + + ' K.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.normal), + ), + ), + ), + ], + ), + ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + InformationPage(model.orders[index]))); + }, + ), + ); + }, + ), + ), + ], + ), + ), + ); + } +}