diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 9702d5e..e091971 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -28,6 +28,10 @@ PODS:
- Flutter
- local_auth (0.0.1):
- Flutter
+ - location (0.0.1):
+ - Flutter
+ - location_web (0.0.1):
+ - Flutter
- map_launcher (0.0.1):
- Flutter
- maps_launcher (0.0.1):
@@ -71,6 +75,8 @@ DEPENDENCIES:
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- local_auth (from `.symlinks/plugins/local_auth/ios`)
+ - location (from `.symlinks/plugins/location/ios`)
+ - location_web (from `.symlinks/plugins/location_web/ios`)
- map_launcher (from `.symlinks/plugins/map_launcher/ios`)
- maps_launcher (from `.symlinks/plugins/maps_launcher/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
@@ -118,6 +124,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/image_picker/ios"
local_auth:
:path: ".symlinks/plugins/local_auth/ios"
+ location:
+ :path: ".symlinks/plugins/location/ios"
+ location_web:
+ :path: ".symlinks/plugins/location_web/ios"
map_launcher:
:path: ".symlinks/plugins/map_launcher/ios"
maps_launcher:
@@ -157,6 +167,8 @@ SPEC CHECKSUMS:
image_cropper: c8f9b4157933c7bb965a66d1c5e6c8fd408c6eb4
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd
+ location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
+ location_web: b94e7433cfe28c0f7c8923c2ee482824b32e55a7
map_launcher: e325db1261d029ff33e08e03baccffe09593ffea
maps_launcher: eae38ee13a9c3f210fa04e04bb4c073fa4c6ed92
MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 2f73b5c..6c769fb 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -242,6 +242,7 @@
"${BUILT_PRODUCTS_DIR}/image_cropper/image_cropper.framework",
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
"${BUILT_PRODUCTS_DIR}/local_auth/local_auth.framework",
+ "${BUILT_PRODUCTS_DIR}/location/location.framework",
"${BUILT_PRODUCTS_DIR}/map_launcher/map_launcher.framework",
"${BUILT_PRODUCTS_DIR}/maps_launcher/maps_launcher.framework",
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
@@ -264,6 +265,7 @@
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_cropper.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/local_auth.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/location.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/map_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/maps_launcher.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index 933c8db..b980cec 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -41,5 +41,9 @@
UIViewControllerBasedStatusBarAppearance
+ NSLocationAlwaysUsageDescription
+ Needed to access location
+ NSLocationWhenInUseUsageDescription
+ Needed to access location
diff --git a/lib/pages/delivery/delivery_confirmed_page.dart b/lib/pages/delivery/delivery_confirmed_page.dart
index 2a4a57d..70b49fd 100644
--- a/lib/pages/delivery/delivery_confirmed_page.dart
+++ b/lib/pages/delivery/delivery_confirmed_page.dart
@@ -9,6 +9,7 @@ import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/delivery/customer_brief_card.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
+import 'package:location/location.dart';
import '../../uitl/translations_delegate_base.dart';
import '../../widgets/others/app_scaffold_widget.dart';
@@ -131,11 +132,14 @@ class DeliveryConfirmedPage extends StatelessWidget {
),
Container(
margin: EdgeInsets.all(10),
- child: SecondaryButton(
- label: TranslationBase.of(context).nextDelivery,
+ child: SecondaryButton(
+ label: TranslationBase
+ .of(context)
+ .nextDelivery,
+ loading: model.state == ViewState.BusyLocal,
onTap: () {
- getNextOrder(context, model);
- },),
+ getNextOrder(context, model);
+ },),
),
],
),
@@ -166,11 +170,15 @@ class DeliveryConfirmedPage extends StatelessWidget {
}
getNextOrder(BuildContext context, OrdersViewModel model) async {
+ model.setState(ViewState.BusyLocal);
+ LocationData loc = await Utils.getLocation();
NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel(
pageIndex: 0,
pageSize: 0,
- latitude: "46.621730",
- longitude: "24.797682",
+ latitude: loc.latitude.toString(),
+ //"46.621730",
+ longitude: loc.longitude.toString(),
+ //"24.797682",
searchKey: "");
await model.nextOrder(nextOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
diff --git a/lib/pages/delivery/information_page.dart b/lib/pages/delivery/information_page.dart
index 6367d63..580232b 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:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_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: Color(0xff45B7AE),
arrowColor: Colors.white,
titleColor: Colors.white,
appBarTitle: TranslationBase.of(context).deliveryInfo,
body: Container(
color: Colors.red,
child: Container(
color: Color(0xff45B7AE),
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).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 1.5
: MediaQuery.of(context).size.width * 0.8,
margin: EdgeInsets.only(
top: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.23
: MediaQuery.of(context).size.width * 0.13),
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: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? 40
: 90,
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:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Color(0xFF61B260),
),
btnName: 'Whatsapp',
btnFunction: () {},
),
DeliveryInfoButton(
btnColor: Colors.white, //Color(0xFFFCB657),
btnIcon: Icon(
DriverApp.message,
size:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Color(0xFFFCB657),
),
btnName: TranslationBase.of(context).sms,
btnFunction: () {},
),
DeliveryInfoButton(
btnColor: Colors
.white, //Theme.of(context).primaryColor,
btnIcon: Icon(
DriverApp.call,
size:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Theme.of(context).primaryColor,
),
btnName: TranslationBase.of(context).call,
btnFunction: () =>
launch("tel://" + item.mobileNumber),
),
],
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.08,
),
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 != null
? item
.itemsQuantitiesList.length
: 0, (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: MediaQuery.of(context).orientation ==
Orientation.portrait
? 0.9
: 0.98,
child: Container(
height: MediaQuery.of(context).size.height * 0.43,
width: double.infinity,
child: ListView(
children: [
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.pushReplacement(
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/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:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_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) {
showDeliveryOptions(OrdersViewModel model) {
showModalBottomSheet(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50.0),
topRight: Radius.circular(50.0),
),
),
context: context,
builder: (BuildContext bc) {
return ListView(
children: [
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50.0),
topRight: Radius.circular(50.0),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(
height: 10,
),
Center(
child: Texts(
TranslationBase.of(context).selectAction,
color: Colors.black,
fontSize: 22,
),
),
SizedBox(
height: 10,
),
FractionallySizedBox(
widthFactor: MediaQuery.of(context).orientation ==
Orientation.portrait
? 0.9
: 0.98,
child: Container(
height: MediaQuery.of(context).size.height * 0.45,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50.0),
topRight: Radius.circular(50.0),
),
),
width: double.infinity,
child: ListView(
children: [
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),
],
),
],
),
))
],
),
),
],
);
});
}
return BaseView(
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
appBarColor: Color(0xff45B7AE),
arrowColor: Colors.white,
titleColor: Colors.white,
appBarTitle: TranslationBase.of(context).deliveryInfo,
body: Container(
color: Colors.red,
child: Container(
color: Color(0xff45B7AE),
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).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 1.5
: MediaQuery.of(context).size.width * 0.8,
margin: EdgeInsets.only(
top: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.23
: MediaQuery.of(context).size.width * 0.13),
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: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? 40
: 90,
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:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Color(0xFF61B260),
),
btnName: 'Whatsapp',
btnFunction: () {},
),
DeliveryInfoButton(
btnColor: Colors.white, //Color(0xFFFCB657),
btnIcon: Icon(
DriverApp.message,
size:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Color(0xFFFCB657),
),
btnName: TranslationBase.of(context).sms,
btnFunction: () {},
),
DeliveryInfoButton(
btnColor: Colors
.white, //Theme.of(context).primaryColor,
btnIcon: Icon(
DriverApp.call,
size:
MediaQuery.of(context).orientation ==
Orientation.portrait
? 40
: 90,
color: Theme.of(context).primaryColor,
),
btnName: TranslationBase.of(context).call,
btnFunction: () =>
launch("tel://" + item.mobileNumber),
),
],
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.08,
),
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 != null
? item
.itemsQuantitiesList.length
: 0, (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: () {
showDeliveryOptions(model);
},
),
),
],
),
),
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,
),
],
),
],
),
],
),
),
),
),
);
}
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.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => DeliveryConfirmedPage(item),
),
);
}
}
}
\ No newline at end of file
diff --git a/lib/uitl/utils.dart b/lib/uitl/utils.dart
index 1c2da2b..6919cff 100644
--- a/lib/uitl/utils.dart
+++ b/lib/uitl/utils.dart
@@ -1,5 +1,6 @@
import 'package:connectivity/connectivity.dart';
import 'package:flutter/cupertino.dart';
+import 'package:location/location.dart';
import 'app_shared_preferences.dart';
import 'app_toast.dart';
@@ -42,4 +43,10 @@ class Utils {
static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus();
}
+
+ static getLocation() async {
+ Location location = new Location();
+ LocationData currentLocation = await location.getLocation();
+ return currentLocation;
+ }
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 6184287..778cf11 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -67,9 +67,14 @@ dependencies:
# Qr code Scanner
barcode_scan: ^3.0.1
- #mape
+ # map
map_launcher: ^0.12.0
+ # location
+ location: ^3.0.2
+
+
+