Compare commits

..

No commits in common. 'development' and 'location' have entirely different histories.

@ -43,8 +43,6 @@ android {
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
buildTypes {

@ -24,7 +24,8 @@
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 544 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

@ -1 +0,0 @@
include ':app'

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

@ -1 +0,0 @@
5fbd1cb9b58728098d7578fb656a1766

@ -1,6 +1,4 @@
PODS:
- "app_settings (3.0.0+1)":
- Flutter
- barcode_scan (0.0.1):
- Flutter
- MTBBarcodeScanner
@ -62,11 +60,8 @@ PODS:
- Flutter
- url_launcher_web (0.0.1):
- Flutter
- url_launcher_windows (0.0.1):
- Flutter
DEPENDENCIES:
- app_settings (from `.symlinks/plugins/app_settings/ios`)
- barcode_scan (from `.symlinks/plugins/barcode_scan/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- connectivity_for_web (from `.symlinks/plugins/connectivity_for_web/ios`)
@ -94,7 +89,6 @@ DEPENDENCIES:
- url_launcher_linux (from `.symlinks/plugins/url_launcher_linux/ios`)
- url_launcher_macos (from `.symlinks/plugins/url_launcher_macos/ios`)
- url_launcher_web (from `.symlinks/plugins/url_launcher_web/ios`)
- url_launcher_windows (from `.symlinks/plugins/url_launcher_windows/ios`)
SPEC REPOS:
trunk:
@ -104,8 +98,6 @@ SPEC REPOS:
- TOCropViewController
EXTERNAL SOURCES:
app_settings:
:path: ".symlinks/plugins/app_settings/ios"
barcode_scan:
:path: ".symlinks/plugins/barcode_scan/ios"
connectivity:
@ -160,11 +152,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/url_launcher_macos/ios"
url_launcher_web:
:path: ".symlinks/plugins/url_launcher_web/ios"
url_launcher_windows:
:path: ".symlinks/plugins/url_launcher_windows/ios"
SPEC CHECKSUMS:
app_settings: d103828c9f5d515c4df9ee754dabd443f7cedcf3
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
connectivity_for_web: 2b8584556930d4bd490d82b836bcf45067ce345b
@ -196,8 +185,7 @@ SPEC CHECKSUMS:
url_launcher_linux: ac237cb7a8058736e4aae38bdbcc748a4b394cc0
url_launcher_macos: fd7894421cd39320dce5f292fc99ea9270b2a313
url_launcher_web: e5527357f037c87560776e36436bf2b0288b965c
url_launcher_windows: 683d7c283894db8d1914d3ab2223b20cc1ad95d5
PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a
COCOAPODS: 1.10.0.rc.1
COCOAPODS: 1.9.3

@ -225,12 +225,51 @@
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/MTBBarcodeScanner/MTBBarcodeScanner.framework",
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
"${BUILT_PRODUCTS_DIR}/SwiftProtobuf/SwiftProtobuf.framework",
"${BUILT_PRODUCTS_DIR}/TOCropViewController/TOCropViewController.framework",
"${BUILT_PRODUCTS_DIR}/barcode_scan/barcode_scan.framework",
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",
"${BUILT_PRODUCTS_DIR}/flutter_flexible_toast/flutter_flexible_toast.framework",
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
"${BUILT_PRODUCTS_DIR}/flutter_plugin_android_lifecycle/flutter_plugin_android_lifecycle.framework",
"${BUILT_PRODUCTS_DIR}/hexcolor/hexcolor.framework",
"${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",
"${BUILT_PRODUCTS_DIR}/url_launcher/url_launcher.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/MTBBarcodeScanner.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftProtobuf.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TOCropViewController.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/barcode_scan.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/connectivity.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/device_info.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_flexible_toast.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_plugin_android_lifecycle.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hexcolor.framework",
"${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",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/url_launcher.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
@ -309,6 +348,7 @@
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@ -385,6 +425,7 @@
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@ -440,6 +481,7 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;

@ -45,7 +45,5 @@
<string>Needed to access location</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Needed to access location</string>
<key>NSCameraUsageDescription</key>
<string>Camera permission is required for barcode scanning.</string>
</dict>
</plist>

@ -261,9 +261,9 @@
{
"uid": "d755ac5bb912e95877e670a67bf4528d",
"css": "phone_call",
"code": 59401,
"code": 59398,
"src": "custom_icons",
"selected": true,
"selected": false,
"svg": {
"path": "M907.5 618.9L829.1 540.7A45.6 45.6 0 0 0 764.4 540.7L764.4 540.7 719.7 585.5A9.9 9.9 0 0 1 707 586.6 517.6 517.6 0 0 1 586 467.8 9.9 9.9 0 0 1 586.9 455.1L633 409A45.7 45.7 0 0 0 633 344.4L554.6 265.9A46.7 46.7 0 0 0 489.9 265.9L465.1 290.8A139.5 139.5 0 0 0 430.3 433.2 417.6 417.6 0 0 0 481.3 536.8 544.9 544.9 0 0 0 638.1 690.9 400.4 400.4 0 0 0 754.2 742.5 134.2 134.2 0 0 0 786.7 746.4 141.4 141.4 0 0 0 886.1 704.6L907.4 683.2A45.6 45.6 0 0 0 907.5 618.9Z",
"width": 1344
@ -271,34 +271,6 @@
"search": [
"phone_call"
]
},
{
"uid": "3ee830f1177337ad723625ace69b886b",
"css": "qustion_mark",
"code": 59411,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M215.2 420.5C344.6 414.9 436 362.9 436 295.4 436 236.3 381.2 185.6 295.4 185.6 226.4 185.6 163.2 222.2 118.1 272.9L0 151.9C80.1 61.9 191.2 0 330.5 0 517.5 0 646.9 116.7 646.9 275.7 646.9 402.3 542.9 516.2 398 549.9V651.2H215.2ZM175.8 869.2A129.5 129.5 0 0 1 306.6 744 128 128 0 0 1 306.6 1000 130.6 130.6 0 0 1 175.8 869.2Z",
"width": 647
},
"search": [
"group-8"
]
},
{
"uid": "e4101bb9283eee95eea80812a39424cc",
"css": "exclamation_mark",
"code": 59412,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M0 867A131.7 131.7 0 0 1 133 739.6 130.2 130.2 0 0 1 133 1000 132.8 132.8 0 0 1 0 867ZM15.7 0H251.8L204.6 636.6H63Z",
"width": 260
},
"search": [
"group-14"
]
}
]
}

@ -21,46 +21,22 @@ class DriverApp {
static const _kFontFam = 'DriverApp';
static const _kFontPkg = null;
static const IconData location_1 =
IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData logo =
IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData logout_icon =
IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData closed_box =
IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData location =
IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData open_box =
IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData settings_icon =
IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData qr =
IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData language_icon =
IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData phone_call =
IconData(0xe809, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData not_available =
IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rejected_icon =
IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData not_reachable_icon =
IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData group_74 =
IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData message =
IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData whatsapp =
IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData call =
IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bell_icon =
IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData deliverd_icon =
IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData qustion_mark =
IconData(0xe813, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData exclamation_mark =
IconData(0xe814, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData location_1 = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData logo = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData logout_icon = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData closed_box = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData location = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData open_box = IconData(0xe805, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData settings_icon = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData qr = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData language_icon = IconData(0xe808, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData not_available = IconData(0xe80a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rejected_icon = IconData(0xe80b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData not_reachable_icon = IconData(0xe80c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData group_74 = IconData(0xe80d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData message = IconData(0xe80e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData whatsapp = IconData(0xe80f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData call = IconData(0xe810, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bell_icon = IconData(0xe811, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData deliverd_icon = IconData(0xe812, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}

Binary file not shown.

@ -2,27 +2,17 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
/// End points
const isUAT = true;
const BASE_URL = 'https://${isUAT ? "uat." : ""}hmgwebservices.com/';
const PING_SERVICE = '/Services/Weather.svc/REST/CheckConnectivity';
const GET_PROJECT = '/Services/Lists.svc/REST/GetProject';
const LOGIN = "/Services/Authentication.svc/REST/CheckDriverAuthentication";
const GET_OPT = "/Services/Patients.svc/REST/PatientER_Delivery_SendSMSForForgetPassword";
const CHECK_ACTIVATION_CODE = "/Services/Patients.svc/REST/PatientER_Delivery_CheckActivationCodeForForgetPassword";
const CHANGE_FORGOT_PASSWORD = "/Services/Patients.svc/REST/PatientER_Delivery_ChangeForgetedPasswordForDriver";
const GET_ALL_ORDERS = '/Services/Patients.svc/REST/PatientER_Delivery_GetAllOrder';
const SCAN_QR = '/Services/Patients.svc/REST/PatientER_Delivery_OrderInsert';
const UPDATE_ORDER_STATUS = '/Services/Patients.svc/REST/PatientER_Delivery_UpdateOrderStatus';
const NEXT_ORDER = "/Services/Patients.svc/REST/PatientER_Delivery_NextOrder";
const UPDATE_DRIVER_LOCATION = "/Services/Patients.svc/REST/PatientER_DriverLocation_Insert";
const INITIATE_DELIVERY = "/epharmacy/api/sendsmstocustomerfordriver";
const VERIFY_DELIVERY = "/Services/Patients.svc/REST/PatientER_ValidateSentOutForDeliveryOTPCode";
const GET_ALL_DELIVERD_ORDER = '/Services/Patients.svc/REST/PatientER_Delivery_GetAllDeliverdOrder';
const GET_ALL_ORDERS_STATUS = '/Services/Patients.svc/REST/PatientER_Delivery_GetAllOrderstatus';
const BASE_URL = 'https://uat.hmgwebservices.com/Services';
const GET_PROJECT = '/Lists.svc/REST/GetProject';
const LOGIN = "/Authentication.svc/REST/CheckDriverAuthentication";
const GET_ALL_ORDERS = '/Patients.svc/REST/PatientER_Delivery_GetAllOrder';
const SCAN_QR = '/Patients.svc/REST/PatientER_Delivery_OrderInsert';
const UPDATE_ORDER_STATUS =
'/Patients.svc/REST/PatientER_Delivery_UpdateOrderStatus';
const NEXT_ORDER = "/Patients.svc/REST/PatientER_Delivery_NextOrder";
const GET_ALL_DELIVERD_ORDER =
'/Patients.svc/REST/PatientER_Delivery_GetAllDeliverdOrder';
/// Body Constant
const CHANNEL = 9;
@ -42,11 +32,3 @@ const LINEAR_GRADIENT = LinearGradient(
],
// stops: [0.0, 1.0],
);
abstract class DeliveryStatus{
static final int pending = 1;
static final int delivered = 2;
static final int rejected = 3;
static final int cancel = 4;
}

@ -4,7 +4,7 @@ const Map<String, Map<String, String>> localizedValues = {
'language': {'en': 'App Language', 'ar': 'لغة التطبيق'},
'lanEnglish': {'en': 'English', 'ar': 'English'},
'lanArabic': {'en': 'العربية', 'ar': 'العربية'},
'cancel': {'en': 'Cancel', 'ar': 'الغاء'},
'cancel': {'en': 'CANCEL', 'ar': 'الغاء'},
'done': {'en': 'DONE', 'ar': 'تأكيد'},
'replay2': {'en': 'Replay', 'ar': 'رد الطبيب'},
'home': {'en': 'Home', 'ar': 'الرئيسية'},
@ -14,7 +14,7 @@ const Map<String, Map<String, String>> localizedValues = {
'booking': {'en': 'Booking', 'ar': 'حجز'},
'enterId': {'en': 'User Name', 'ar': 'اسم المستخدم'},
'pleaseEnterYourID': {
'en': 'Please enter your user name',
'en': 'Please enter your ',
'ar': 'الرجاء ادخال اسم المستخدم'
},
'enterPassword': {'en': 'Password', 'ar': 'كلمه السر'},
@ -26,17 +26,11 @@ const Map<String, Map<String, String>> localizedValues = {
'en': 'Please insert username and password to login',
'ar': 'الرجاء إدخال اسم المستخدم وكلمة المرور لتسجيل الدخول'
},
'enterForgetIdMsg': {
'en':
'We will send a One Time Password (OTP) to your Mobile Number to reset your password.',
'ar':
'سنرسل كلمة مرور لمرة واحدة (OTP) إلى حسابك رقم الهاتف المحمول لإعادة تعيين كلمة المرور الخاصة بك.'
},
'forgotPassword': {'en': 'Forgot Password?', 'ar': 'هل نسيت كلمة المرور ؟'},
'login': {'en': 'Login', 'ar': 'تسجيل الدخول'},
'haveGreatDay': {'en': 'have a great day,', 'ar': 'أتمنى لك يوما جميلا '},
'youHave': {'en': 'You Have', 'ar': 'يوجد لديك'},
'deliveredPackages': {'en': 'Processed \nPackages', 'ar': 'الطرود\n المسلمة'},
'deliveredPackages': {'en': 'Delivered \nPackages', 'ar': 'الطرود\n المسلمة'},
'seeAll': {'en': 'See All', 'ar': 'اظهار الكل'},
'nearestDropOffs': {'en': 'Nearest Drop-Offs', 'ar': 'أقرب نقطة إنزال'},
'undeliveredPackages': {
@ -69,58 +63,12 @@ const Map<String, Map<String, String>> localizedValues = {
},
'delivered': {'en': 'Delivered', 'ar': 'وصل'},
'deliveredAccepted': {'en': 'Delivered/Accepted', 'ar': 'تم التوصيل/مقبول'},
'deliveredRejected': {'en': 'Rejected', 'ar': 'مرفوض'},
'deliveredRejected': {'en': 'Delivered/Rejected', 'ar': 'تم التوصيل/مرفوض'},
'canceled': {'en': 'Canceled', 'ar': 'الغى'},
'selectAction': {'en': 'Select Action', 'ar': 'الرجاء الاختيار'},
'youHaveSelected': {'en': 'You have selected:', 'ar': 'لقد قمت باختيار:'},
'confirm': {'en': 'Confirm', 'ar': 'تأكيد'},
'areYouSure': {'en': 'Are you sure?', 'ar': 'هل أنت واثق؟'},
'languageText': {'en': 'Language', 'ar': 'اللغة'},
'notification': {'en': 'Notification', 'ar': 'تنبيهات'},
'getOPT': {'en': 'Get OPT', 'ar': 'OPT الحصول على'},
'enterVerificationMsg': {
'en': 'Please Enter your OPT code sent to your phone',
'ar': 'الرجاء إدخال رمز OPT الخاص بك المرسل إلى هاتفك'
},
'enterCustomerVerificationCodeMsg': {
'en': 'Please enter OTP sent to customer phone',
'ar': 'Please enter OTP sent to customer phone'
},
'startDelivery': {
'en': 'Start Delivery',
'ar': 'Start Delivery'
},
'deliveryOption': {
'en': 'Delivery Option',
'ar': 'Delivery Option'
},
'selectReason': {
'en': 'Select Reason',
'ar': 'Select Reason'
},
'accident': {
'en': 'Got accident',
'ar': 'Got accident'
},
'notReachableOnPhoneCall': {
'en': 'Not reachable on phone call',
'ar': 'Not reachable on phone call'
},
'notAvailableAtlocation': {
'en': 'Not available at location',
'ar': 'Not available at location'
},
'deliverLater': {
'en': 'Deliver later',
'ar': 'Deliver later'
},
'other': {
'en': 'Other...',
'ar': 'Other...'
},
'languageText':{'en':'Language','ar':'اللغة'},
'notification':{'en':'Notification','ar':'تنبيهات'},
};

@ -1,6 +1,5 @@
const TOKEN = 'token';
const APP_LANGUAGE = 'language';
const USER_PROFILE = 'user-profile';
const ACTIVE_DELIVERIES = 'active-order-deliveries';

@ -1,11 +0,0 @@
class ResponseModel<T>{
bool isSuccessful = false;
String message;
T data;
isSuccessfull(Function(bool) callback){
callback(isSuccessful);
}
ResponseModel({this.message, this.isSuccessful, this.data});
}

@ -8,19 +8,19 @@ class AuthenticatedUser {
bool active;
String createdOn;
int createdBy;
dynamic editedOn;
dynamic editedBy;
Null editedOn;
Null editedBy;
String mobileNumber;
int realRoleID;
AuthenticatedUser(
{this.iD,
this.userID,
this.password,
this.userName,
this.roleID,
this.name,
this.active,
this.userID,
this.password,
this.userName,
this.roleID,
this.name,
this.active,
this.createdOn,
this.createdBy,
this.editedOn,

@ -1,12 +0,0 @@
class RequestInitiateOrderDelivery{
int orderNo = 0;
String mobileNumber = "";
RequestInitiateOrderDelivery({this.orderNo, this.mobileNumber});
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['OrderNo'] = this.orderNo;
data['MobileNumber'] = this.mobileNumber;
return data;
}
}

@ -1,12 +0,0 @@
class RequestValidateDelivery{
String pinCode;
int orderNo;
RequestValidateDelivery({this.orderNo,this.pinCode});
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['Password'] = this.pinCode;
data['OrderNo'] = this.orderNo;
return data;
}
}

@ -1,3 +0,0 @@
class ResponseInitiateOrderDelivery{
}

@ -25,7 +25,7 @@ class DeliverdOrderResModel {
String patientID;
bool patientOutSA;
int channel;
dynamic distanceInKilometers;
double distanceInKilometers;
List<ItemsQuantitiesList> itemsQuantitiesList;
DeliverdOrderResModel(

@ -9,26 +9,24 @@ class PendingOrders {
String firstName;
String lastName;
String mobileNumber;
dynamic distanceInKilometers;
int distanceInKilometers;
String longitude;
String latitude;
int driverAppPageID;
PendingOrders(
{this.driverID,
this.searchKey,
this.pageSize,
this.pageIndex,
this.tokenID,
this.userID,
this.mobileNo,
this.firstName,
this.lastName,
PendingOrders({
this.driverID,
this.searchKey,
this.pageSize,
this.pageIndex,
this.tokenID,
this.userID,
this.mobileNo,
this.firstName,
this.lastName,
this.mobileNumber,
this.distanceInKilometers,
this.longitude,
this.latitude,
this.driverAppPageID
});
PendingOrders.fromJson(Map<String, dynamic> json) {
@ -43,7 +41,6 @@ class PendingOrders {
lastName = json['LastName'];
mobileNumber = json['MobileNumber'];
distanceInKilometers = json['DistanceInKilometers'];
driverAppPageID = json['DriverAppPageID'];
}
Map<String, dynamic> toJson() {
@ -57,7 +54,7 @@ class PendingOrders {
data['MobileNo'] = this.mobileNo;
data['Longitude'] = this.longitude;
data['Latitude'] = this.latitude;
data['DriverAppPageID'] = this.driverAppPageID;
return data;
}
}

@ -27,11 +27,6 @@ class PendingOrdersRes {
dynamic distanceInKilometers;
List<ItemsQuantitiesList> itemsQuantitiesList;
String receiverFullName(){
var fullName = "${firstName ?? ''} ${middleName ?? ''} ${lastName ?? ''}";
return fullName;
}
PendingOrdersRes(
{this.rowID,
this.orderID,

@ -1,23 +0,0 @@
import 'package:driverapp/config/shared_pref_kay.dart';
import 'package:driverapp/core/model/authentication/authenticated_user.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';
import 'package:location/location.dart';
class RequestUpdateDriverLocation{
int orderID = 0;
LocationData location;
RequestUpdateDriverLocation({this.orderID,this.location});
Future<Map<String, dynamic>> toJson() async{
final Map<String, dynamic> data = new Map<String, dynamic>();
data['OrderID'] = this.orderID;
data['Latitude'] = "${this.location.latitude}";
data['Longitude'] = "${this.location.longitude}";
Map profile = await AppSharedPreferences().getObject(USER_PROFILE);
AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile);
data['DriverID'] = doctorProfile?.iD;
data['UserID'] = '${doctorProfile?.iD}';
return data;
}
}

@ -9,9 +9,6 @@ class AuthenticationService extends BaseService {
bool isLoading = true;
AuthenticatedUser authenticatedUser;
String token;
String loginTokenId;
String tokenID;
int userID;
AuthenticationService() {
// getUserAuthentication();
@ -35,67 +32,4 @@ class AuthenticationService extends BaseService {
throw error;
}
}
getOpt(int driverId) async {
hasError = false;
userID = driverId;
try {
await baseAppClient.post(GET_OPT,
onSuccess: (dynamic response, int statusCode) {
loginTokenId = response['LogInTokenID'];
print(response['ActivationCode']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {"DriverID": driverId});
} catch (error) {
hasError = true;
super.error = error;
throw error;
}
}
changePassword(String password, String confirmPassword) async {
hasError = false;
try {
await baseAppClient.post(CHANGE_FORGOT_PASSWORD,
onSuccess: (dynamic response, int statusCode) {
loginTokenId = response['LogInTokenID'];
print(response['ActivationCode']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"TokenID": tokenID,
"NewPassword": password,
"ConfirmPassword": confirmPassword,
"UserID": userID
});
} catch (error) {
hasError = true;
super.error = error;
throw error;
}
}
checkActivationCode(int activationCode) async {
hasError = false;
try {
await baseAppClient.post(CHECK_ACTIVATION_CODE,
onSuccess: (dynamic response, int statusCode) {
tokenID = response['TokenID'];
print(response['ActivationCode']);
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {
"LogInTokenID": loginTokenId,
"activationCode": activationCode
});
} catch (error) {
hasError = true;
super.error = error;
throw error;
}
}
}

@ -16,23 +16,21 @@ AppSharedPreferences sharedPref = new AppSharedPreferences();
/// body: null);
class BaseAppClient {
String _Statictoken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9";
post(
String endPoint, {
Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
post(
String endPoint, {
Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure,
}) async {
String url = BASE_URL + endPoint;
try {
Map profile = await sharedPref.getObject(USER_PROFILE);
String token = await sharedPref.getString(TOKEN);
if (profile != null) {
AuthenticatedUser doctorProfile = AuthenticatedUser.fromJson(profile);
if(!body.keys.contains('DriverID') || body['DriverID'] == null)
body['DriverID'] = doctorProfile?.userID;
if(!body.keys.contains('UserID') || body['UserID'] == null)
body['UserID'] = '${doctorProfile?.userID}';
body['DriverID'] = doctorProfile?.userID;
body['CreatedBy'] = doctorProfile?.userID;
body['UserID'] = '${doctorProfile?.userID}';
body['TokenID'] = token;
body['MobileNo'] = doctorProfile?.mobileNumber;
}
@ -47,8 +45,7 @@ class BaseAppClient {
body: json.encode(body),
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Statictoken': _Statictoken
'Accept': 'application/json'
});
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400 || json == null) {
@ -59,11 +56,11 @@ class BaseAppClient {
// await helpers.logout();
//helpers.showErrorToast('Your session expired Please login agian');
// TODO create logout fun
onFailure("Unauthorized", 401);
} else if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'],
statusCode);
}
}
} else {
@ -74,66 +71,4 @@ class BaseAppClient {
onFailure(e.toString(), -1);
}
}
get(
String endPoint, {
Map<String, dynamic> body,
Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
String url = BASE_URL + endPoint;
try {
if (await Utils.checkConnection()) {
final response = await http.get(url,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Statictoken': _Statictoken
});
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400 || json == null) {
onFailure('Error While Fetching data', statusCode);
} else {
var parsed = json.decode(response.body.toString());
if (parsed['MessageStatus'] == 1) {
onSuccess(parsed, statusCode);
} else {
onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], statusCode);
}
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
} catch (e) {
print(e);
onFailure(e.toString(), -1);
}
}
simpleGet(
String url,
{ Function(dynamic response, int statusCode) onSuccess,
Function(String error, int statusCode) onFailure}) async {
try {
if (await Utils.checkConnection()) {
final response = await http.get(url,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Statictoken': _Statictoken
});
final int statusCode = response.statusCode;
if (statusCode < 200 || statusCode >= 400) {
onFailure('Error While Fetching data', statusCode);
} else {
onSuccess(response.body, statusCode);
}
} else {
onFailure('Please Check The Internet Connection', -1);
}
} catch (e) {
print(e);
onFailure(e.toString(), -1);
}
}
}

@ -1,141 +0,0 @@
import 'dart:collection';
import 'dart:math';
import 'package:driverapp/config/config.dart';
import 'package:driverapp/config/shared_pref_kay.dart';
import 'package:driverapp/core/model/StatusModel.dart';
import 'package:driverapp/core/model/order_delivey/request_initiate_order_delivery.dart';
import 'package:driverapp/core/model/order_delivey/request_validate_delivery.dart';
import 'package:driverapp/core/model/orders/pending_orders_res_model.dart';
import 'package:driverapp/core/model/update_driver_location/request_update_driver_location.dart';
import 'package:driverapp/core/service/base_service.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:flutter/cupertino.dart';
import 'package:latlong/latlong.dart';
import 'package:location/location.dart';
import 'package:shared_preferences/shared_preferences.dart';
class DeliveryTrackingServices extends BaseService {
var _distanceFilter = 20; // [Meters] (Call update API if distance covered from last location is greater then 'value' )
Future<ResponseModel> initiateOrderDelivery(PendingOrdersRes order) async {
hasError = false;
var testNumber = "";
ResponseModel result;
// var orderRequest = RequestInitiateOrderDelivery(orderNo: order.ePharmacyOrderNo, mobileNumber: testNumber == "" ? order.mobileNumber : testNumber);
var fullUrl = BASE_URL + INITIATE_DELIVERY + "/${order.ePharmacyOrderNo}/${user.iD}";
await baseAppClient.simpleGet(fullUrl,
onSuccess: (dynamic response, int statusCode) {
result = ResponseModel(isSuccessful: true,message: null, data: response);
startLocationUpdate(order.ePharmacyOrderNo);
}, onFailure: (String error, int statusCode) {
result = ResponseModel(isSuccessful: false,message: error,data: null);
});
return result;
}
Future<ResponseModel> validateDelivery(PendingOrdersRes order, String pinCode) async{
hasError = false;
var request = RequestValidateDelivery(orderNo: order.ePharmacyOrderNo, pinCode: pinCode);
ResponseModel result;
await baseAppClient.post(VERIFY_DELIVERY,
onSuccess: (dynamic response, int statusCode) {
result = ResponseModel(isSuccessful: true,message: null, data: response);
}, onFailure: (String error, int statusCode) {
result = ResponseModel(isSuccessful: false,message: error,data: null);
}, body: request.toJson());
return result;
}
_updateDriverLocation(int orderID, LocationData location) async {
if(location != null){
debugPrint("Updating driver location");
var jsonBody = await RequestUpdateDriverLocation(orderID: orderID, location: location).toJson();
await baseAppClient.post(UPDATE_DRIVER_LOCATION,
onSuccess: (dynamic response, int statusCode) {
}, onFailure: (String errorMessage, int statusCode) {
if(statusCode == 200){
// Server responded but check failed (stop updating location)
// stopLocationUpdate(orderID);
// Show error message that you received in response
}
}, body: jsonBody);
}
}
Map _currentRunnings = Map<String,Future>();
Future<Object> startLocationUpdate(int orderID, {int frequencyInSeconds = 3}) async {
if (_currentRunnings[orderID.toString()] == null){
_currentRunnings[orderID.toString()] = Future.doWhile(() async{
await Future.delayed(Duration(seconds: frequencyInSeconds));
var valid = _currentRunnings.containsKey(orderID.toString());
if(valid){
Utils.possibleToGetLocation((value) async{
if(value){
var location = await Utils.getLocation();
if (_haveEnoughLocationUpdate(location))
await _updateDriverLocation(orderID, location);
}
});
}
return valid;
});
}
SharedPreferences.getInstance().then((pref){
pref.setStringList(ACTIVE_DELIVERIES, _currentRunnings.keys.toList());
});
}
bool isActiveDeliveringOrder(int ePharmacyOrderNo){
return _currentRunnings.containsKey(ePharmacyOrderNo.toString());
}
List<String> getActiveDeliveringOrders(){
return _currentRunnings.keys.toList(growable: false);
}
setActiveDeliveringOrders(List<String> orders){
orders.forEach((element) {
if(!_currentRunnings.containsKey(element)){
_currentRunnings[element] = null;
}
});
}
clearActiveDeliveringOrders(){
_currentRunnings.clear();
SharedPreferences.getInstance().then((pref){
pref.setStringList(ACTIVE_DELIVERIES, _currentRunnings.keys.toList());
});
}
stopLocationUpdate(int orderID){
_currentRunnings.remove(orderID.toString());
SharedPreferences.getInstance().then((pref){
pref.setStringList(ACTIVE_DELIVERIES, _currentRunnings.keys.toList());
});
}
LocationData _lastLocation;
bool _haveEnoughLocationUpdate(LocationData location){
_lastLocation = _lastLocation ?? location;
var distanceCovered = Utils.distanceBetween(_lastLocation, location, LengthUnit.Meter);
// debugPrint("distance: $distanceCovered");
return (distanceCovered > _distanceFilter);
}
}

@ -1,4 +1,5 @@
import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/model/orders/deliverd_order_req_model.dart';
import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart';
import 'package:driverapp/core/model/orders/next_order_request_model.dart';
import 'package:driverapp/core/model/orders/pending_orders_req_model.dart';
@ -21,19 +22,26 @@ class OrdersService extends BaseService {
List<PendingOrdersRes> get nextOrdersList => _nextOrdersList;
bool isOrderInserted;
bool isOrderStatusUpdated;
int listCountDelivered;
int listCountUnDelivered;
Future getPendingOrders(int driverAppPageID) async {
DeliverdOrderModel _requestGetDeliveredOrders = DeliverdOrderModel(
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: "24.640000",
longitude: "46.753000",
);
Future getPendingOrders() async {
LocationData loc = await Utils.getLocation();
if (loc != null) {
PendingOrders _requestGetPendingOrders = PendingOrders(
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: loc.latitude.toString(),
longitude: loc.longitude.toString(),
driverAppPageID: driverAppPageID);
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: loc.latitude.toString(),
longitude: loc.longitude.toString(),
);
hasError = false;
try {
await baseAppClient.post(GET_ALL_ORDERS,
@ -62,7 +70,6 @@ class OrdersService extends BaseService {
await baseAppClient.post(SCAN_QR,
onSuccess: (dynamic response, int statusCode) {
isOrderInserted = response["PatientER_Delivery_IsOrderInserted"];
listCountUnDelivered++;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -74,26 +81,6 @@ class OrdersService extends BaseService {
}
}
Future getOrdersStatus() async {
hasError = false;
try {
await baseAppClient.post(GET_ALL_ORDERS_STATUS,
onSuccess: (dynamic response, int statusCode) {
listCountDelivered =
response["PatientER_CountOrderList"][0]["NumberOfDeliveredOrder"];
listCountUnDelivered =
response["PatientER_CountOrderList"][0]["NumberOfUnDeliveredOrder"];
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
}, body: {});
} catch (e) {
hasError = true;
super.error = error;
throw e;
}
}
Future updateOrderStatus(
UpdateOrderStatusRequestModel updateOrderStatusRequestModel) async {
hasError = false;
@ -101,8 +88,6 @@ class OrdersService extends BaseService {
await baseAppClient.post(UPDATE_ORDER_STATUS,
onSuccess: (dynamic response, int statusCode) {
isOrderStatusUpdated = response["PatientER_Delivery_IsOrderUpdated"];
listCountUnDelivered--;
listCountDelivered++;
}, onFailure: (String error, int statusCode) {
hasError = true;
super.error = error;
@ -136,12 +121,12 @@ class OrdersService extends BaseService {
Future getDeliveredList() async {
LocationData loc = await Utils.getLocation();
PendingOrders _requestGetPendingOrders = PendingOrders(
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: loc.latitude.toString(),
longitude: loc.longitude.toString(),
driverAppPageID: 0);
searchKey: "",
pageSize: 0,
pageIndex: 0,
latitude: loc.latitude.toString(),
longitude: loc.longitude.toString(),
);
if (loc != null) {
hasError = false;
try {

@ -13,7 +13,6 @@ class AuthenticationViewModel with ChangeNotifier {
AuthenticationService _authenticationService =
locator<AuthenticationService>();
AuthenticatedUser user;
int get userId => _authenticationService.userID;
bool isLogin = false;
bool isLoading = false;
bool isError = false;
@ -81,54 +80,6 @@ class AuthenticationViewModel with ChangeNotifier {
}
}
getOpt(int driverID) async {
isLoading = true;
notifyListeners();
await _authenticationService.getOpt(driverID);
if (_authenticationService.hasError) {
error = _authenticationService.error;
isLoading = false;
isError = true;
notifyListeners();
} else {
isLoading = false;
isError = false;
notifyListeners();
}
}
changePassword(String password, String confirmPassword) async {
isLoading = true;
notifyListeners();
await _authenticationService.changePassword(password, confirmPassword);
if (_authenticationService.hasError) {
error = _authenticationService.error;
isLoading = false;
isError = true;
notifyListeners();
} else {
isLoading = false;
isError = false;
notifyListeners();
}
}
checkActivationCode(int driverID) async {
isLoading = true;
notifyListeners();
await _authenticationService.checkActivationCode(driverID);
if (_authenticationService.hasError) {
error = _authenticationService.error;
isLoading = false;
isError = true;
notifyListeners();
} else {
isLoading = false;
isError = false;
notifyListeners();
}
}
logout() async {
isLoading = false;
isError = false;

@ -1,20 +1,16 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/StatusModel.dart';
import 'package:driverapp/core/model/orders/deliverd_order_res_model.dart';
import 'package:driverapp/core/model/orders/next_order_request_model.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/model/scan_qr/scan_qr_request_model.dart';
import 'package:driverapp/core/service/delivery_tracking_services.dart';
import 'package:driverapp/core/service/orders_service.dart';
import 'package:flutter/cupertino.dart';
import '../../locator.dart';
import 'base_view_model.dart';
class OrdersViewModel extends BaseViewModel {
OrdersService _ordersService = locator<OrdersService>();
DeliveryTrackingServices deliveryService = locator<DeliveryTrackingServices>();
List<PendingOrdersRes> get orders => _ordersService.orders;
@ -24,23 +20,9 @@ class OrdersViewModel extends BaseViewModel {
List<PendingOrdersRes> get nextOrdersList => _ordersService.nextOrdersList;
bool isBottomSheetAppear = false;
int get listCountDelivered => _ordersService.listCountDelivered;
int get listCountUnDelivered => _ordersService.listCountUnDelivered;
Future getPendingOrders(int driverAppPageID) async {
setState(ViewState.Busy);
await _ordersService.getPendingOrders(driverAppPageID);
if (_ordersService.hasError) {
error = _ordersService.error;
setState(ViewState.Error);
} else
setState(ViewState.Idle);
}
Future getOrdersStatus() async {
Future getPendingOrders() async {
setState(ViewState.Busy);
await _ordersService.getOrdersStatus();
await _ordersService.getPendingOrders();
if (_ordersService.hasError) {
error = _ordersService.error;
setState(ViewState.Error);
@ -48,7 +30,7 @@ class OrdersViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future getDeliveredOrders() async {
Future getDeliverdOrders() async {
setState(ViewState.Busy);
await _ordersService.getDeliveredList();
if (_ordersService.hasError) {
@ -68,37 +50,15 @@ class OrdersViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future<ResponseModel> updateOrderStatus({@required int orderNo, @required int status, String rejectionReason}) async {
var updateOrderStatusRequestModel
= UpdateOrderStatusRequestModel(
deliveryOrderID: orderNo,
deliveryOrderStatus: status,
rejectionReason: rejectionReason,
cancleReason: rejectionReason);
Future updateOrderStatus(
UpdateOrderStatusRequestModel updateOrderStatusRequestModel) async {
setState(ViewState.BusyLocal);
await _ordersService.updateOrderStatus(updateOrderStatusRequestModel);
if (_ordersService.hasError) {
error = _ordersService.error;
setState(ViewState.ErrorLocal);
return ResponseModel(isSuccessful: false, message: error);
} else {
} else
setState(ViewState.Idle);
if(status == 2)
moveOrderFromPendingToDelivered(orderNo);
return ResponseModel(isSuccessful: true, message: "Successful");
}
}
moveOrderFromPendingToDelivered(int orderNo) async{
var idx = orders.indexWhere((element) => element.ePharmacyOrderNo == orderNo);
var order = orders[idx];
orders.removeAt(idx);
var order_delivered = DeliverdOrderResModel.fromJson(order.toJson());
order_delivered.description = "Delivered";
order_delivered.descriptionN = "Delivered";
deliverdOrders.add(order_delivered);
}
Future nextOrder(NextOrderRequestModel nextOrderRequestModel) async {
@ -111,31 +71,6 @@ class OrdersViewModel extends BaseViewModel {
setState(ViewState.Idle);
}
Future initDelivery(PendingOrdersRes order, {Function(@required ResponseModel response) completion}) async{
var response = await deliveryService.initiateOrderDelivery(order);
completion(response ?? ResponseModel(isSuccessful: false,message: "Something went wrong, Please try again later."));
return response;
// (true, response['ErrorEndUserMessage'] ?? response['ErrorMessage'] ?? "Successfully, Please start navigation.")
}
Future<ResponseModel> validateDelivery(PendingOrdersRes order, String pinCode) async{
return await deliveryService.validateDelivery(order, pinCode);
}
Future<ResponseModel> resendOtpToReceiver(PendingOrdersRes order) async{
// return await _deliveryService.validateDelivery(order, pinCode);
}
bool isActiveDeliveringOrder(int index){
return deliveryService.isActiveDeliveringOrder(orders[index].ePharmacyOrderNo);
}
Future<List<String>> getActiveDeliveringOrders() async{
return deliveryService.getActiveDeliveringOrders();
}
showBottomSheet() {
isBottomSheetAppear = true;
setState(ViewState.Idle);

@ -1,4 +1,3 @@
import 'package:driverapp/core/service/delivery_tracking_services.dart';
import 'package:get_it/get_it.dart';
import 'core/service/authentication_service.dart';
@ -16,7 +15,6 @@ void setupLocator() {
locator.registerLazySingleton(() => HospitalService());
locator.registerLazySingleton(() => AuthenticationService());
locator.registerLazySingleton(() => OrdersService());
locator.registerLazySingleton(() => DeliveryTrackingServices());
/// View Model
locator.registerFactory(() => HospitalViewModel());

@ -1,14 +1,9 @@
import 'package:driverapp/core/service/delivery_tracking_services.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/pages/splash_screen_page.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'config/shared_pref_kay.dart';
import 'config/size_config.dart';
import 'core/viewModels/authentication_view_model.dart';
import 'core/viewModels/project_view_model.dart';
@ -19,30 +14,9 @@ void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget with WidgetsBindingObserver{
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
if(state == AppLifecycleState.paused){
debugPrint("....App paused....");
}else if(state == AppLifecycleState.resumed){
debugPrint("....App resumed....");
}
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
WidgetsBinding.instance.addObserver(this);
SharedPreferences.getInstance().then((value){
var activeOrders = value.getStringList(ACTIVE_DELIVERIES) ?? [];
locator<DeliveryTrackingServices>().setActiveDeliveringOrders(activeOrders);
});
return LayoutBuilder(
builder: (context, constraints) {
return OrientationBuilder(
@ -56,9 +30,6 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver{
ChangeNotifierProvider<AuthenticationViewModel>(
create: (context) => AuthenticationViewModel(),
),
ChangeNotifierProvider<OrdersViewModel>(
create: (context) => OrdersViewModel(),
),
],
child: Consumer<ProjectViewModel>(
builder: (context, projectProvider, child) => MaterialApp(
@ -110,9 +81,9 @@ class MyApp extends StatelessWidget with WidgetsBindingObserver{
),
),
),
// home: SplashScreenPage(),
initialRoute: '/',
routes: {'/': (context) => SplashScreenPage()},
home: SplashScreenPage(),
// initialRoute: '/',
// routes: {'/': (context) => RootPage()},
debugShowCheckedModeBanner: false,
),
),

@ -1,453 +0,0 @@
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/config/config.dart';
import 'package:driverapp/config/size_config.dart';
import 'package:driverapp/core/model/authentication/login_request.dart';
import 'package:driverapp/core/model/orders/pending_orders_res_model.dart';
import 'package:driverapp/core/service/delivery_tracking_services.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/locator.dart';
import 'package:driverapp/pages/authentication/reset_password_page.dart';
import 'package:driverapp/pages/delivery/delivery_confirmed_page.dart';
import 'package:driverapp/uitl/app_toast.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'package:sweetalert/sweetalert.dart';
import 'forget_password_page.dart';
// ignore: must_be_immutable
class DeliveryVerificationPage extends StatelessWidget {
final PendingOrdersRes order;
DeliveryVerificationPage({this.order});
ProjectViewModel _projectViewModel;
OrdersViewModel _ordersViewModel;
final formKey = GlobalKey<FormState>();
Map formValues = {
'digit1': null,
'digit2': null,
'digit3': null,
'digit4': null,
};
FocusNode focusD1 = FocusNode();
FocusNode focusD2 = FocusNode();
FocusNode focusD3 = FocusNode();
FocusNode focusD4 = FocusNode();
var model;
TextEditingController digit1 = TextEditingController(text: "");
TextEditingController digit2 = TextEditingController(text: "");
TextEditingController digit3 = TextEditingController(text: "");
TextEditingController digit4 = TextEditingController(text: "");
bool _isLoading = false;
SizedBox buildSizedBox([double height = 20]) {
return SizedBox(
height: height,
);
}
BuildContext _context;
@override
Widget build(BuildContext context) {
_context = context;
_projectViewModel = Provider.of(context);
_ordersViewModel = Provider.of(context);
String validateCodeDigit(value) {
if (value.isEmpty) {
return 'Please enter your Password';
}
return null;
}
return AnimatedSwitcher(
duration: Duration(milliseconds: 2000),
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: 30,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.deliverd_icon,
size: 150,
color: Theme.of(context).primaryColor,
),
margin: EdgeInsets.only(
top: 20,
),
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Center(
child: Text(
"Verification",
style: TextStyle(
fontSize: 25,
letterSpacing: 1,
fontWeight: FontWeight.w600),
),
),
],
),
SizedBox(
height: 30,
),
SizedBox(
height: 10,
),
Form(
key: formKey,
child: Container(
width: SizeConfig.realScreenWidth * 0.90,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterCustomerVerificationCodeMsg,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 13,
color: Colors.grey),
),
),
SizedBox(
height: 10,
)
],
),
),
buildSizedBox(30),
Center(
child: FractionallySizedBox(
widthFactor: 0.80,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
width: 55,
height: 55,
color: Colors.transparent,
child: Center(
child: TextFormField(
textInputAction:
TextInputAction.next,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
focusNode: focusD1,
controller: digit1,
enableInteractiveSelection: false,
showCursor: false,
maxLength: 1,
textAlign: TextAlign.center,
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
onSaved: (val) {
formValues[
'digit1'] = val;
},
validator: validateCodeDigit,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD2);
},
onChanged: (val) => val.isNotEmpty
? FocusScope.of(context).requestFocus(focusD2)
: FocusScope.of(context).requestFocus(focusD1)
),
),
),
Container(
width: 55,
height: 55,
color: Colors.transparent,
child: Center(
child: TextFormField(
focusNode: focusD2,
controller: digit2,
enableInteractiveSelection: false,
showCursor: false,
maxLength: 1,
textInputAction:
TextInputAction.next,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
formValues[
'digit2'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD3);
},
onChanged: (val) => val.isNotEmpty
? FocusScope.of(context).requestFocus(focusD3)
: FocusScope.of(context).requestFocus(focusD1)
),
),
),
Container(
width: 55,
height: 55,
color: Colors.transparent,
child: Center(
child: TextFormField(
focusNode: focusD3,
controller: digit3,
enableInteractiveSelection: false,
showCursor: false,
maxLength: 1,
textInputAction: TextInputAction.next,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier * 3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
formValues[
'digit3'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) => val.isNotEmpty
? FocusScope.of(context).requestFocus(focusD4)
: FocusScope.of(context).requestFocus(focusD2),
),
)),
Container(
width: 55,
height: 55,
color: Colors.transparent,
child: Center(
child: TextFormField(
focusNode: focusD4,
controller: digit4,
enableInteractiveSelection: false,
showCursor: false,
maxLength: 1,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
formValues[
'digit4'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) => val.isNotEmpty
? FocusScope.of(context).requestFocus(focusD4)
: FocusScope.of(context).requestFocus(focusD3)
),
),
)
],
),
),
),
buildSizedBox(20),
// ShowTimerText(model: model),
])))
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),
height: MediaQuery.of(context).size.height * 0.22,
child: Column(
children: <Widget>[
SecondaryButton(
label: "Verify Receiver",
onTap: () {
_verifyCustomer();
},
disabled: _isLoading,
loading: _isLoading,
),
SizedBox(
height: 10,
),
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// InkWell(
// onTap: () {
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(
// builder: (context) =>
// ForgetPasswordPage()),
// );
// },
// child: InkWell(
// onTap: () async {
// await _ordersViewModel.resendOtpToReceiver(order);
// },
// child: Text(
// "Resend OPT?",
// style: TextStyle(
// fontSize: 14,
// color: Theme.of(context).primaryColor),
// ),
// ),
// ),
// ],
// ),
],
))
],
),
),
),
);
}
TextStyle buildTextStyle() {
return TextStyle(
fontSize: SizeConfig.textMultiplier * 3,
);
}
InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration(
filled: true,
fillColor: Colors.white,
// ts/images/password_icon.png
contentPadding: EdgeInsets.only(top: 30, bottom: 30),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.grey),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor, width: 2),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor, width: 2),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor, width: 2),
),
counterText: "",
errorStyle: TextStyle(height: 0.0)
);
}
_verifyCustomer() async {
if (formKey.currentState.validate()) {
final pinCode = digit1.text + digit2.text + digit3.text + digit4.text;
formKey.currentState.save();
SweetAlert.show(_context, subtitle: "Please wait...", style: SweetAlertStyle.loading);
var results = await _ordersViewModel.validateDelivery(order, pinCode);
if (results != null && results.isSuccessful) {
results = await _ordersViewModel.updateOrderStatus(orderNo: order.orderID, status: DeliveryStatus.delivered);
popWithDelay(context: _context, seconds: 0.2, callback: (){
if(results.isSuccessful){
_goToDeliveryDoneConfirmation();
}else{
Utils.showErrorToast(results.message);
}
});
}else{
Navigator.of(_context).pop();
Utils.showErrorToast(results.message);
}
}
}
_goToDeliveryDoneConfirmation(){
locator<DeliveryTrackingServices>().stopLocationUpdate(order.ePharmacyOrderNo); // Stop Driver Location update for Order
Navigator.pushReplacement(
_context,
MaterialPageRoute(
builder: (context) => DeliveryConfirmedPage(order),
),
);
}
}

@ -1,195 +0,0 @@
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/pages/authentication/verification_page.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/input/text_field.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import '../../root_page.dart';
// ignore: must_be_immutable
class ForgetPasswordPage extends StatelessWidget {
final forgetPasswordFormKey = GlobalKey<FormState>();
int driverID;
ProjectViewModel projectViewModel;
AuthenticationViewModel authenticationViewModel;
getOpt(BuildContext context) async {
if (forgetPasswordFormKey.currentState.validate()) {
forgetPasswordFormKey.currentState.save();
await authenticationViewModel.getOpt(driverID);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
} else {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => VerificationPage()),
);
}
}
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context);
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.25,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.qustion_mark,
size: 150,
color: Theme.of(context).primaryColor,
),
margin: EdgeInsets.only(
top: 20,
),
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Center(
child: Text(
"Forgot Password?",
style: TextStyle(
fontSize: 25,
letterSpacing: 1,
fontWeight: FontWeight.w600),
),
),
],
),
SizedBox(
height: 30,
),
SizedBox(
height: 10,
),
Form(
key: forgetPasswordFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterForgetIdMsg,
style: TextStyle(
fontSize: 13, color: Colors.grey),
),
),
SizedBox(
height: 10,
)
],
),
),
SizedBox(
height: 10,
),
Container(
child: TextFields(
hintText: TranslationBase.of(context).enterId,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
.pleaseEnterYourID;
}
return null;
},
onSaved: (value) {
driverID = int.parse(value.trim());
},
),
),
SizedBox(
height: 20,
),
],
),
),
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),
height: MediaQuery.of(context).size.height * 0.22,
child: Column(
children: <Widget>[
SecondaryButton(
label: TranslationBase.of(context).getOPT,
onTap: () async {
await getOpt(context);
},
disabled: authenticationViewModel.isLoading,
loading: authenticationViewModel.isLoading,
),
SizedBox(
height: 30,
),
SecondaryButton(
label: TranslationBase.of(context).cancel,
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => RootPage()),
);
},
color: Color(0xffE9F1F1),
borderColor: Colors.black54,
textColor: Theme.of(context).primaryColor,
),
],
))
],
),
),
),
),
);
}
}

@ -13,29 +13,27 @@ import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'forget_password_page.dart';
class LoginPage extends StatelessWidget {
LoginRequest loginRequest = LoginRequest();
final loginFormKey = GlobalKey<FormState>();
ProjectViewModel projectViewModel;
AuthenticationViewModel authenticationViewModel;
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context);
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: AppScaffold(
@ -46,66 +44,59 @@ class LoginPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: 70,
color: Theme.of(context).primaryColor,
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: 40,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: 70,
color: Theme.of(context).primaryColor,
),
margin: EdgeInsets.only(
right: projectViewModel.isArabic
? 0
: MediaQuery.of(context).size.width *
0.15,
left: !projectViewModel.isArabic
? 0
: MediaQuery.of(context).size.width *
0.15),
),
margin: EdgeInsets.only(
top: 20,
right: projectViewModel.isArabic
? 0
: MediaQuery
.of(context)
.size
.width *
0.15,
left: !projectViewModel.isArabic
? 0
: MediaQuery
.of(context)
.size
.width *
0.15),
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: 50, fontWeight: FontWeight.bold),
),
Text(
"Delivery",
style: TextStyle(fontSize: 36, letterSpacing: 1),
),
Text(
"APP",
style: TextStyle(
fontSize: 33,
letterSpacing: 33,
fontWeight: FontWeight.w400),
),
],
),
SizedBox(
height: 30,
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: 50, fontWeight: FontWeight.bold),
),
Text(
"Delivery",
style: TextStyle(fontSize: 36, letterSpacing: 1),
),
Text(
"APP",
style: TextStyle(
fontSize: 33,
letterSpacing: 33,
fontWeight: FontWeight.w400),
),
],
),
SizedBox(
height: 30,
),
// Row(
// mainAxisAlignment: MainAxisAlignment.center,
@ -152,48 +143,47 @@ class LoginPage extends StatelessWidget {
// : Colors.transparent),
// ],
// ),
SizedBox(
height: 10,
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterCredentialsMsg,
style: TextStyle(
fontSize: 13, color: Colors.grey),
SizedBox(
height: 10,
),
Form(
key: loginFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterCredentialsMsg,
style: TextStyle(
fontSize: 13, color: Colors.grey),
),
),
),
SizedBox(
height: 10,
)
],
SizedBox(
height: 10,
)
],
),
),
),
SizedBox(
height: 10,
),
Container(
child: TextFields(
hintText: TranslationBase.of(context).enterId,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
.pleaseEnterYourID;
}
return null;
},
SizedBox(
height: 10,
),
Container(
child: TextFields(
hintText: TranslationBase.of(context).enterId,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
.pleaseEnterYourID;
}
return null;
},
onSaved: (value) {
loginRequest.userID = int.parse(value.trim());
},
@ -206,7 +196,7 @@ class LoginPage extends StatelessWidget {
child: TextFields(
borderRadiusValue: 6,
hintText:
TranslationBase.of(context).enterPassword,
TranslationBase.of(context).enterPassword,
validator: (value) {
if (value.isEmpty) {
return TranslationBase.of(context)
@ -223,44 +213,30 @@ class LoginPage extends StatelessWidget {
SizedBox(
height: 25,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
InkWell(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ForgetPasswordPage()
),
);
},
child: Text(
TranslationBase
.of(context)
.forgotPassword,
style: TextStyle(
fontSize: 14,
color: Theme
.of(context)
.primaryColor),
),
),
],
),
//ToDo when forget page functions ready
// Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: <Widget>[
// Text(
// TranslationBase.of(context).forgotPassword,
// style: TextStyle(
// fontSize: 14,
// color: Theme.of(context).primaryColor),
// ),
// ],
// ),
],
),
),
],
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),

@ -1,200 +0,0 @@
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/root_page.dart';
import 'package:driverapp/uitl/app_toast.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/input/text_field.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
// ignore: must_be_immutable
class RestPasswordPage extends StatelessWidget {
final forgetPasswordFormKey = GlobalKey<FormState>();
// String password;
// String confirmedPassword;
ProjectViewModel projectViewModel;
AuthenticationViewModel authenticationViewModel;
TextEditingController password = TextEditingController(text: "");
TextEditingController confirmedPassword = TextEditingController(text: "");
changePassword(BuildContext context) async {
if (forgetPasswordFormKey.currentState.validate()) {
forgetPasswordFormKey.currentState.save();
await authenticationViewModel.changePassword(
password.text, confirmedPassword.text);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
} else {
AppToast.showSuccessToast(
message: "Your Password changed successfully");
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => RootPage()),
);
}
}
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context);
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.25,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.qustion_mark,
size: 150,
color: Theme.of(context).primaryColor,
),
margin: EdgeInsets.only(
top: 20,
),
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Center(
child: Text(
"Rest Password",
style: TextStyle(
fontSize: 25,
letterSpacing: 1,
fontWeight: FontWeight.w600),
),
),
],
),
SizedBox(
height: 30,
),
SizedBox(
height: 10,
),
Form(
key: forgetPasswordFormKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Container(
child: TextFields(
hintText: "Password",
controller: password,
keyboardType: TextInputType.number,
validator: (value) {
if (value.isEmpty) {
return "Please enter your password";
}
return null;
},
onSaved: (value) {
// password = value;
},
),
),
SizedBox(
height: 20,
),
Container(
child: TextFields(
controller: confirmedPassword,
hintText: "Confirm Password",
keyboardType: TextInputType.text,
validator: (value) {
if (value.isEmpty) {
return "Please enter your confirm password";
}
if (confirmedPassword.text != password.text) {
return "Password your doesn't match your confirm password";
}
return null;
},
onSaved: (value) {
// confirmedPassword = value;
},
),
),
SizedBox(
height: 20,
),
],
),
),
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),
height: MediaQuery.of(context).size.height * 0.22,
child: Column(
children: <Widget>[
SecondaryButton(
label: "Change Password",
onTap: () async {
await changePassword(context);
},
disabled: authenticationViewModel.isLoading,
loading: authenticationViewModel.isLoading,
),
SizedBox(
height: 30,
),
SecondaryButton(
label: TranslationBase.of(context).cancel,
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => RootPage()),
);
},
color: Color(0xffE9F1F1),
borderColor: Colors.black54,
textColor: Theme.of(context).primaryColor,
),
],
))
],
),
),
),
),
);
}
}

@ -1,430 +0,0 @@
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/config/size_config.dart';
import 'package:driverapp/core/model/authentication/login_request.dart';
import 'package:driverapp/core/viewModels/authentication_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/pages/authentication/reset_password_page.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:provider/provider.dart';
import 'forget_password_page.dart';
// ignore: must_be_immutable
class VerificationPage extends StatelessWidget {
LoginRequest loginRequest = LoginRequest();
final loginFormKey = GlobalKey<FormState>();
ProjectViewModel projectViewModel;
AuthenticationViewModel authenticationViewModel;
final verifyAccountForm = GlobalKey<FormState>();
Map verifyAccountFormValue = {
'digit1': null,
'digit2': null,
'digit3': null,
'digit4': null,
};
FocusNode focusD1 = FocusNode();
FocusNode focusD2 = FocusNode();
FocusNode focusD3 = FocusNode();
FocusNode focusD4 = FocusNode();
var model;
TextEditingController digit1 = TextEditingController(text: "");
TextEditingController digit2 = TextEditingController(text: "");
TextEditingController digit3 = TextEditingController(text: "");
TextEditingController digit4 = TextEditingController(text: "");
login() async {
if (loginFormKey.currentState.validate()) {
loginFormKey.currentState.save();
await authenticationViewModel.login(loginRequest);
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
}
}
}
SizedBox buildSizedBox([double height = 20]) {
return SizedBox(
height: height,
);
}
@override
Widget build(BuildContext context) {
projectViewModel = Provider.of(context);
authenticationViewModel = Provider.of(context);
// focusD1 = FocusNode();
// focusD2 = FocusNode();
// focusD3 = FocusNode();
// focusD4 = FocusNode();
String validateCodeDigit(value) {
if (value.isEmpty) {
return 'Please enter your Password';
}
return null;
}
return AnimatedSwitcher(
duration: Duration(microseconds: 350),
child: AppScaffold(
isShowAppBar: false,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).size.height * 0.25,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.exclamation_mark,
size: 150,
color: Theme.of(context).primaryColor,
),
margin: EdgeInsets.only(
top: 20,
),
),
],
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Center(
child: Text(
"Verification",
style: TextStyle(
fontSize: 25,
letterSpacing: 1,
fontWeight: FontWeight.w600),
),
),
],
),
SizedBox(
height: 30,
),
SizedBox(
height: 10,
),
Form(
key: verifyAccountForm,
child: Container(
width: SizeConfig.realScreenWidth * 0.90,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 20),
child: Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: <Widget>[
Expanded(
child: Text(
TranslationBase.of(context)
.enterVerificationMsg,
style: TextStyle(
fontSize: 13,
color: Colors.grey),
),
),
SizedBox(
height: 10,
)
],
),
),
buildSizedBox(30),
Center(
child: FractionallySizedBox(
widthFactor: 0.80,
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: <Widget>[
Container(
width: 55,
height: 55,
color: Colors.white,
child: TextFormField(
textInputAction:
TextInputAction.next,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
focusNode: focusD1,
controller: digit1,
textAlign: TextAlign.center,
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
onSaved: (val) {
verifyAccountFormValue[
'digit1'] = val;
},
validator: validateCodeDigit,
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD2);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context)
.requestFocus(focusD2);
}
},
),
),
Container(
width: 55,
height: 55,
color: Colors.white,
child: TextFormField(
focusNode: focusD2,
controller: digit2,
textInputAction:
TextInputAction.next,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
verifyAccountFormValue[
'digit2'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD3);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context)
.requestFocus(focusD3);
}
},
),
),
Container(
width: 55,
height: 55,
color: Colors.white,
child: TextFormField(
focusNode: focusD3,
controller: digit3,
textInputAction:
TextInputAction.next,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
verifyAccountFormValue[
'digit3'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context)
.requestFocus(
focusD4);
}
},
)),
Container(
width: 55,
height: 55,
color: Colors.white,
child: TextFormField(
focusNode: focusD4,
controller: digit4,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: SizeConfig
.textMultiplier *
3,
),
keyboardType:
TextInputType.number,
decoration:
buildInputDecoration(
context),
validator: validateCodeDigit,
onSaved: (val) {
verifyAccountFormValue[
'digit4'] = val;
},
onFieldSubmitted: (_) {
FocusScope.of(context)
.requestFocus(focusD4);
submit(model, context);
},
onChanged: (val) {
if (val.length == 1) {
FocusScope.of(context)
.requestFocus(
focusD4);
submit(model, context);
}
}),
)
],
),
),
),
buildSizedBox(20),
// ShowTimerText(model: model),
])))
],
),
),
SizedBox(
height: 20,
),
SizedBox(
height: 10,
),
Container(
margin: EdgeInsets.all(10),
height: MediaQuery.of(context).size.height * 0.22,
child: Column(
children: <Widget>[
SecondaryButton(
label: "Verify",
onTap: () {
submit(model, context);
},
disabled: authenticationViewModel.isLoading,
loading: authenticationViewModel.isLoading,
),
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
InkWell(
onTap: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ForgetPasswordPage()),
);
},
child: InkWell(
onTap: () async {
await authenticationViewModel
.getOpt(authenticationViewModel.userId);
},
child: Text(
"Resend OPT?",
style: TextStyle(
fontSize: 14,
color: Theme.of(context).primaryColor),
),
),
),
],
),
],
))
],
),
),
),
),
);
}
TextStyle buildTextStyle() {
return TextStyle(
fontSize: SizeConfig.textMultiplier * 3,
);
}
InputDecoration buildInputDecoration(BuildContext context) {
return InputDecoration(
// ts/images/password_icon.png
contentPadding: EdgeInsets.only(top: 30, bottom: 30),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10)),
borderSide: BorderSide(color: Colors.black),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).primaryColor),
),
errorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
),
focusedErrorBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide: BorderSide(color: Theme.of(context).errorColor),
),
);
}
void submit(AuthenticationViewModel model, BuildContext context) async {
if (verifyAccountForm.currentState.validate()) {
final activationCode =
digit1.text + digit2.text + digit3.text + digit4.text;
await authenticationViewModel
.checkActivationCode(int.parse(activationCode));
if (authenticationViewModel.isError) {
Utils.showErrorToast(authenticationViewModel.error);
} else {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => RestPasswordPage()),
);
}
}
}
}

File diff suppressed because it is too large Load Diff

@ -1,242 +0,0 @@
import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/orders/next_order_request_model.dart';
import 'package:driverapp/core/model/orders/pending_orders_res_model.dart';
import 'package:driverapp/core/service/orders_service.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/locator.dart';
import 'package:driverapp/pages/base/base_view.dart';
import 'package:driverapp/root_page.dart';
import 'package:driverapp/uitl/utils.dart';
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';
import 'information_page.dart';
class DeliveryCancelRejectedPage extends StatelessWidget {
final PendingOrdersRes item;
DeliveryCancelRejectedPage(this.item);
@override
Widget build(BuildContext context) {
return BaseView<OrdersViewModel>(
builder: (_, model, w) => AppScaffold(
isAppBarGradient: true,
isShowAppBar: true,
appBarColor: Theme.of(context).primaryColor,
arrowColor: Colors.white,
titleColor: Colors.white,
body: SafeArea(
child: Container(
//
child: ListView(
children: <Widget>[
Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(gradient: LINEAR_GRADIENT),
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 1
: MediaQuery.of(context).size.width * 1,
child: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.7
: MediaQuery.of(context).size.width * 0.5,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.14,
),
decoration: BoxDecoration(
color: Colors.white10, shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
Icons.check_circle,
color: Colors.white,
size: 75,
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.03,
),
Text(
'Delivery Confirmed',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.01,
),
Text(
TranslationBase.of(context).confirmationSent,
style: TextStyle(
color: Colors.white,
fontSize: 13,
),
),
],
),
),
],
),
),
// Container(
// width: MediaQuery.of(context).size.width,
// height: MediaQuery.of(context).size.width,
// ),
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).orientation ==
Orientation.landscape
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 1.0,
margin: EdgeInsets.only(
top: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.70
: MediaQuery.of(context).size.width * 0.60,
),
decoration: BoxDecoration(
color: Theme
.of(context)
.scaffoldBackgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
topRight: Radius.circular(80)),
),
child: Column(
mainAxisAlignment: MediaQuery.of(context).orientation ==
Orientation.landscape
? MainAxisAlignment.center
: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
margin: EdgeInsets.only(
bottom: MediaQuery.of(context).size.width * 0.00,
),
child: Padding(
padding: MediaQuery.of(context).orientation ==
Orientation.landscape
? EdgeInsets.only(top: 60.0)
: EdgeInsets.only(top: 30.0),
child: Column(
children: <Widget>[
// TODO return add note when its needed
// FlatButton.icon(
// padding: EdgeInsets.all(14.0),
// color: Colors.orangeAccent,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10.0),
// ),
// label: Text(
// TranslationBase.of(context).addNoteBtn,
// style: TextStyle(
// color: Colors.white, fontSize: 20.0),
// ),
// icon: Icon(
// Icons.mode_edit,
// color: Colors.white,
// ),
// onPressed: () {},
// ),
// SizedBox(
// height: MediaQuery.of(context).size.width *
// 0.00, //20,
// ),
Padding(
padding: const EdgeInsets.only(top: 30.0),
child: Container(
margin: EdgeInsets.all(10),
child: SecondaryButton(
label: TranslationBase.of(context)
.nextDelivery,
loading:
model.state == ViewState.BusyLocal,
onTap: () {
getNextOrder(context, model);
},
),
),
),
],
),
),
),
],
),
),
Container(
margin: EdgeInsets.only(
top: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.6
: MediaQuery.of(context).size.width * 0.4,
),
child: CustomerBriefCard(
customerOrderId: item.orderID,
pharmacyOrderId: item.ePharmacyOrderNo,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
distanceInKilometers: item.distanceInKilometers,
showDistance: false,
deliveryTime: item.orderCreatedOn),
),
],
),
],
),
),
),
),
);
}
getNextOrder(BuildContext context, OrdersViewModel model) async {
model.setState(ViewState.BusyLocal);
LocationData loc = await Utils.getLocation();
NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel(
pageIndex: 0,
pageSize: 0,
latitude: loc.latitude.toString(), // "46.621730",
longitude: loc.longitude.toString(), // "24.797682",
searchKey: "");
await model.nextOrder(nextOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
Utils.showErrorToast(model.error);
} else {
if (model.nextOrdersList != null && model.nextOrdersList.length == 0) {
Utils.showErrorToast("No Items in the list");
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => RootPage(),
),
);
} else {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
InformationPage(item: model.nextOrdersList[0]),
),
);
}
}
}
}

@ -2,11 +2,8 @@ import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/orders/next_order_request_model.dart';
import 'package:driverapp/core/model/orders/pending_orders_res_model.dart';
import 'package:driverapp/core/service/orders_service.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/locator.dart';
import 'package:driverapp/pages/base/base_view.dart';
import 'package:driverapp/root_page.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/buttons/secondary_button.dart';
import 'package:driverapp/widgets/delivery/customer_brief_card.dart';
@ -34,64 +31,67 @@ class DeliveryConfirmedPage extends StatelessWidget {
titleColor: Colors.white,
body: SafeArea(
child: Container(
//
decoration: BoxDecoration(gradient: LINEAR_GRADIENT),
child: ListView(
children: <Widget>[
Stack(
children: <Widget>[
Container(
decoration: BoxDecoration(gradient: LINEAR_GRADIENT),
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 1
: MediaQuery.of(context).size.width * 1,
child: Stack(
children: [
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.7
: MediaQuery.of(context).size.width * 0.5,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.14,
),
decoration: BoxDecoration(
color: Colors.white10, shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
Icons.check_circle,
color: Colors.white,
size: 75,
Column(
children: <Widget>[
Container(
child: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.7
: MediaQuery.of(context).size.width * 0.5,
padding: EdgeInsets.only(
top: MediaQuery.of(context).size.width * 0.14,
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.03,
),
Text(
'Delivery Confirmed',
style: TextStyle(
decoration: BoxDecoration(
color: Colors.white10,
shape: BoxShape.circle),
child: Column(
children: <Widget>[
Icon(
Icons.check_circle,
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
SizedBox(
height:
MediaQuery.of(context).size.width * 0.01,
),
Text(
TranslationBase.of(context).confirmationSent,
style: TextStyle(
color: Colors.white,
fontSize: 13,
),
size: 75,
),
SizedBox(
height:
MediaQuery.of(context).size.width *
0.03,
),
Text(
'Delivery Confirmed',
style: TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold),
),
SizedBox(
height:
MediaQuery.of(context).size.width *
0.01,
),
Text(
TranslationBase.of(context)
.confirmationSent,
style: TextStyle(
color: Colors.white,
fontSize: 13,
),
),
],
),
],
),
),
],
),
],
),
),
],
),
// Container(
// width: MediaQuery.of(context).size.width,
@ -110,9 +110,7 @@ class DeliveryConfirmedPage extends StatelessWidget {
: MediaQuery.of(context).size.width * 0.60,
),
decoration: BoxDecoration(
color: Theme
.of(context)
.scaffoldBackgroundColor,
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(80),
topRight: Radius.circular(80)),
@ -135,28 +133,27 @@ class DeliveryConfirmedPage extends StatelessWidget {
: EdgeInsets.only(top: 30.0),
child: Column(
children: <Widget>[
// TODO return add note when its needed
// FlatButton.icon(
// padding: EdgeInsets.all(14.0),
// color: Colors.orangeAccent,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(10.0),
// ),
// label: Text(
// TranslationBase.of(context).addNoteBtn,
// style: TextStyle(
// color: Colors.white, fontSize: 20.0),
// ),
// icon: Icon(
// Icons.mode_edit,
// color: Colors.white,
// ),
// onPressed: () {},
// ),
// SizedBox(
// height: MediaQuery.of(context).size.width *
// 0.00, //20,
// ),
FlatButton.icon(
padding: EdgeInsets.all(14.0),
color: Colors.orangeAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
label: Text(
TranslationBase.of(context).addNoteBtn,
style: TextStyle(
color: Colors.white, fontSize: 20.0),
),
icon: Icon(
Icons.mode_edit,
color: Colors.white,
),
onPressed: () {},
),
SizedBox(
height: MediaQuery.of(context).size.width *
0.00, //20,
),
Padding(
padding: const EdgeInsets.only(top: 30.0),
child: Container(
@ -187,13 +184,11 @@ class DeliveryConfirmedPage extends StatelessWidget {
: MediaQuery.of(context).size.width * 0.4,
),
child: CustomerBriefCard(
customerOrderId: item.orderID,
pharmacyOrderId: item.ePharmacyOrderNo,
itemId: item.orderID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
distanceInKilometers: item.distanceInKilometers,
showDistance: false,
deliveryTime: item.orderCreatedOn),
),
@ -213,8 +208,10 @@ class DeliveryConfirmedPage extends StatelessWidget {
NextOrderRequestModel nextOrderRequestModel = NextOrderRequestModel(
pageIndex: 0,
pageSize: 0,
latitude: loc.latitude.toString(), // "46.621730",
longitude: loc.longitude.toString(), // "24.797682",
latitude: loc.latitude.toString(),
//"46.621730",
longitude: loc.longitude.toString(),
//"24.797682",
searchKey: "");
await model.nextOrder(nextOrderRequestModel);
if (model.state == ViewState.ErrorLocal) {
@ -222,12 +219,6 @@ class DeliveryConfirmedPage extends StatelessWidget {
} else {
if (model.nextOrdersList != null && model.nextOrdersList.length == 0) {
Utils.showErrorToast("No Items in the list");
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => RootPage(),
),
);
} else {
Navigator.pushReplacement(
context,

@ -1,22 +1,10 @@
import 'dart:convert';
import 'dart:io';
import 'package:android_intent/android_intent.dart';
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/model/StatusModel.dart';
import 'package:driverapp/core/model/orders/pending_orders_req_model.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/service/delivery_tracking_services.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/locator.dart';
import 'package:driverapp/pages/authentication/delivery_verification_page.dart';
import 'package:driverapp/pages/authentication/verification_page.dart';
import 'package:driverapp/pages/base/base_view.dart';
import 'package:driverapp/uitl/app_shared_preferences.dart';
import 'package:driverapp/uitl/app_toast.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/bottom_sheet/action_sheet_button.dart';
@ -29,47 +17,138 @@ import 'package:driverapp/widgets/delivery/package_content.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_material_pickers/flutter_material_pickers.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:map_launcher/map_launcher.dart';
import 'package:sweetalert/sweetalert.dart';
import 'package:maps_launcher/maps_launcher.dart';
import 'package:url_launcher/url_launcher.dart';
import 'delivery_cancel_page.dart';
import 'delivery_confirmed_page.dart';
class InformationPage extends StatefulWidget {
final PendingOrdersRes item;
InformationPage({this.item});
@override
State<StatefulWidget> createState() => _InformationPageState();
}
// ignore: must_be_immutable
class _InformationPageState extends State<InformationPage> {
var _deliveryService = locator<DeliveryTrackingServices>();
PendingOrdersRes _item;
bool _isDeliveryStarted;
OrdersViewModel _viewModel;
class InformationPage extends StatelessWidget {
final PendingOrdersRes item;
int _orderStatus;
@override
void initState() {
super.initState();
_item = widget.item;
_isDeliveryStarted = _deliveryService.getActiveDeliveringOrders().contains(_item.ePharmacyOrderNo.toString());
}
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: <Widget>[
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: <Widget>[
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: <Widget>[
Column(
children: <Widget>[
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<OrdersViewModel>(
onModelReady: (model) => _viewModel = model,
builder: (_, model, w) => AppScaffold(
isShowAppBar: true,
isShowHomeIcon: true,
appBarColor: Color(0xff49C1BC),
arrowColor: Colors.white,
titleColor: Colors.white,
@ -89,18 +168,39 @@ class _InformationPageState extends State<InformationPage> {
Padding(
padding: const EdgeInsets.only(top: 75.0),
child: Container(
width: MediaQuery.of(context).size.width * 1.0,
height: MediaQuery.of(context).orientation ==
width: MediaQuery
.of(context)
.size
.width * 1.0,
height: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context).size.height * 0.70
: MediaQuery.of(context).size.height * 1.7,
? MediaQuery
.of(context)
.size
.height * 0.70
: MediaQuery
.of(context)
.size
.height * 1.7,
margin: EdgeInsets.only(
top: MediaQuery.of(context).orientation ==
top: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? MediaQuery.of(context).size.width * 0.23
: MediaQuery.of(context).size.width * 0.13),
? MediaQuery
.of(context)
.size
.width * 0.23
: MediaQuery
.of(context)
.size
.width * 0.13),
decoration: BoxDecoration(
color: Theme.of(context).scaffoldBackgroundColor,
color: Theme
.of(context)
.scaffoldBackgroundColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(45),
topRight: Radius.circular(45)),
@ -108,65 +208,143 @@ class _InformationPageState extends State<InformationPage> {
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Visibility(
visible: _isDeliveryStarted,
child: Padding(
padding: MediaQuery.of(context).orientation ==
Orientation.portrait
? EdgeInsets.only(top: 60.0)
: EdgeInsets.only(top: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DeliveryInfoButton(
btnColor: Colors.white, //Color(0xffED1C24),
btnIcon: Icon(DriverApp.location_1,
size: MediaQuery.of(context)
.orientation ==
Orientation.portrait
? 50
: 90,
color: Color(0xffED1C24)),
btnName:
TranslationBase.of(context).location,
btnFunction: () {
_openMapDirection(_item);
// MapsLauncher.launchCoordinates(
// _item.latitude, _item.longitude);
},
),
DeliveryInfoButton(
btnColor: Colors.white,
//Theme.of(context).primaryColor,
btnIcon: Icon(
DriverApp.call,
size:
MediaQuery.of(context).orientation ==
SizedBox(
height: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? MediaQuery
.of(context)
.size
.height *
0.10
: MediaQuery
.of(context)
.size
.height *
0.29,
//MediaQuery.of(context).size.width * 0.005,
),
Padding(
padding: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? EdgeInsets.only(top: 60.0)
: EdgeInsets.only(top: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
DeliveryInfoButton(
btnColor:
Colors.white, //Color(0xffED1C24),
btnIcon: Icon(DriverApp.location_1,
size: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 50
: 90,
color: Theme.of(context).primaryColor,
),
btnName: TranslationBase.of(context).call,
btnFunction: () =>
launch("tel://" + _item.mobileNumber),
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
? 50
: 90,
color: Color(0xFF5EA34A),
),
],
),
btnName: 'Whatsapp',
btnFunction: () {},
),
DeliveryInfoButton(
btnColor:
Colors.white, //Color(0xFFFCB657),
btnIcon: Icon(
DriverApp.message,
size: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 50
: 90,
color: Color(0xffFFA540),
),
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
? 50
: 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,
left: MediaQuery
.of(context)
.size
.width *
0.05,
right: MediaQuery
.of(context)
.size
.width *
0.05,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(
TranslationBase.of(context)
TranslationBase
.of(context)
.packageContent,
style: TextStyle(
fontWeight: FontWeight.w900,
@ -174,22 +352,28 @@ class _InformationPageState extends State<InformationPage> {
),
),
SizedBox(
height: MediaQuery.of(context).size.width *
height:
MediaQuery
.of(context)
.size
.width *
0.05,
),
Padding(
padding: const EdgeInsets.only(left: 10),
padding:
const EdgeInsets.only(left: 10),
child: Column(
children: List.generate(
_item.itemsQuantitiesList != null
? _item.itemsQuantitiesList.length
item.itemsQuantitiesList != null
? item.itemsQuantitiesList
.length
: 0, (index) {
return packageContent(
packageName: _item
packageName: item
.itemsQuantitiesList[index]
.itemName
.toString(),
packageCount: _item
packageCount: item
.itemsQuantitiesList[index]
.quantity
.toString(),
@ -201,37 +385,42 @@ class _InformationPageState extends State<InformationPage> {
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.1,
height:
MediaQuery
.of(context)
.size
.width * 0.1,
),
Container(
margin: MediaQuery.of(context).orientation ==
margin: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? EdgeInsets.all(8.0)
: EdgeInsets.symmetric(horizontal: 12.0),
child: SecondaryButton(
label: _isDeliveryStarted
? TranslationBase.of(context).deliveryOption
: TranslationBase.of(context).startDelivery,
label: TranslationBase
.of(context)
.clientReached,
onTap: () {
takeAction();
showDeliveryOptions(model);
},
),
),
],
),
),
),
CustomerBriefCard(
customerOrderId: _item.orderID,
pharmacyOrderId: _item.ePharmacyOrderNo,
customerFirstName: _item.firstName,
customerLastName: _item.lastName,
mobileNo: _item.mobileNumber,
totalPayment: _item.amount,
deliveryTime: _item.orderCreatedOn,
longitude: _item.longitude,
latitude: _item.latitude,
distanceInKilometers: _item.distanceInKilometers,
itemId: item.orderID,
customerFirstName: item.firstName,
customerLastName: item.lastName,
mobileNo: item.mobileNumber,
totalPayment: item.amount,
deliveryTime: item.orderCreatedOn,
longitude: item.longitude,
latitude: item.latitude,
),
],
),
@ -243,236 +432,63 @@ class _InformationPageState extends State<InformationPage> {
);
}
void takeAction(){
if(_isDeliveryStarted) {
showDeliveryOptions(_viewModel);
}else{
if(_deliveryService.getActiveDeliveringOrders().isEmpty){
SweetAlert.show(context,subtitle: "Initializing delivery...", style: SweetAlertStyle.loading);
_viewModel.initDelivery(_item, completion: (response) {
if (response.isSuccessful) {
setState(() => _isDeliveryStarted = true);
Navigator.pop(context);
AppToast.showSuccessToast(message: "Start navigation by clicking icon [${response.data}]");
}else{
SweetAlert.show(context,subtitle: response.message, style: SweetAlertStyle.error);
}
});
}else{
SweetAlert.show(context,subtitle: "Complete the last delivery first.",style: SweetAlertStyle.error);
}
}
}
cancelDelivery() {
List<String> speedOptions = <String>[
TranslationBase.of(context).notReachableOnPhoneCall,
TranslationBase.of(context).notAvailableAtlocation,
TranslationBase.of(context).accident,
TranslationBase.of(context).deliverLater,
// TranslationBase.of(context).other,
];
List<Icon> speedIcons = <Icon>[
Icon(IconData(0xe901, fontFamily: 'HMGIcon1')),
Icon(IconData(0xe900, fontFamily: 'HMGIcon1')),
Icon(IconData(0xe902, fontFamily: 'HMGIcon1')),
Icon(IconData(0xe903, fontFamily: 'HMGIcon1')),
];
showMaterialSelectionPicker(
context: context,
title: TranslationBase.of(context).selectReason,
items: speedOptions,
selectedItem: speedOptions.first,
icons: speedIcons,
onChanged: (value) async {
SweetAlert.show(context,subtitle: "Canceling delivery...", style: SweetAlertStyle.loading);
var result = await _viewModel.updateOrderStatus(orderNo: _item.orderID, status: DeliveryStatus.cancel);
Navigator.pop(context);
if(result.isSuccessful){
_viewModel.deliveryService.stopLocationUpdate(_item.ePharmacyOrderNo);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => DeliveryCancelRejectedPage(_item), // Replace with Delivery Cancel Screen
),
);
}else{
SweetAlert.show(context,subtitle: result.message,style: SweetAlertStyle.error);
}
},
);
}
showDeliveryOptions(OrdersViewModel model) {
showModalBottomSheet(
backgroundColor: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(50.0),
topRight: Radius.circular(50.0),
),
),
isScrollControlled: true,
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 bc) {
return FractionallySizedBox(
heightFactor: 0.40,
child: ListView(
children: <Widget>[
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: <Widget>[
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: <Widget>[
Column(
children: <Widget>[
SizedBox(
height: 3,
child: Container(
color: HexColor("#D5D5D5"),
),
),
SizedBox(
height: 15,
),
ActionSheetButton(
label:
TranslationBase.of(context).delivered,
icon: DriverApp.deliverd_icon,
onTap: () {
Navigator.of(context).pop(); // Pop Bottom Action Sheet
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => DeliveryVerificationPage(order: _item)),
);
},
),
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: () {
Navigator.of(context).pop(); // Pop Bottom Action Sheet
rejectDelivery();
}
),
SizedBox(height: 15),
ActionSheetButton(
label: TranslationBase.of(context).cancel,
icon: DriverApp.not_reachable_icon,
onTap: () {
cancelDelivery();
},
),
SizedBox(height: 15),
],
),
],
),
),
)
],
),
),
],
),
builder: (BuildContext context) {
return CustomDialog(
orderStatusText: orderStatusText,
callService: () {
updateOrderStatus(context, model);
},
model: model,
);
});
}
rejectDelivery(){
SweetAlert.show(context,title: "Are you sure?",style: SweetAlertStyle.confirm, showCancelButton: true,onPress: (bool isConfirm) {
if (isConfirm) {
_viewModel.updateOrderStatus(orderNo: _item.orderID, status: DeliveryStatus.rejected).then((results){
});
}
return true;
});
}
_openMapDirection(PendingOrdersRes order) async{
Utils.getLocation().then((locationData){
if(locationData != null){
// MapLauncher.isMapAvailable(MapType.google).then((value){
// if (value) {
// MapLauncher.showDirections(
// mapType: MapType.google,
// destination: Coords(order.latitude, order.longitude),
// directionsMode: DirectionsMode.driving,
// destinationTitle: order.receiverFullName())
// .then((value) {
//
// });
// }else{
// // Google Map Not installed show error
// }
// });
/* Directly start navigation */
MapLauncher.isMapAvailable(MapType.google).then((value){
var url = "https://www.google.com/maps/dir/?api=1&destination=${order.latitude},${order.longitude}&travelmode=driving&dir_action=navigate";
if (Platform.isAndroid) {
var intent = AndroidIntent(action: 'action_view',data: url,package: 'com.google.android.apps.maps');
intent.launch();
}else if (Platform.isIOS) {
launch(url);
}
});
// Start updating server wit your current location
_deliveryService.startLocationUpdate(order.ePharmacyOrderNo);
}
});
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),
),
);
}
}
}

@ -1,4 +1,3 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/widgets/order/order_info_card.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
@ -17,23 +16,17 @@ class _DeliverdOrdersPageState extends State<DeliverdOrdersPage> {
@override
Widget build(BuildContext context) {
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getDeliveredOrders(),
onModelReady: (model) => model.getDeliverdOrders(),
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold(
isShowAppBar: true,
appBarTitle: 'Delivered List',
baseViewModel: model,
isShowBackIcon: true,
titleColor: Colors.black,
body: Column(
children: <Widget>[
SizedBox(
height: 20,
),
if (model.state == ViewState.Idle)
model.deliverdOrders.length == 0
? Text("There's No Orders To deliver")
: SizedBox(),
NetworkBaseView(
baseViewModel: model,
child: Expanded(
@ -45,11 +38,9 @@ class _DeliverdOrdersPageState extends State<DeliverdOrdersPage> {
: model.deliverdOrders.length,
itemBuilder: (BuildContext context, int index) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 12.2),
padding: EdgeInsets.symmetric(horizontal: 12.2),
child: OrderInfoCard(
order: model.deliverdOrders[index],
showStatus: true,
onTap: () {},
));
},
),

@ -1,4 +1,3 @@
import 'package:driverapp/core/enum/viewstate.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/pages/delivery/information_page.dart';
import 'package:driverapp/uitl/translations_delegate_base.dart';
@ -18,12 +17,10 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
@override
Widget build(BuildContext context) {
return BaseView<OrdersViewModel>(
onModelReady: (model) => model.getPendingOrders(2),
// onModelReady: (model) => model.getPendingOrders(),
builder: (BuildContext context, OrdersViewModel model, Widget child) =>
AppScaffold(
baseViewModel: model,
isShowAppBar: true,
isShowBackIcon: true,
appBarTitle: TranslationBase.of(context).yourDeliveryQue,
titleColor: Colors.black,
body: Column(
@ -31,10 +28,6 @@ class _OrdersListScreenState extends State<OrdersListScreen> {
SizedBox(
height: 20,
),
if (model.state == ViewState.Idle)
model.orders.length == 0
? Text("There's No Orders To deliver")
: SizedBox(),
Expanded(
child: ListView.builder(
shrinkWrap: true,

@ -23,16 +23,13 @@ class SettingPage extends StatelessWidget {
appBarColor: Color(0xFF1DA4AA),
arrowColor: Colors.white,
titleColor: Colors.white,
isAppBarGradient: true,
isShowHomeIcon: true,
body: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
gradient: LinearGradient(
// 10% of the width, so there are ten blinds.
colors: [const Color(0xff45B7AE), const Color(0xff119FA9)],
//[const Color(0xff30B7B9), const Color(0xff3AB2AD)], // whitish to gray
begin: Alignment(0.0,0.0),
end: Alignment(-1.5, 0.0), // 10% of the width, so there are ten blinds.
colors: [const Color(0xFF1DA4AA), const Color(0xFF3EB4AD)],//[const Color(0xff30B7B9), const Color(0xff3AB2AD)], // whitish to gray
tileMode: TileMode.clamp, // repeats the gradient over the canvas
),
),
@ -53,40 +50,38 @@ class SettingPage extends StatelessWidget {
maxRadius: 200.0,
child: Image.asset(
'assets/images/driver.png',
height: MediaQuery.of(context).size.width * 1,
height: MediaQuery.of(context).size.width * 1 ,
width: MediaQuery.of(context).size.width * 1,
fit: BoxFit.contain,
),
),
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.05,
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
driverName,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w600,
color: Colors.white),
color: Colors.white
),
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.05,
),
SizedBox(height: MediaQuery.of(context).size.width *0.05,),
Container(
child: Text(
'ID: ${driverID.toString()}',
style: TextStyle(fontSize: 20, color: Colors.white),
style: TextStyle(
fontSize: 20,
color: Colors.white
),
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.1,
),
SizedBox(height: MediaQuery.of(context).size.width *0.1,),
Container(
margin: EdgeInsets.only(left: 35),
child: Column(
@ -112,31 +107,152 @@ class SettingPage extends StatelessWidget {
size: 40,
color: Colors.white,
),
SizedBox(width: MediaQuery.of(context).size.width *0.05,),
Text(
TranslationBase.of(context).logout,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width *0.05,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
],
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
DriverApp.language_icon,
size: 40,
color: Colors.white,
),
SizedBox(
width:
MediaQuery.of(context).size.width * 0.05,
width: MediaQuery.of(context).size.width * 0.05,
),
Text(
TranslationBase.of(context).logout,
TranslationBase.of(context).languageText,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
],
),
),
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
DriverApp.settings_icon,
size: 40,
color: Colors.white,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.05,
),
Text(
TranslationBase.of(context).settings,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18
),
),
],
),
),
SizedBox(
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
],
),
),
InkWell(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15),
child: Row(
children: <Widget>[
Icon(
DriverApp.bell_icon,
size: 40,
color: Colors.white,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.05,
),
Text(
TranslationBase.of(context).notification,
style: TextStyle(
fontWeight: FontWeight.w500,
color: Colors.white,
fontSize: 18),
fontSize: 18
),
),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.05,
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(
start: 0, end: 30),
margin: EdgeInsetsDirectional.only(start: 0, end: 30),
height: 1.0,
color: Colors.white,
),
),
),
SizedBox(height: MediaQuery.of(context).size.width*0.05,),
],
),
),
@ -149,4 +265,4 @@ class SettingPage extends StatelessWidget {
),
);
}
}
}

@ -1,24 +1,21 @@
import 'dart:async';
import 'package:driverapp/app-icons/driver_app_icons.dart';
import 'package:driverapp/core/viewModels/orders_view_model.dart';
import 'package:driverapp/core/viewModels/project_view_model.dart';
import 'package:driverapp/root_page.dart';
import 'package:driverapp/widgets/others/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../locator.dart';
class SplashScreenPage extends StatefulWidget {
@override
_SplashScreenPageState createState() => _SplashScreenPageState();
}
class _SplashScreenPageState extends State<SplashScreenPage> {
OrdersViewModel _ordersViewModel = locator<OrdersViewModel>();
startTime() async {
await _ordersViewModel.getOrdersStatus();
navigationPage();
var _duration = new Duration(seconds: 5);
return new Timer(_duration, navigationPage);
}
@override
@ -27,8 +24,6 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
startTime();
}
//
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
@ -39,13 +34,9 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(1.0, 0.0),
end: Alignment(
-0.0, 0.0), // 10% of the width, so there are ten blinds.
colors: [
const Color(0xFF1BB0B8),
const Color(0xFF44BFBB)
], //[const Color(0xff30B7B9), const Color(0xff3AB2AD)], // whitish to gray
begin: Alignment(1.0,0.0),
end: Alignment(-0.0, 0.0), // 10% of the width, so there are ten blinds.
colors: [const Color(0xFF1BB0B8), const Color(0xFF44BFBB)],//[const Color(0xff30B7B9), const Color(0xff3AB2AD)], // whitish to gray
tileMode: TileMode.clamp, // repeats the gradient over the canvas
),
),
@ -54,25 +45,19 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FractionallySizedBox(
widthFactor: 0.89,
widthFactor: 0.80,
child: Column(
children: <Widget>[
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 200
: 50,
height: 200,
),
Column(
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
child: Icon(
DriverApp.logo,
size: MediaQuery.of(context).orientation ==
Orientation.portrait
? 120
: 70,
size: 120,
color: Colors.white,
),
margin: EdgeInsets.only(
@ -80,68 +65,42 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
? 0
: MediaQuery.of(context).size.width * 0.20,
left: !projectViewModel.isArabic
? MediaQuery.of(context).orientation ==
Orientation.landscape
? MediaQuery.of(context).size.width * 0.13
: MediaQuery.of(context).size.width * 0.0
? 0
: MediaQuery.of(context).size.width * 0.10),
),
],
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 20
: 15,
height: 20,
),
Column(
children: <Widget>[
Text(
"Driver",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
? 70
: 35,
fontSize: 70,
fontWeight: FontWeight.bold,
color: Colors.white),
),
Text(
"Delivery",
style: TextStyle(
fontSize: MediaQuery.of(context).orientation ==
Orientation.portrait
? 50
: 25,
fontSize: 50,
letterSpacing: 1,
color: Colors.white),
),
Text(
"APP",
style: TextStyle(
fontSize: MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 21,
letterSpacing:
MediaQuery
.of(context)
.orientation ==
Orientation.portrait
? 53
: 27,
fontSize: 53,
letterSpacing: 53,
color: Colors.white,
fontWeight: FontWeight.w400),
),
],
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 100
: 50,
height: 100,
)
],
),
@ -170,10 +129,7 @@ class _SplashScreenPageState extends State<SplashScreenPage> {
),
),
SizedBox(
height: MediaQuery.of(context).orientation ==
Orientation.portrait
? 10
: 5,
height: 10,
)
],
),

@ -1,14 +0,0 @@
import 'dart:convert';
import 'package:shared_preferences/shared_preferences.dart';
class Logs{
static save(String log){
SharedPreferences.getInstance().then((_prefs) async{
var jsonString = _prefs.getString("LOG") ?? "[]";
var list = json.decode(jsonString) as List;
list.add("Running... ${DateTime.now()}");
_prefs.setString("LOG", json.encode(list));
});
}
}

@ -46,8 +46,7 @@ class CupertinoPickerUtils {
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
CupertinoButton(
child: Text(
TranslationBase.of(context).cancel.toUpperCase(),
child: Text(TranslationBase.of(context).cancel,
style:
TextStyle(color: Theme.of(context).primaryColor)),
onPressed: () {

@ -42,13 +42,10 @@ class TranslationBase {
String get enterId => localizedValues['enterId'][locale.languageCode];
String get pleaseEnterYourID =>
localizedValues['pleaseEnterYourID'][locale.languageCode];
String get enterPassword =>
localizedValues['enterPassword'][locale.languageCode];
String get pleaseEnterPassword =>
localizedValues['pleaseEnterPassword'][locale.languageCode];
String get english => localizedValues['english'][locale.languageCode];
String get arabic => localizedValues['arabic'][locale.languageCode];
@ -56,22 +53,10 @@ class TranslationBase {
String get enterCredentialsMsg =>
localizedValues['enterCredentialsMsg'][locale.languageCode];
String get enterForgetIdMsg =>
localizedValues['enterForgetIdMsg'][locale.languageCode];
String get enterVerificationMsg =>
localizedValues['enterVerificationMsg'][locale.languageCode];
String get enterCustomerVerificationCodeMsg =>
localizedValues['enterCustomerVerificationCodeMsg'][locale.languageCode];
String get forgotPassword =>
localizedValues['forgotPassword'][locale.languageCode];
String get login => localizedValues['login'][locale.languageCode];
String get getOPT => localizedValues['getOPT'][locale.languageCode];
String get haveGreatDay =>
localizedValues['haveGreatDay'][locale.languageCode];
@ -111,13 +96,6 @@ class TranslationBase {
String get clientReached =>
localizedValues['clientReached'][locale.languageCode];
String get startDelivery =>
localizedValues['startDelivery'][locale.languageCode];
String get deliveryOption =>
localizedValues['deliveryOption'][locale.languageCode];
String get addNoteBtn => localizedValues['addNoteBtn'][locale.languageCode];
String get nextDelivery =>
@ -143,24 +121,6 @@ class TranslationBase {
String get selectAction =>
localizedValues['selectAction'][locale.languageCode];
String get selectReason =>
localizedValues['selectReason'][locale.languageCode];
String get other =>
localizedValues['other'][locale.languageCode];
String get notReachableOnPhoneCall =>
localizedValues['notReachableOnPhoneCall'][locale.languageCode];
String get deliverLater =>
localizedValues['deliverLater'][locale.languageCode];
String get notAvailableAtlocation =>
localizedValues['notAvailableAtlocation'][locale.languageCode];
String get accident =>
localizedValues['accident'][locale.languageCode];
String get youHaveSelected =>
localizedValues['youHaveSelected'][locale.languageCode];

@ -5,7 +5,6 @@ import 'package:driverapp/pages/setting/request_permission_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:latlong/latlong.dart';
import 'package:location/location.dart';
import 'app_shared_preferences.dart';
@ -13,22 +12,6 @@ import 'app_toast.dart';
AppSharedPreferences sharedPref = new AppSharedPreferences();
popWithDelay({@required BuildContext context, @required num seconds, @required VoidCallback callback}){
Navigator.of(context).pop();
Future.delayed(Duration(milliseconds: (seconds*1000).toInt())).then((value){
callback();
});
}
pop(BuildContext context, VoidCallback callBack){
Navigator.of(context).pop();
callBack();
}
delay(int milliseconds, VoidCallback callback){
Future.delayed(Duration(milliseconds: milliseconds)).then((value) => callback());
}
class Utils {
///show custom Error Toast
/// [message] to show for user
@ -65,25 +48,8 @@ class Utils {
static hideKeyboard(BuildContext context) {
FocusScope.of(context).unfocus();
}
static double distanceBetween(LocationData point1, LocationData point2, LengthUnit unit){
var distance = Distance();
num dist = distance.as(
unit,
LatLng(point1.latitude,point1.longitude),
LatLng(point2.latitude,point2.longitude)
);
return dist;
}
static possibleToGetLocation(Function(bool) completion) async{
Location location = new Location();
var serviceEnabled = await location.serviceEnabled();
var hasPermission = await location.hasPermission() == PermissionStatus.granted;
completion(serviceEnabled && hasPermission);
}
static Future<LocationData> getLocation() async {
static getLocation() async {
Location location = new Location();
LocationData currentLocation;
bool _serviceEnabled;
@ -138,8 +104,8 @@ class Utils {
// open setting page
} else {
currentLocation = await location.getLocation();
return currentLocation;
}
return currentLocation;
}
static formatStringToPascalCase(String name) {
@ -154,4 +120,3 @@ class Utils {
return formattedNamesList.join(' ');
}
}

@ -19,7 +19,7 @@ class ActionSheetButton extends StatelessWidget {
: MediaQuery.of(context).size.height * 0.14,
decoration: BoxDecoration(boxShadow: [
BoxShadow(
color: HexColor("#DBE5E6"),
color: Hexcolor("#DBE5E6"),
spreadRadius: 15,
blurRadius: 15,
offset: Offset(0, 7),
@ -66,7 +66,7 @@ class ActionSheetButton extends StatelessWidget {
style: TextStyle(
fontSize: 22.0,
fontFamily: "Metropolis-Bold",
color: HexColor("##1A1818")),
color: Hexcolor("##1A1818")),
),
)
],

@ -25,7 +25,7 @@ class CustomBottomSheet extends StatelessWidget {
children: <Widget>[
Container(
decoration: BoxDecoration(
color: HexColor("#D5D5D5"),
color: Hexcolor("#D5D5D5"),
borderRadius: BorderRadius.circular(3.0)),
width: 200,
height: 7.0,

@ -103,7 +103,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
: 19),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
color: HexColor('#515b5d'),
color: Hexcolor('#515b5d'),
boxShadow: [
BoxShadow(
color: Color.fromRGBO(

@ -147,7 +147,8 @@ class _SecondaryButtonState extends State<SecondaryButton>
child: Container(
decoration: BoxDecoration(
border: widget.borderColor != null
? Border.all(color: widget.borderColor, width: 2.0)
? Border.all(
color: widget.borderColor.withOpacity(0.1), width: 2.0)
: null,
borderRadius: BorderRadius.all(Radius.circular(100.0)),
boxShadow: [
@ -194,7 +195,7 @@ class _SecondaryButtonState extends State<SecondaryButton>
widget.color != null ? null : LINEAR_GRADIENT,
color: widget.color != null
? widget.color
: HexColor("#000000"),
: Hexcolor("#000000"),
),
),
),

@ -25,7 +25,7 @@ class CircleContainer extends StatelessWidget {
shape: BoxShape.circle,
color: color,
border: Border.all(
color: borderColor ?? HexColor("#707070"), width: borderWidth)),
color: borderColor ?? Hexcolor("#707070"), width: borderWidth)),
height: 80,
width: 80,
),

@ -2,10 +2,13 @@ import 'package:driverapp/config/size_config.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/delivery/distance_in_kilometers.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../uitl/date_uitl.dart';
import '../../uitl/translations_delegate_base.dart';
class CustomerBriefCard extends StatelessWidget {
final int customerOrderId;
final int pharmacyOrderId;
final int itemId;
final String time;
final String customerFirstName;
final String customerLastName;
@ -19,8 +22,7 @@ class CustomerBriefCard extends StatelessWidget {
final dynamic distanceInKilometers;
CustomerBriefCard({
this.customerOrderId,
this.pharmacyOrderId,
this.itemId,
this.time,
this.customerFirstName,
this.customerLastName,
@ -41,9 +43,9 @@ class CustomerBriefCard extends StatelessWidget {
padding: EdgeInsets.only(bottom: 0.0),
child: Container(
width: MediaQuery.of(context).orientation == Orientation.landscape
? MediaQuery.of(context).size.width * 0.9
: MediaQuery.of(context).size.width * 0.9,
height: SizeConfig.heightMultiplier * 30.0, // TODO make it responsive
? SizeConfig.widthMultiplier * 125.0
: SizeConfig.widthMultiplier * 90.0,
height: 290,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
@ -61,41 +63,25 @@ class CustomerBriefCard extends StatelessWidget {
],
),
child: Container(
padding: EdgeInsets.only(left: 20, top: 20, right: 20),
padding: EdgeInsets.only(left: 30, top: 20, right: 30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Expanded(
flex: 3,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Customer Order Id: ${customerOrderId}',
style: TextStyle(
color: Color(0xff636363),
fontWeight: FontWeight.w500,
fontSize: 17.5),
),
SizedBox(
height: 10,
),
Text(
'Pharmacy Order Id: ${pharmacyOrderId}',
style: TextStyle(
color: Color(0xff636363),
fontWeight: FontWeight.w500,
fontSize: 17.5),
),
],
child: Text(
'ID: ${itemId}',
style: TextStyle(
color: Color(0xff636363),
fontWeight: FontWeight.w500,
fontSize: 17.5),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.all(2.0),
padding: EdgeInsets.all(8.0),
child: DistanceInKilometers(
distanceInKilometers: distanceInKilometers,
),
@ -103,34 +89,29 @@ class CustomerBriefCard extends StatelessWidget {
),
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
Utils.formatStringToPascalCase(
'${customerFirstName} ${customerLastName}'),
style: TextStyle(
color: Color(0xff343333),
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
// SizedBox(
// height: MediaQuery.of(context).size.width * 0.00,
// ),
Text(
mobileNo,
style: TextStyle(
color: Color(0xff14A0A9),
fontWeight: FontWeight.w400),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.005,
),
],
SizedBox(
height: MediaQuery.of(context).size.width * 0.02,
),
Text(
Utils.formatStringToPascalCase(
'${customerFirstName} ${customerLastName}'),
style: TextStyle(
color: Color(0xff343333),
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.019,
),
Text(
mobileNo,
style: TextStyle(
color: Color(0xff14A0A9), fontWeight: FontWeight.w400),
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.005,
),
// Text(
// 'Olaya street, behind KFC resturant, next to kingdom towers 2nd floor ofice 277',
// style: TextStyle(
@ -139,6 +120,64 @@ class CustomerBriefCard extends StatelessWidget {
SizedBox(
height: 10,
),
SizedBox(
height: 10.0,
child: Center(
child: Container(
margin: EdgeInsetsDirectional.only(start: 1.0, end: 1.0),
height: 1.0,
color: Colors.grey,
),
),
),
SizedBox(
height: 20,
),
Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
flex: 2,
child: Text(
TranslationBase.of(context).payment,
textAlign: TextAlign.start,
),
),
SizedBox(
width: 170,
),
Expanded(
child: Text(
totalPayment.toString(),
textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w400),
),
),
],
),
SizedBox(
height: MediaQuery.of(context).size.width * 0.03,
),
Row(
children: <Widget>[
Expanded(
flex: 1,
child: Text(
TranslationBase.of(context).delivryTime,
textAlign: TextAlign.start,
),
),
Expanded(
child: Text(
'${DateUtil.getMonthDayYearDateFormatted(DateUtil.convertStringToDate(deliveryTime))} ${(DateUtil.convertStringToHours(deliveryTime))}',
textAlign: TextAlign.end,
style: TextStyle(fontWeight: FontWeight.w400)),
),
],
)
],
),
],
),
),

@ -5,158 +5,90 @@ import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class OrderInfoCard extends StatelessWidget {
const OrderInfoCard(
{Key key, this.order, this.onTap, this.showStatus = false, this.isActiveToDeliver = false})
: super(key: key);
const OrderInfoCard({Key key, this.order, this.onTap}) : super(key: key);
final dynamic order;
final Function onTap;
final bool showStatus;
final bool isActiveToDeliver;
@override
Widget build(BuildContext context) {
return InkWell(
child:
Container(
child: Container(
child: RoundedContainer(
showShadow: true,
raduis: 25.0,
height: MediaQuery.of(context).orientation == Orientation.portrait
? MediaQuery.of(context).size.height * (showStatus ? 0.22 : 0.160)
: MediaQuery.of(context).size.height *
(showStatus ? 0.359 : 0.269),
child: FractionallySizedBox(
widthFactor: 0.98,
child: Stack(
children:[
if(isActiveToDeliver)
? MediaQuery.of(context).size.height * 0.120
: MediaQuery.of(context).size.height * 0.209,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(10.0),
child: Align(
alignment: Alignment.bottomRight,
child:Image.asset(
'assets/images/check.png',
height: 20,
width: 20,
),
padding: EdgeInsets.only(left: 15.0, top: 14.0),
child: Image.asset(
'assets/images/location.png',
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,
),
)
],
),
),
Expanded(
flex: 5,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Text(
Utils.formatStringToPascalCase(
order.firstName + ' ' + order.lastName),
style: TextStyle(
fontSize: 18.0,
color: Hexcolor("#343333"),
fontWeight: FontWeight.bold),
),
),
Column(
// mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding:
EdgeInsets.only(left: 15.0, top: 14.0),
child: Image.asset(
'assets/images/location.png',
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,
),
),
SizedBox(
width: 13,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 20.0),
child: Text(
Utils.formatStringToPascalCase(
order.firstName +
' ' +
order.lastName),
style: TextStyle(
fontSize: 18.0,
color: HexColor("#343333"),
fontWeight: FontWeight.bold),
),
),
Text(
order.mobileNumber,
style: TextStyle(
color: Color(0xff30B7B9),
fontWeight: FontWeight.w600,
fontSize: 15.0,
),
),
Text(
order.orderID.toString(),
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w400,
letterSpacing: 8.0),
),
],
),
],
),
],
)
],
),
Padding(
padding: EdgeInsets.all(8.0),
child: DistanceInKilometers(
distanceInKilometers: order.distanceInKilometers,
),
),
],
Text(
order.mobileNumber,
style: TextStyle(
color: Color(0xff30B7B9),
fontWeight: FontWeight.w600,
fontSize: 15.0,
),
if (showStatus)
Row(
children: [
Container(
margin: EdgeInsets.only(bottom: 12, left: 10),
child: RoundedContainer(
margin: 4,
showShadow: false,
backgroundColor:
order.statusID == 2 ? Colors.green : Colors.red,
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 5, horizontal: 15),
child: Text(
order.description,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w600,
fontSize: 15.0,
),
),
),
),
),
],
)
],
),
]),
),
Expanded(
child: Text(
order.orderID.toString(),
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.w400,
letterSpacing: 8.0),
),
),
],
),
),
Padding(
padding: EdgeInsets.all(8.0),
child: DistanceInKilometers(
distanceInKilometers: order.distanceInKilometers,
),
),
],
),
),
),

@ -1,10 +1,8 @@
import 'package:driverapp/config/config.dart';
import 'package:driverapp/core/viewModels/base_view_model.dart';
import 'package:driverapp/pages/dashboard/dashboard_screen.dart';
import 'package:driverapp/uitl/utils.dart';
import 'package:driverapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:gradient_app_bar/gradient_app_bar.dart';
import 'arrow_back.dart';
@ -21,8 +19,6 @@ class AppScaffold extends StatelessWidget {
final Color arrowColor;
final Color appBarColor;
final bool isAppBarGradient;
final bool isShowHomeIcon;
final bool isShowBackIcon;
AppScaffold(
{@required this.body,
@ -34,9 +30,7 @@ class AppScaffold extends StatelessWidget {
this.titleColor,
this.arrowColor,
this.appBarColor,
this.isAppBarGradient = false,
this.isShowHomeIcon = false,
this.isShowBackIcon = false});
this.isAppBarGradient = false});
@override
Widget build(BuildContext context) {
@ -46,77 +40,50 @@ class AppScaffold extends StatelessWidget {
bottom: false,
child: Scaffold(
backgroundColor:
Theme
.of(context)
.scaffoldBackgroundColor,
appBarColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar && !isAppBarGradient
? AppBar(
elevation: 0,
backgroundColor: Theme
.of(context)
.appBarTheme
.color,
textTheme: TextTheme(
headline6: TextStyle(
color: titleColor ?? Colors.white,
fontWeight: FontWeight.bold),
),
title: Text(Utils.formatStringToPascalCase(appBarTitle)),
automaticallyImplyLeading: false,
leading: isShowBackIcon ? Builder(
builder: (BuildContext context) {
return ArrowBack(
arrowColor: arrowColor,
);
},
) : null,
centerTitle: true,
actions: <Widget>[
if (isShowHomeIcon)
IconButton(
icon: Icon(FontAwesomeIcons.home),
color: Colors.white,
onPressed: () {
},
),
],
)
elevation: 0,
backgroundColor: Theme.of(context).appBarTheme.color,
textTheme: TextTheme(
headline6: TextStyle(
color: titleColor ?? Colors.white,
fontWeight: FontWeight.bold),
),
title: Text(Utils.formatStringToPascalCase(appBarTitle)),
leading: Builder(
builder: (BuildContext context) {
return ArrowBack(
arrowColor: arrowColor,
);
},
),
centerTitle: true,
// actions: <Widget>[
// IconButton(
// icon: Icon(FontAwesomeIcons.home),
// color: Colors.white,
// onPressed: () {
// // TODO add navigator to home page
// },
// ),
// ],
)
: isShowAppBar && isAppBarGradient
? GradientAppBar(
gradient: LINEAR_GRADIENT,
title: Text(
Utils.formatStringToPascalCase(appBarTitle),
style: TextStyle(color: Colors.white),
),
automaticallyImplyLeading: false,
centerTitle: true,
leading: isShowBackIcon ? Builder(
builder: (BuildContext context) {
return ArrowBack(
arrowColor: arrowColor,
);
},
) : null,
actions: <Widget>[
if (isShowHomeIcon)
IconButton(
icon: Icon(FontAwesomeIcons.home),
color: Colors.white,
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
DashboardScreen()
gradient: LINEAR_GRADIENT,
title: Text(
Utils.formatStringToPascalCase(appBarTitle),
style: TextStyle(color: Colors.white),
),
);
},
),
],
)
centerTitle: true,
leading: Builder(
builder: (BuildContext context) {
return ArrowBack(
arrowColor: arrowColor,
);
},
))
: null,
body: baseViewModel != null
? NetworkBaseView(

@ -25,7 +25,7 @@ class NetworkBaseView extends StatelessWidget {
return child;
break;
case ViewState.Busy:
return AppCircularProgressIndicator();
return Expanded(child: AppCircularProgressIndicator());
break;
case ViewState.Error:
return Center(

@ -67,7 +67,7 @@ class _RoundedContainerState extends State<RoundedContainer> {
boxShadow: widget.showShadow ? [
BoxShadow(
color: HexColor("#DBE5E6"),
color: Hexcolor("#DBE5E6"),
spreadRadius: 15,
blurRadius: 15,
offset: Offset(0, 7), // changes position of shadow

@ -56,7 +56,7 @@ dependencies:
# UI Reqs
dotted_border: 1.0.5
expandable: ^4.1.4
hexcolor: ^1.0.6
hexcolor: ^1.0.1
# Notification Banner
dropdown_banner: ^1.4.0
@ -72,25 +72,15 @@ dependencies:
# location
location: ^3.0.2
# latlong tools
latlong: any
#gradient
gradient_app_bar: ^0.1.3
app_settings: ^4.0.3
#Barcode Scanner
flutter_barcode_scanner: ^1.0.1
#android_intent
android_intent: any
# Alerts Dailogs
sweetalert: any
# flutter_material_pickers
flutter_material_pickers: 1.7.4
@ -126,7 +116,3 @@ flutter:
- asset: assets/fonts/Metropolis/Metropolis-Regular.otf
- asset: assets/fonts/Metropolis/Metropolis-Bold.otf
- asset: assets/fonts/Metropolis/Metropolis-Light.otf
- family: HMGIcon1
fonts:
- asset: assets/fonts/icomoon.ttf

Loading…
Cancel
Save