diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index d653800..cec7cfb 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -28,42 +28,39 @@ const Map> localizedValues = { }, 'forgotPassword': {'en': 'Forgot Password?', 'ar': 'هل نسيت كلمة المرور ؟'}, 'login': {'en': 'Login', 'ar': 'تسجيل الدخول'}, - 'haveGreatDay': {'en': 'have a great day ,', 'ar': 'أتمنى لك يوما جميلا '}, + 'haveGreatDay': {'en': 'have a great day,', 'ar': 'أتمنى لك يوما جميلا '}, 'youHave': {'en': 'You Have', 'ar': 'يوجد لديك'}, - 'deliveredPackages': {'en': 'Delivered Packages', 'ar': 'الطرود المسلمة'}, + 'deliveredPackages': {'en': 'Delivered \nPackages', 'ar': 'الطرود\n المسلمة'}, 'seeAll': {'en': 'See All', 'ar': 'اظهار الكل'}, - 'nearestDropOffs': {'en': 'nearest drop-offs', 'ar': 'أقرب نقطة إنزال'}, + 'nearestDropOffs': {'en': 'Nearest Drop-Offs', 'ar': 'أقرب نقطة إنزال'}, 'undeliveredPackages': { - 'en': 'Undelivered Packages', - 'ar': 'الطرود التي لم يتم تسليمها' - }, - 'deliveryInfo': { - 'en': 'Delivery information', - 'ar': 'معلومات الشحنة' + 'en': 'Undelivered\nPackages', + 'ar': 'الطرود التي\n لم يتم تسليمها' }, + 'deliveryInfo': {'en': 'Delivery information', 'ar': 'معلومات الشحنة'}, 'confirmationSent': { 'en': 'Confirmation email and SMS has been sent', 'ar': 'تم إرسال التأكيد للبرييد الإلكتروني والرسائل النصية القصيرة' }, - 'location': { - 'en': 'Location', - 'ar': 'الموقع' - }, - 'call': { - 'en': 'Call', - 'ar': 'اتصال' - }, - 'sms': { - 'en': 'SMS', - 'ar': 'رسالة نصية' - }, - 'packageContent': { - 'en': 'Package Content', 'ar': 'محتوى الحزمة'}, + 'location': {'en': 'Location', 'ar': 'الموقع'}, + 'call': {'en': 'Call', 'ar': 'اتصال'}, + 'sms': {'en': 'SMS', 'ar': 'رسالة نصية'}, + 'packageContent': {'en': 'Package Content', 'ar': 'محتوى الحزمة'}, 'payment': {'en': 'Payment', 'ar': 'دفع'}, 'delivryTime': {'en': 'Delivery Time', 'ar': 'وقت التوصيل'}, 'clientReached': {'en': 'Client Reached', 'ar': 'الوصول الى العميل'}, 'addNoteBtn': {'en': 'Add Note', 'ar': 'اضافة ملاحظة'}, 'nextDelivery': {'en': 'Next Delivery', 'ar': 'الشحنة التالية'}, + 'scan': {'en': 'SCAN', 'ar': 'مسح'}, + 'away': {'en': 'away', 'ar': 'مسح'}, + 'yourDeliveryQue': { + 'en': 'Your Delivery Que', + 'ar': 'قائمة التسليم الخاصة بك' + }, + 'toAddPackageToQue': { + 'en': 'To add package to que', + 'ar': 'لإضافة حزمة إلى قائمة الانتظار' + }, 'delivered': {'en': 'Delivered', 'ar': 'وصل'}, 'deliveredAccepted': {'en': 'Delivered/Accepted', 'ar': 'تم التوصيل/مقبول'}, 'deliveredRejected': {'en': 'Delivered/Rejected', 'ar': 'تم التوصيل/مرفوض'}, diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index 2af07b6..c2602c3 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -13,7 +13,7 @@ class BaseViewModel extends ChangeNotifier { String error = ""; AppSharedPreferences sharedPref = AppSharedPreferences(); - BaseViewModel(){ + BaseViewModel() { getUser(); } diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart index 22d28e1..86b5ac8 100644 --- a/lib/pages/dashboard/dashboard_screen.dart +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -13,7 +13,11 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import 'package:driverapp/widgets/data_display/circle-container.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../base/base_view.dart'; +import 'package:driverapp/config/shared_pref_kay.dart'; +import 'package:driverapp/uitl/translations_delegate_base.dart'; class DashboardScreen extends StatefulWidget { @override @@ -45,7 +49,7 @@ class _DashboardScreenState extends State { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Have a great day,', + TranslationBase.of(context).haveGreatDay, style: TextStyle( fontSize: 14.5, color: Color(0xff636363), @@ -54,7 +58,8 @@ class _DashboardScreenState extends State { Padding( padding: EdgeInsets.only(top: 4.5), child: Text( - 'Driver Name', + 'Drive Name', + //model.user.userName, style: TextStyle( fontWeight: FontWeight.w400, fontSize: 25.0), @@ -115,7 +120,7 @@ class _DashboardScreenState extends State { MainAxisAlignment.spaceEvenly, children: [ Text( - 'You Have', + TranslationBase.of(context).youHave, style: TextStyle( color: Colors.white, fontSize: 10.0), @@ -127,7 +132,8 @@ class _DashboardScreenState extends State { fontSize: 25.0), ), Text( - 'Undeliverd\nPackages', + TranslationBase.of(context) + .undeliveredPackages, style: TextStyle( color: Colors.white, fontSize: 9.5), ) @@ -192,7 +198,7 @@ class _DashboardScreenState extends State { MainAxisAlignment.spaceEvenly, children: [ Text( - 'You Have', + TranslationBase.of(context).youHave, style: TextStyle( color: Colors.white, fontSize: 10.0), @@ -204,7 +210,8 @@ class _DashboardScreenState extends State { fontSize: 25.0), ), Text( - 'Succesful\nDeliveries', + TranslationBase.of(context) + .deliveredPackages, style: TextStyle( color: Colors.white, fontSize: 10.0), @@ -255,7 +262,10 @@ class _DashboardScreenState extends State { Expanded( child: InkWell( child: Container( - height: MediaQuery.of(context).size.height * 0.18, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.18 + : MediaQuery.of(context).size.height * 0.28, width: MediaQuery.of(context).size.width * 0.50, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15.0), @@ -290,18 +300,20 @@ class _DashboardScreenState extends State { child: Padding( padding: EdgeInsets.only(top: 8.0), child: Text( - 'SCAN', + TranslationBase.of(context).scan, style: TextStyle( - fontSize: 35.0, - color: Colors.white, - fontWeight: FontWeight.w400), + fontSize: 35.0, + color: Colors.white, + fontWeight: FontWeight.w400, + ), ), ), ), Padding( padding: EdgeInsets.only(top: 0.0), child: Text( - 'To add package to que ', + TranslationBase.of(context) + .toAddPackageToQue, style: TextStyle( fontSize: 15.0, color: Colors.white, @@ -320,30 +332,32 @@ class _DashboardScreenState extends State { ], ), ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - children: [ - Text( - 'Nearest Drop-Offs', - style: TextStyle( - fontSize: 21.0, - fontWeight: FontWeight.w400, + NetworkBaseView( + baseViewModel: model, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 20.0, vertical: 1.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Text( + TranslationBase.of(context).nearestDropOffs, + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w400, + ), ), - ), - ], - ), - Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - InkWell( + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( child: Row( children: [ Text( - 'See All', + TranslationBase.of(context).seeAll, style: TextStyle( fontSize: 14.5, color: Color(0xff42B6AD)), ), @@ -355,13 +369,15 @@ class _DashboardScreenState extends State { ], ), onTap: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => OrdersListScreen()), - )), - ], - ), - ], + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + ), + ), + ], + ), + ], + ), ), ), NetworkBaseView( @@ -378,7 +394,10 @@ class _DashboardScreenState extends State { child: InkWell( child: RoundedContainer( raduis: 25.0, - height: MediaQuery.of(context).size.height * 0.109, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.109 + : MediaQuery.of(context).size.height * 0.209, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -386,18 +405,35 @@ class _DashboardScreenState extends State { flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( padding: EdgeInsets.only( - left: 10.0, bottom: 5.0, top: 10.0), + left: 15.0, top: 14.0), child: Image.asset( 'assets/images/location.png', - height: - MediaQuery.of(context).size.height * - 0.06, - width: - MediaQuery.of(context).size.width * - 0.05, + 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, ), ) ], @@ -405,13 +441,13 @@ class _DashboardScreenState extends State { ), if (model.orders.length != 0) Expanded( - flex: 3, + flex: 5, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(top: 10.0), + padding: EdgeInsets.only(top: 20.0), child: Text( model.orders[index].firstName + ' ' + @@ -438,31 +474,17 @@ class _DashboardScreenState extends State { ), ), Padding( - padding: EdgeInsets.all(10.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Expanded( - child: CircleAvatar( - backgroundColor: Color(0xff707070), - radius: 28.0, - child: CircleAvatar( - backgroundColor: Colors.white, - maxRadius: 25.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 10.5, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ) - ], + padding: EdgeInsets.all(8.0), + child: CircleContainer( + child: Text( + model.orders[index].distanceInKilometers + .toString() + + ' K.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.normal), + ), ), ), ], diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index b85ad6c..99eae5b 100644 --- a/lib/pages/delivery/information_page.dart +++ b/lib/pages/delivery/information_page.dart @@ -1 +1 @@ -import 'package:driverapp/app-icons/driver_app_icons.dart'; import 'package:driverapp/core/enum/viewstate.dart'; import 'package:driverapp/core/model/orders/pending_orders_res_model.dart'; import 'package:driverapp/core/model/orders/update_order_status_request_model.dart'; import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/base/base_view.dart'; import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; import 'package:driverapp/uitl/utils.dart'; import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart'; import 'package:driverapp/widgets/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( TranslationBase.of(context).selectAction, 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: 15, ), ActionSheetButton( label: TranslationBase .of(context) .delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox( height: 15 ), ], )), ]), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase .of(context) .delivered; break; case 4: orderStatusText = TranslationBase .of(context) .deliveredAccepted; break; case 5: orderStatusText = TranslationBase .of(context) .deliveredRejected; break; case 6: orderStatusText = TranslationBase .of(context) .canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model,); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel(deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.push( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file +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 'package:url_launcher/url_launcher.dart'; import 'package:maps_launcher/maps_launcher.dart'; import '../../uitl/translations_delegate_base.dart'; import '../../widgets/others/app_scaffold_widget.dart'; class InformationPage extends StatelessWidget { final PendingOrdersRes item; int orderStatus; InformationPage(this.item); @override Widget build(BuildContext context) { 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: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); },), 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: () => launch("tel://" + item.mobileNumber), ), ], ), 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, longitude: item.longitude, latitude: item.latitude, ),], ), ], ), ], ), ), ), bottomSheet: !model.isBottomSheetAppear ? Container( width: 0, height: 0, ) : CustomBottomSheet(children: [ SizedBox( height: 10, ), Center( child: Texts( TranslationBase.of(context).selectAction, 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: 15, ), ActionSheetButton( label: TranslationBase .of(context) .delivered, icon: DriverApp.deliverd_icon, onTap: () { selectAction(context, 3, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .deliveredAccepted, icon: DriverApp.not_available, onTap: () { selectAction(context, 4, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .deliveredRejected, icon: DriverApp.rejected_icon, onTap: () { selectAction(context, 5, model); }, ), SizedBox( height: 15 ), ActionSheetButton( label: TranslationBase .of(context) .canceled, icon: DriverApp.not_reachable_icon, onTap: () { selectAction(context, 6, model); }, ), SizedBox( height: 15 ), ], )), ]), ), ); } selectAction(BuildContext context, orderStatus, OrdersViewModel model) { String orderStatusText; this.orderStatus = orderStatus; switch (orderStatus) { case 3: orderStatusText = TranslationBase .of(context) .delivered; break; case 4: orderStatusText = TranslationBase .of(context) .deliveredAccepted; break; case 5: orderStatusText = TranslationBase .of(context) .deliveredRejected; break; case 6: orderStatusText = TranslationBase .of(context) .canceled; break; } showDialog( context: context, builder: (BuildContext context) { return CustomDialog( orderStatusText: orderStatusText, callService: () { updateOrderStatus(context, model); }, model: model,); }); } updateOrderStatus(BuildContext context, OrdersViewModel model) async { UpdateOrderStatusRequestModel updateOrderStatusRequestModel = UpdateOrderStatusRequestModel(deliveryOrderID: item.orderID, deliveryOrderStatus: orderStatus, rejectionReason: "NO Reason", cancleReason: ""); await model.updateOrderStatus(updateOrderStatusRequestModel); if (model.state == ViewState.ErrorLocal) { Utils.showErrorToast(model.error); Navigator.of(context).pop(); model.hideBottomSheet(); } else { Navigator.of(context).pop(); model.hideBottomSheet(); Navigator.push( context, MaterialPageRoute( builder: (context) => DeliveryConfirmedPage(item), ), ); } } } \ No newline at end of file diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart index 3e5a6a3..acfe0a5 100644 --- a/lib/pages/orders/pending_orders_page.dart +++ b/lib/pages/orders/pending_orders_page.dart @@ -1,10 +1,11 @@ import 'package:driverapp/core/viewModels/orders_view_model.dart'; import 'package:driverapp/pages/delivery/information_page.dart'; +import 'package:driverapp/widgets/data_display/circle-container.dart'; import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; import 'package:driverapp/widgets/others/rounded_container.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - +import 'package:driverapp/uitl/translations_delegate_base.dart'; import '../base/base_view.dart'; class OrdersListScreen extends StatefulWidget { @@ -20,7 +21,7 @@ class _OrdersListScreenState extends State { builder: (BuildContext context, OrdersViewModel model, Widget child) => AppScaffold( isShowAppBar: true, - appBarTitle: 'Your Delivery Que', + appBarTitle: TranslationBase.of(context).yourDeliveryQue, titleColor: Colors.black, body: Column( children: [ @@ -35,7 +36,10 @@ class _OrdersListScreenState extends State { child: InkWell( child: RoundedContainer( raduis: 25.0, - height: MediaQuery.of(context).size.height * 0.109, + height: MediaQuery.of(context).orientation == + Orientation.portrait + ? MediaQuery.of(context).size.height * 0.109 + : MediaQuery.of(context).size.height * 0.209, child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -43,17 +47,27 @@ class _OrdersListScreenState extends State { flex: 1, child: Column( mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only( - left: 10.0, bottom: 5.0, top: 10.0), + padding: + EdgeInsets.only(left: 15.0, top: 14.0), child: Image.asset( 'assets/images/location.png', - height: - MediaQuery.of(context).size.height * - 0.06, - width: MediaQuery.of(context).size.width * - 0.05, + 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, ), ) ], @@ -61,12 +75,12 @@ class _OrdersListScreenState extends State { ), if (model.orders.length != 0) Expanded( - flex: 3, + flex: 5, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Padding( - padding: EdgeInsets.only(top: 10.0), + padding: EdgeInsets.only(top: 20.0), child: Text( model.orders[index].firstName + ' ' + @@ -84,7 +98,7 @@ class _OrdersListScreenState extends State { ), Expanded( child: Text( - 'Olaya ST, Behind kfc next to king , ', + 'Olaya ST, Behind kfc next to king', style: TextStyle(color: Color(0xff636363)), ), @@ -93,31 +107,17 @@ class _OrdersListScreenState extends State { ), ), 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.0, - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Text( - '3 K.m \n away', - style: TextStyle( - color: Color(0xff30B7B9), - fontSize: 10.5, - fontWeight: FontWeight.w400), - ), - ), - ), - ), - ) - ], + padding: EdgeInsets.all(8.0), + child: CircleContainer( + child: Text( + model.orders[index].distanceInKilometers + .toString() + + ' K.m\naway', + style: TextStyle( + color: Color(0xff42B6AD), + fontWeight: FontWeight.w800, + fontStyle: FontStyle.normal), + ), ), ), ], diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 9f70074..f23f283 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -103,6 +103,10 @@ class TranslationBase { String get confirmationSent => localizedValues['confirmationSent'][locale.languageCode]; + String get yourDeliveryQue => + localizedValues['yourDeliveryQue'][locale.languageCode]; + String get toAddPackageToQue => + localizedValues['toAddPackageToQue'][locale.languageCode]; String get delivered => localizedValues['delivered'][locale.languageCode];