diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart index d6a711d..60c7645 100644 --- a/lib/pages/delivery/delivery_confirmed_page.dart +++ b/lib/pages/delivery/delivery_confirmed_page.dart @@ -23,7 +23,7 @@ class DeliveryConfirmedPage extends StatelessWidget { color: Theme.of(context).primaryColor, child: ListView( children: [ - Column( + Stack( children: [ Column( children: [ @@ -34,12 +34,10 @@ class DeliveryConfirmedPage extends StatelessWidget { width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.width * 0.7, padding: EdgeInsets.only( - top: MediaQuery.of(context).size.width * - 0.12, + top: MediaQuery.of(context).size.width * 0.12, ), decoration: BoxDecoration( - color: Colors.white10, - shape: BoxShape.circle), + color: Colors.white10, shape: BoxShape.circle), child: Column( children: [ Icon( @@ -47,9 +45,10 @@ class DeliveryConfirmedPage extends StatelessWidget { color: Colors.white, size: 75, ), - - SizedBox(height: MediaQuery.of(context).size.width * 0.03,), - + SizedBox( + height: + MediaQuery.of(context).size.width * 0.03, + ), Text( TranslationBase.of(context).deliveryInfo, style: TextStyle( @@ -57,12 +56,12 @@ class DeliveryConfirmedPage extends StatelessWidget { fontSize: 20, fontWeight: FontWeight.bold), ), - - SizedBox(height: MediaQuery.of(context).size.width * 0.03,), - + SizedBox( + height: + MediaQuery.of(context).size.width * 0.03, + ), Text( - TranslationBase.of(context) - .confirmationSent, + TranslationBase.of(context).confirmationSent, style: TextStyle( color: Colors.white, fontSize: 13, @@ -76,76 +75,77 @@ class DeliveryConfirmedPage extends StatelessWidget { ), ], ), - Stack( - children: [ - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width, - ), - Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.width * 1.2, - margin: EdgeInsets.only(top: 60), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.only( - topLeft: Radius.circular(80), - topRight: Radius.circular(80)), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.end, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - margin: EdgeInsets.only( - bottom: MediaQuery.of(context).size.width * 0.15, + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, + ), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width * 1.0, + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.width * 0.75, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(80), + topRight: Radius.circular(80)), + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + margin: EdgeInsets.only( + bottom: MediaQuery.of(context).size.width * 0.09, + ), + child: Column( + children: [ + FlatButton.icon( + padding: EdgeInsets.all(8), + color: Colors.orangeAccent, + shape: RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(10.0), + ), + label: Text( + TranslationBase.of(context).addNoteBtn, + style: TextStyle(color: Colors.white), + ), + icon: Icon( + Icons.mode_edit, + color: Colors.white, + ), + onPressed: () {}, ), - child: Column( - children: [ - FlatButton.icon( - padding: EdgeInsets.all(8), - color: Colors.orangeAccent, - shape: RoundedRectangleBorder( - borderRadius: - new BorderRadius.circular(10.0), - ), - label: Text( - TranslationBase.of(context).addNoteBtn, - style: TextStyle(color: Colors.white), - ), - icon: Icon( - Icons.mode_edit, - color: Colors.white, - ), - onPressed: () {}, - ), - SizedBox( - height: MediaQuery.of(context).size.width * - 0.1, //20, - ), - Container( - margin: EdgeInsets.all(10), - child: SecondaryButton( - label: TranslationBase.of(context) - .nextDelivery, - onTap: () {}, - ), - ), - ], + SizedBox( + height: + MediaQuery.of(context).size.width * 0.02, //20, ), - ), - ], + Container( + margin: EdgeInsets.all(10), + child: SecondaryButton( + label: TranslationBase.of(context).nextDelivery, + onTap: () {}, + ), + ), + ], + ), ), - ), - CustomerBriefCard( - itemId: item.patientID, - customerFirstName: item.firstName, - customerLastName: item.lastName, - mobileNo: item.mobileNumber, - totalPayment: item.amount, - showDistance: false, - deliveryTime: item.orderCreatedOn), - ], + ], + ), + ), + Container( + margin: EdgeInsets.only( + top: MediaQuery.of(context).size.width * 0.6, + ), + child: CustomerBriefCard( + itemId: item.orderID, + customerFirstName: item.firstName, + customerLastName: item.lastName, + mobileNo: item.mobileNumber, + totalPayment: item.amount, + showDistance: false, + deliveryTime: item.orderCreatedOn), ), ], ), diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart index f9d6252..13eeacd 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 '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.43, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Color(0xffED1C24), btnIcon: Icon( DriverApp.location_1, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); },), DeliveryInfoButton( btnColor: Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: 30, color: Colors.white, ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: 30, color: Colors.white, ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, 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 +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.23, //MediaQuery.of(context).size.width * 0.005, ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ DeliveryInfoButton( btnColor: Colors.white,//Color(0xffED1C24), btnIcon: Icon( DriverApp.location_1, size: 40, color: Color(0xffED1C24) ), btnName: TranslationBase.of(context).location, btnFunction: () { MapsLauncher.launchCoordinates( item.latitude, item.longitude); },), DeliveryInfoButton( btnColor: Colors.white,//Color(0xFF61B260), btnIcon: Icon( DriverApp.whatsapp, size: 40, color: Color(0xFF61B260), ), btnName: 'Whatsapp', btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white,//Color(0xFFFCB657), btnIcon: Icon( DriverApp.message, size: 40, color: Color(0xFFFCB657), ), btnName: TranslationBase.of(context).sms, btnFunction: () {}, ), DeliveryInfoButton( btnColor: Colors.white,//Theme.of(context).primaryColor, btnIcon: Icon( DriverApp.call, size: 40, color: Theme.of(context).primaryColor, ), 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.orderID, 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/widgets/delivery/customer_brief_card.dart b/lib/widgets/delivery/customer_brief_card.dart index 94ead82..7a6899d 100644 --- a/lib/widgets/delivery/customer_brief_card.dart +++ b/lib/widgets/delivery/customer_brief_card.dart @@ -4,7 +4,7 @@ import '../../uitl/date_uitl.dart'; import '../../uitl/translations_delegate_base.dart'; class CustomerBriefCard extends StatelessWidget { - final String itemId; + final int itemId; final String time; final String customerFirstName; final String customerLastName; @@ -102,13 +102,13 @@ class CustomerBriefCard extends StatelessWidget { style: TextStyle(color: Color(0xFF50BDC5)), ), SizedBox( - height:MediaQuery.of(context).size.width*0.05, - ), - Text( - 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', - style: TextStyle( - color: Color(0xFF464748), fontWeight: FontWeight.w600), + height:MediaQuery.of(context).size.width*0.005, ), +// Text( +// 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277', +// style: TextStyle( +// color: Color(0xFF464748), fontWeight: FontWeight.w600), +// ), SizedBox( height: 10, ), diff --git a/lib/widgets/delivery/delivery_action_button.dart b/lib/widgets/delivery/delivery_action_button.dart index 3571218..00ea320 100644 --- a/lib/widgets/delivery/delivery_action_button.dart +++ b/lib/widgets/delivery/delivery_action_button.dart @@ -24,22 +24,13 @@ class DeliveryInfoButton extends StatelessWidget { .of(context) .size .width * 0.165, // specific value - child: RaisedButton( - padding: EdgeInsets.only(left: 2), - color: btnColor, - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(8.0), - ), - child: btnIcon, - onPressed: btnFunction, + child: + InkWell( + child: btnIcon, + onTap: btnFunction, ), ), - SizedBox( - height: MediaQuery - .of(context) - .size - .width * 0.05, - ), + Text( btnName, style: TextStyle(