BASE: Initialize Localization.
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:customer/models/vendor_model.dart';
|
||||
import 'package:customer/widget/geoflutterfire/src/geoflutterfire.dart';
|
||||
import 'package:dropdown_textfield/dropdown_textfield.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
@@ -101,10 +102,10 @@ class BookParcelController extends GetxController {
|
||||
|
||||
void onCameraClick(BuildContext context) {
|
||||
final action = CupertinoActionSheet(
|
||||
message: Text('Add your parcel image.'.tr, style: const TextStyle(fontSize: 15.0)),
|
||||
message: Text('Add your parcel image.'.tr(), style: const TextStyle(fontSize: 15.0)),
|
||||
actions: <Widget>[
|
||||
CupertinoActionSheetAction(
|
||||
child: Text('Choose image from gallery'.tr),
|
||||
child: Text('Choose image from gallery'.tr()),
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
final imageList = await _picker.pickMultiImage();
|
||||
@@ -114,7 +115,7 @@ class BookParcelController extends GetxController {
|
||||
},
|
||||
),
|
||||
CupertinoActionSheetAction(
|
||||
child: Text('Take a picture'.tr),
|
||||
child: Text('Take a picture'.tr()),
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
final XFile? photo = await _picker.pickImage(source: ImageSource.camera);
|
||||
@@ -124,7 +125,7 @@ class BookParcelController extends GetxController {
|
||||
},
|
||||
),
|
||||
],
|
||||
cancelButton: CupertinoActionSheetAction(child: Text('Cancel'.tr), onPressed: () => Navigator.pop(context)),
|
||||
cancelButton: CupertinoActionSheetAction(child: Text('Cancel'.tr()), onPressed: () => Navigator.pop(context)),
|
||||
);
|
||||
showCupertinoModalPopup(context: context, builder: (context) => action);
|
||||
}
|
||||
@@ -147,38 +148,38 @@ class BookParcelController extends GetxController {
|
||||
|
||||
bool validateFields() {
|
||||
if (senderNameController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter sender name".tr);
|
||||
ShowToastDialog.showToast("Please enter sender name".tr());
|
||||
return false;
|
||||
} else if (senderMobileController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter sender mobile".tr);
|
||||
ShowToastDialog.showToast("Please enter sender mobile".tr());
|
||||
return false;
|
||||
} else if (senderLocationController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter sender address".tr);
|
||||
ShowToastDialog.showToast("Please enter sender address".tr());
|
||||
return false;
|
||||
} else if (receiverNameController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter receiver name".tr);
|
||||
ShowToastDialog.showToast("Please enter receiver name".tr());
|
||||
return false;
|
||||
} else if (receiverMobileController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter receiver mobile".tr);
|
||||
ShowToastDialog.showToast("Please enter receiver mobile".tr());
|
||||
return false;
|
||||
} else if (receiverLocationController.value.text.isEmpty) {
|
||||
ShowToastDialog.showToast("Please enter receiver address".tr);
|
||||
ShowToastDialog.showToast("Please enter receiver address".tr());
|
||||
return false;
|
||||
} else if (isScheduled.value) {
|
||||
if (scheduledDate.value.isEmpty) {
|
||||
ShowToastDialog.showToast("Please select scheduled date".tr);
|
||||
ShowToastDialog.showToast("Please select scheduled date".tr());
|
||||
return false;
|
||||
} else if (scheduledTime.value.isEmpty) {
|
||||
ShowToastDialog.showToast("Please select scheduled time".tr);
|
||||
ShowToastDialog.showToast("Please select scheduled time".tr());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (selectedWeight == null) {
|
||||
ShowToastDialog.showToast("Please select parcel weight".tr);
|
||||
ShowToastDialog.showToast("Please select parcel weight".tr());
|
||||
return false;
|
||||
} else if (senderLocation.value == null || receiverLocation.value == null) {
|
||||
ShowToastDialog.showToast("Please select both sender and receiver locations".tr);
|
||||
ShowToastDialog.showToast("Please select both sender and receiver locations".tr());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -203,14 +204,14 @@ class BookParcelController extends GetxController {
|
||||
}
|
||||
|
||||
if (distance.value < 0.5) {
|
||||
ShowToastDialog.showToast("Sender's location to receiver's location should be more than 1 km.".tr);
|
||||
ShowToastDialog.showToast("Sender's location to receiver's location should be more than 1 km.".tr());
|
||||
return;
|
||||
}
|
||||
|
||||
subTotal.value = (distance.value * double.parse(selectedWeight!.deliveryCharge.toString()));
|
||||
goToCart();
|
||||
} catch (e) {
|
||||
ShowToastDialog.showToast("Something went wrong while booking.".tr);
|
||||
ShowToastDialog.showToast("Something went wrong while booking.".tr());
|
||||
debugPrint("bookNow error: $e");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user