You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
24 KiB
Dart
1 line
24 KiB
Dart
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<OrdersViewModel>(
|
|
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: <Widget>[
|
|
Column(
|
|
children: <Widget>[
|
|
Stack(
|
|
children: <Widget>[
|
|
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: <Widget>[
|
|
SizedBox(
|
|
height:
|
|
MediaQuery.of(context).size.width * 0.43,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: <Widget>[
|
|
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: <Widget>[
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 8),
|
|
child: Text(
|
|
TranslationBase.of(context)
|
|
.packageContent,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w900,
|
|
fontSize: 20),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height:
|
|
MediaQuery.of(context).size.width *
|
|
0.05,
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(left: 10),
|
|
child: Column(
|
|
children: List.generate(
|
|
item.itemsQuantitiesList.length,
|
|
(index) {
|
|
return packageContent(
|
|
packageName: item
|
|
.itemsQuantitiesList[index]
|
|
.itemName
|
|
.toString(),
|
|
packageCount: item
|
|
.itemsQuantitiesList[index]
|
|
.quantity
|
|
.toString(),
|
|
);
|
|
}),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height:
|
|
MediaQuery.of(context).size.width *
|
|
0.01,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: MediaQuery.of(context).size.width * 0.1,
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.all(10),
|
|
child: SecondaryButton(
|
|
label:
|
|
TranslationBase.of(context).clientReached,
|
|
onTap: () {
|
|
model.showBottomSheet();
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
CustomerBriefCard(
|
|
itemId: item.patientID,
|
|
customerFirstName: item.firstName,
|
|
customerLastName: item.lastName,
|
|
mobileNo: item.mobileNumber,
|
|
totalPayment: item.amount,
|
|
deliveryTime: item.orderCreatedOn),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
bottomSheet: !model.isBottomSheetAppear
|
|
? Container(
|
|
width: 0,
|
|
height: 0,
|
|
)
|
|
: CustomBottomSheet(children: [
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
Center(
|
|
child: Texts(
|
|
'Select Action',
|
|
color: Colors.black,
|
|
fontSize: 22,
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
FractionallySizedBox(
|
|
widthFactor: 0.9,
|
|
child: Column(
|
|
children: <Widget>[
|
|
SizedBox(
|
|
height: 3,
|
|
child: Container(
|
|
color: Hexcolor("#D5D5D5"),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
ActionSheetButton(
|
|
label: "Delivered",
|
|
icon: DriverApp.deliverd_icon,
|
|
onTap: () {
|
|
selectAction(context, 1, model);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
ActionSheetButton(
|
|
label: "Not Available",
|
|
icon: DriverApp.not_available,
|
|
onTap: () {
|
|
selectAction(context, 2, model);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
ActionSheetButton(
|
|
label: "Rejected",
|
|
icon: DriverApp.rejected_icon,
|
|
onTap: () {
|
|
selectAction(context, 3, model);
|
|
},
|
|
),
|
|
SizedBox(
|
|
height: 6,
|
|
),
|
|
ActionSheetButton(
|
|
label: "Not Reachable",
|
|
icon: DriverApp.not_reachable_icon,
|
|
onTap: () {
|
|
selectAction(context, 4, model);
|
|
},
|
|
),
|
|
],
|
|
)),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
|
|
selectAction(BuildContext context, orderStatus, OrdersViewModel model) {
|
|
String orderStatusText;
|
|
this.orderStatus = orderStatus;
|
|
switch (orderStatus) {
|
|
case 1:
|
|
orderStatusText = "Delivered";
|
|
break;
|
|
case 2:
|
|
orderStatusText = "Not Available";
|
|
break;
|
|
case 3:
|
|
orderStatusText = "Rejected";
|
|
break;
|
|
case 4:
|
|
orderStatusText = "Not Reachable";
|
|
break;
|
|
}
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return CustomDialog(
|
|
orderStatusText: orderStatusText,
|
|
callService: () {
|
|
updateOrderStatus(context, model);
|
|
},
|
|
model: model,
|
|
);
|
|
});
|
|
}
|
|
|
|
updateOrderStatus(BuildContext context, OrdersViewModel model) async {
|
|
UpdateOrderStatusRequestModel updateOrderStatusRequestModel =
|
|
UpdateOrderStatusRequestModel(
|
|
deliveryOrderID: item.orderID,
|
|
deliveryOrderStatus: orderStatus,
|
|
rejectionReason: "NO Reason",
|
|
cancleReason: "");
|
|
await model.updateOrderStatus(updateOrderStatusRequestModel);
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
Utils.showErrorToast(model.error);
|
|
Navigator.of(context).pop();
|
|
model.hideBottomSheet();
|
|
} else {
|
|
Navigator.of(context).pop();
|
|
model.hideBottomSheet();
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => DeliveryConfirmedPage(item),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
} //======= //import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart'; //import 'package:driverapp/widgets/buttons/secondary_button.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 '../../uitl/translations_delegate_base.dart'; //import '../../widgets/others/app_scaffold_widget.dart'; // //class InformationPage extends StatelessWidget { // final dynamic item; // // InformationPage(this.item); // // @override // Widget build(BuildContext context) { // return AppScaffold( // 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: <Widget>[ // Column( // children: <Widget>[ // Stack( // children: <Widget>[ // 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: <Widget>[ // SizedBox( // height: MediaQuery // .of(context) // .size // .width * 0.53, // ), // Row( // mainAxisAlignment: MainAxisAlignment.center, // children: <Widget>[ // 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: <Widget>[ // Padding( // padding: const EdgeInsets.only(left: 8), // child: Text( // TranslationBase.of(context) // .packageContent, // style: TextStyle( // fontFamily: "Metropolis-Bold", // fontSize: 22), // ), // ), // 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: () { // Navigator.push( // context, // MaterialPageRoute( // builder: (context) => // DeliveryConfirmedPage(item))); // }, // ), // ), // ], // ), // ), // CustomerBriefCard( // itemId: item.patientID, // customerFirstName: item.firstName, // customerLastName: item.lastName, // mobileNo: item.mobileNumber, // totalPayment: item.amount, // deliveryTime: item.orderCreatedOn), // ], // ), // ], // ), // ], // ), // ), // ), // ); // } //} //>>>>>>> 836e9709d94e97f22d62ee36cd380ef115a3a356
|