diff --git a/assets/images/closed_box.png b/assets/images/closed_box.png new file mode 100644 index 0000000..3f7844f Binary files /dev/null and b/assets/images/closed_box.png differ diff --git a/assets/images/driver.png b/assets/images/driver.png new file mode 100644 index 0000000..9bf0a56 Binary files /dev/null and b/assets/images/driver.png differ diff --git a/assets/images/location.png b/assets/images/location.png new file mode 100644 index 0000000..4463dd8 Binary files /dev/null and b/assets/images/location.png differ diff --git a/assets/images/open_box.png b/assets/images/open_box.png new file mode 100644 index 0000000..415c732 Binary files /dev/null and b/assets/images/open_box.png differ diff --git a/assets/images/qr_code.png b/assets/images/qr_code.png new file mode 100644 index 0000000..e50e92b Binary files /dev/null and b/assets/images/qr_code.png differ diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..6697f0a --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,87 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + generated_key_values = {} + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end + end + generated_key_values +end + +target 'Runner' do + use_frameworks! + use_modular_headers! + + # Flutter Pod + + copied_flutter_dir = File.join(__dir__, 'Flutter') + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) + end + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' + + # Plugin Pods + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 90398e9..dd7be69 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -225,12 +225,47 @@ 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}/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}/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; diff --git a/lib/app-icons/config.json b/lib/app-icons/config.json new file mode 100644 index 0000000..331f146 --- /dev/null +++ b/lib/app-icons/config.json @@ -0,0 +1,94 @@ +{ + "name": "DriverApp", + "css_prefix_text": "", + "css_use_suffix": false, + "hinting": true, + "units_per_em": 1000, + "ascent": 850, + "glyphs": [ + { + "uid": "6b13cdbdada31c1cc88c63aedc146a9c", + "css": "logo", + "code": 59393, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1572.1 336.4A308.4 308.4 0 0 0 1008.4 436.3C1007 443.1 1005.5 449.9 1003.6 458.7 972.3 454.4 941.8 450.3 911.4 446.1S850.1 437.4 818 432.8C818.4 426.5 818.3 421 819.2 415.9A498.9 498.9 0 1 1 1532.6 947.1 489.1 489.1 0 0 1 1117.1 960 21.8 21.8 0 0 1 1101 931.9C1116.5 824.5 1160.3 502.5 1164.7 470 1172.6 412.1 1179.8 354 1189 296.4A37.2 37.2 0 0 1 1207.3 272.1 252.3 252.3 0 0 1 1362.2 255.7C1379.3 259 1385.5 264.7 1382.3 283.6 1374.2 331.4 1368.2 379.7 1362.4 427.9 1361.1 438.9 1326.1 693.4 1309.7 810 1331.9 807.6 1351.9 806.7 1371.5 803.2A308.6 308.6 0 0 0 1619 493.2C1618.7 485.7 1616.7 459.2 1615.7 452.9A436.5 436.5 0 0 0 1590.8 372C1588.7 368.6 1577.1 344.3 1572.1 336.4ZM237.6 663.6A308.4 308.4 0 0 0 801.2 563.8C802.7 557 804.2 550.2 806.1 541.4 837.4 545.6 867.9 549.7 898.3 554S959.6 562.7 991.7 567.3C991.3 573.6 991.3 579.1 990.5 584.2A498.9 498.9 0 1 1 277 53 489.1 489.1 0 0 1 692.6 40.1 21.8 21.8 0 0 1 708.6 68.2C693.2 175.5 649.4 497.6 645 530.1 637.1 588 629.9 646 620.7 703.7A37.2 37.2 0 0 1 602.4 728 252.4 252.4 0 0 1 447.5 744.4C430.5 741.1 424.2 735.3 427.4 716.5 435.5 668.6 441.6 620.4 447.3 572.1 448.7 561.2 483.6 306.7 500 190.1 477.8 192.4 457.8 193.4 438.2 196.9A308.6 308.6 0 0 0 190.7 506.9C191 514.3 193 540.9 194.1 547.2A436.5 436.5 0 0 0 218.9 628.1C221 631.4 232.6 655.5 237.6 663.6Z", + "width": 1810 + }, + "search": [ + "logo" + ] + }, + { + "uid": "633ab939f7378584b7fdcdf73ddc3187", + "css": "closed_box", + "code": 59395, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M786 1000L0 753.1V167.4L786 334.7ZM1260.2 730.4L786 1000V334.7L1260.2 106.5ZM0 167.4L479.7 0 1260.1 106.5 785.9 334.8ZM228.1 87.8L968.9 250 984.1 515.3 1010.2 553.3 1023.1 504.4 1040.6 519.6 1058 484.8 1071.1 504.6 1054.3 205.8 293.5 65.2ZM322.9 236.1L786 41.8 864.9 52.6 420.6 256.9ZM322.9 236.1V854.5L420.5 885.2V256.9ZM960.1 831.5C960.1 838.8 954.8 841.2 947.1 844.6L866.7 885.2C855.8 890.6 853.6 879.4 853.6 872.1V748.2C853.6 741 858.3 739.3 866.7 735.2L947.1 694.5C964.1 685.8 959 703.5 960.1 736.9ZM861.9 760.4L941.7 721.6V726.1L861.9 766.2ZM861.9 775.8L941.7 737V741.5L861.9 781.6ZM861.9 792.9L941.7 754.1V758.5L861.9 798.7ZM863.7 839.9L914.2 815.4 914.8 820 863.7 845.7ZM863.7 851.5L914.2 827 914.8 831.6 863.7 857.3ZM863.7 863.3L914.2 838.8 914.8 843.4 863.7 869.1Z", + "width": 1260 + }, + "search": [ + "closed_box" + ] + }, + { + "uid": "5ec8c041511a6ad70c313085226140a7", + "css": "location", + "code": 59396, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M359.3 267.2A91.9 91.9 0 1 1 267.4 175.4 92 92 0 0 1 359.3 267.2ZM534.7 267.2A266.2 266.2 0 0 1 517.5 361C482.4 465.1 250.5 1000.1 250.5 1000.1S32.1 416.8 13.1 349.9A267.3 267.3 0 1 1 534.7 267.2ZM437.9 268.3A170.5 170.5 0 1 0 267.4 438.9 170.5 170.5 0 0 0 437.9 268.3Z", + "width": 535 + }, + "search": [ + "location" + ] + }, + { + "uid": "dcd3318a238870bf147ea27335dad4ca", + "css": "open_box", + "code": 59397, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M1055.8 759.9L537.7 1000 541 412.4 1057.3 247.2ZM152.3 270.8L541 412.4 1055.8 247.2 579.4 153.1ZM579.4 153.1L763 61.5 1185.9 153.1 1057.2 247.2ZM579.4 153.1V403.7L682.1 367.1 1057.2 247.2ZM540.9 412.4L537.6 1000 152.1 840.7V270.8ZM540.9 412.4L660 623.6 1185.8 414.6 1057.2 247.2ZM540.9 412.4L419.9 608.7 0 426.2 152.3 270.8ZM152.3 270.8L37.7 84 476.4 0 579.4 153.1Z", + "width": 1186 + }, + "search": [ + "open_box" + ] + }, + { + "uid": "d755ac5bb912e95877e670a67bf4528d", + "css": "phone_call", + "code": 59398, + "src": "custom_icons", + "selected": true, + "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 + }, + "search": [ + "phone_call" + ] + }, + { + "uid": "bf7916a50afc43e4ef26fe098b6c10f3", + "css": "qr", + "code": 59399, + "src": "custom_icons", + "selected": true, + "svg": { + "path": "M9.6 167.1A9.6 9.6 0 0 1 0 157.5V9.6A9.6 9.6 0 0 1 9.6 0H161.2A9.6 9.6 0 0 1 161.2 19.2H19.2V157.5A9.6 9.6 0 0 1 9.6 167.1ZM161.2 1000H9.6A9.6 9.6 0 0 1 0 990.4V843A9.6 9.6 0 1 1 19.2 843V980.8H161.2A9.6 9.6 0 0 1 161.2 1000ZM990.3 167.1A9.6 9.6 0 0 1 980.7 157.5V19.2H845.5A9.6 9.6 0 1 1 845.5 0H990.3A9.6 9.6 0 0 1 999.9 9.6V157.5A9.6 9.6 0 0 1 990.3 167.1ZM990.3 1000H845.6A9.6 9.6 0 1 1 845.6 980.8H980.7V843A9.6 9.6 0 1 1 999.9 843V990.4A9.6 9.6 0 0 1 990.3 1000ZM396.9 180.7A5.9 5.9 0 0 0 402.8 174.8V180.7ZM430.5 174.8V158.9A5.9 5.9 0 0 0 424.6 152.9H408.7A5.9 5.9 0 0 0 402.8 158.9H402.8V180.7H430.5ZM535.6 180.7A5.9 5.9 0 0 0 541.5 174.8V180.7ZM569.3 174.8V158.9A5.9 5.9 0 0 0 563.4 152.9H547.4A5.9 5.9 0 0 0 541.5 158.9H541.5V180.7H569.3ZM396.9 180.7H380.9A5.9 5.9 0 0 0 375 186.6H375V202.6A5.9 5.9 0 0 0 380.9 208.5H402.8V180.7ZM452.4 208.5A5.9 5.9 0 0 0 458.3 202.6V208.5ZM436.4 208.5A5.9 5.9 0 0 1 430.5 202.6V208.5ZM464.2 180.7A5.9 5.9 0 0 0 458.3 186.6H458.3V208.5H486.1V180.7ZM569.3 202.6A5.9 5.9 0 0 1 563.4 208.5H541.5V180.7H569.3ZM402.8 214.4V208.5H396.9A5.9 5.9 0 0 1 402.8 214.4ZM396.9 236.2A5.9 5.9 0 0 0 402.8 230.3V236.2ZM492 208.5H486.1V214.4A5.9 5.9 0 0 1 492 208.5ZM396.9 236.2H380.9A5.9 5.9 0 0 0 375 242.2H375V258.1A5.9 5.9 0 0 0 380.9 264H402.8V236.2ZM430.5 258.1A5.9 5.9 0 0 1 424.6 264H402.8V236.2H430.5ZM436.4 236.2H430.5V242.2A5.9 5.9 0 0 1 436.4 236.2ZM458.3 242.2V236.2H452.4A5.9 5.9 0 0 1 458.3 242.2ZM458.3 258.1A5.9 5.9 0 0 0 464.2 264H480.2A5.9 5.9 0 0 0 486.1 258.1V236.2H458.3ZM575.2 236.2A5.9 5.9 0 0 0 569.4 242.2H569.4V264H597.1V236.2ZM619 236.2A5.9 5.9 0 0 1 624.9 242.2V264H597.1V236.2ZM458.3 285.9V269.9A5.9 5.9 0 0 0 452.4 264H436.4A5.9 5.9 0 0 0 430.5 269.9H430.5V291.8H458.3ZM563.5 291.8A5.9 5.9 0 0 0 569.4 285.9V291.8ZM624.9 285.9A5.9 5.9 0 0 1 619 291.8H597.1V263.9H624.9ZM402.8 313.6V297.6A5.9 5.9 0 0 0 396.9 291.6H380.9A5.9 5.9 0 0 0 375 297.6H375V319.4H402.8ZM535.6 291.8H519.7A5.9 5.9 0 0 0 513.8 297.7H513.8V313.6A5.9 5.9 0 0 0 519.7 319.5H541.5V291.8ZM597.1 313.6A5.9 5.9 0 0 1 591.2 319.5H569.4V291.8H597.1ZM602.9 291.8H597V297.7A5.9 5.9 0 0 1 602.9 291.8ZM375 341.4A5.9 5.9 0 0 0 380.9 347.3H396.9A5.9 5.9 0 0 0 402.8 341.4V319.5H375ZM430.5 341.4A5.9 5.9 0 0 0 436.4 347.3H452.4A5.9 5.9 0 0 0 458.3 341.4V319.5H430.5ZM513.8 341.4V325.4A5.9 5.9 0 0 0 507.9 319.5H492A5.9 5.9 0 0 0 486.1 325.4H486.1V347.3H513.8ZM541.6 325.4V319.5H535.6A5.9 5.9 0 0 1 541.6 325.4ZM541.6 341.4A5.9 5.9 0 0 0 547.5 347.3H563.5A5.9 5.9 0 0 0 569.4 341.4V319.5H541.6ZM575.2 319.5H569.3V325.4A5.9 5.9 0 0 1 575.2 319.5ZM624.9 341.4V325.4A5.9 5.9 0 0 0 619 319.5H602.9A5.9 5.9 0 0 0 597 325.4H597V347.3H624.8ZM519.7 375.1A5.9 5.9 0 0 1 513.8 369.2V375.1ZM597.1 369.2A5.9 5.9 0 0 0 603 375.1H619A5.9 5.9 0 0 0 624.9 369.2V347.3H597.1ZM174.7 375.1H158.8A5.9 5.9 0 0 0 152.9 381H152.9V396.9A5.9 5.9 0 0 0 158.8 402.8H180.7V375.1ZM269.8 402.8H285.8A5.9 5.9 0 0 0 291.7 396.9V381A5.9 5.9 0 0 0 285.8 375.1H264V402.8ZM341.3 375.1H325.4A5.9 5.9 0 0 0 319.5 381H319.5V396.9A5.9 5.9 0 0 0 325.4 402.8H347.2V375.1ZM436.4 402.8H452.4A5.9 5.9 0 0 0 458.3 396.9V381A5.9 5.9 0 0 0 452.4 375.1H430.5V402.8ZM486.1 396.9A5.9 5.9 0 0 0 492 402.8H513.8V375.1H486.1ZM519.7 402.8H535.7A5.9 5.9 0 0 0 541.6 396.9V381A5.9 5.9 0 0 0 535.7 375.1H513.8V402.8ZM597.1 396.9V381A5.9 5.9 0 0 0 591.2 375.1H575.2A5.9 5.9 0 0 0 569.4 381H569.4V402.8H597.1ZM619 402.8A5.9 5.9 0 0 0 624.9 396.9V402.8ZM602.9 402.8A5.9 5.9 0 0 1 597 396.9V402.8ZM652.7 396.9V381A5.9 5.9 0 0 0 646.8 375.1H630.8A5.9 5.9 0 0 0 624.9 381H624.9V402.8H652.7ZM708.2 396.9V381A5.9 5.9 0 0 0 702.3 375.1H686.3A5.9 5.9 0 0 0 680.4 381H680.4V402.8H708.2ZM714.1 402.8A5.9 5.9 0 0 1 708.2 396.9V402.8ZM180.7 408.7V402.8H174.7A5.9 5.9 0 0 1 180.7 408.7ZM180.7 424.7A5.9 5.9 0 0 0 186.5 430.6H202.5A5.9 5.9 0 0 0 208.4 424.7V402.8H180.7ZM214.3 402.8H208.4V408.7A5.9 5.9 0 0 1 214.3 402.8ZM347.2 408.7V402.8H341.3A5.9 5.9 0 0 1 347.2 408.7ZM347.2 424.7A5.9 5.9 0 0 0 353.1 430.6H375V402.8H347.2ZM436.4 402.8H430.5V408.7A5.9 5.9 0 0 1 436.4 402.8ZM563.5 430.6A5.9 5.9 0 0 0 569.4 424.7V430.6ZM658.5 430.6A5.9 5.9 0 0 1 652.7 424.7V430.6ZM680.4 424.7A5.9 5.9 0 0 0 686.3 430.6H708.2V402.8H680.4ZM730 402.8A5.9 5.9 0 0 1 735.9 408.7V430.6H708.2V402.8ZM214.3 430.6A5.9 5.9 0 0 0 208.4 436.5H208.4V458.4H236.2V430.6ZM269.8 458.4H285.8A5.9 5.9 0 0 0 291.7 452.4V436.5A5.9 5.9 0 0 0 285.8 430.6H264V458.4ZM375 436.5V430.6H369.1A5.9 5.9 0 0 1 375 436.5ZM452.4 458.4A5.9 5.9 0 0 0 458.3 452.4V458.4ZM436.4 458.4A5.9 5.9 0 0 1 430.5 452.4V458.4ZM464.2 430.6A5.9 5.9 0 0 0 458.3 436.5H458.3V458.4H486.1V430.6ZM597.1 452.4A5.9 5.9 0 0 1 591.2 458.4H569.4V430.6H597.1ZM602.9 430.6H597V436.5A5.9 5.9 0 0 1 602.9 430.6ZM624.9 436.5V430.6H619A5.9 5.9 0 0 1 624.9 436.5ZM619 458.4A5.9 5.9 0 0 0 624.9 452.4V458.4ZM658.5 458.4H674.5A5.9 5.9 0 0 0 680.4 452.4V436.5A5.9 5.9 0 0 0 674.5 430.6H652.7V458.4ZM708.2 436.5V430.6H702.3A5.9 5.9 0 0 1 708.2 436.5ZM708.2 452.4A5.9 5.9 0 0 0 714.1 458.4H730A5.9 5.9 0 0 0 735.9 452.4V430.6H708.2ZM242.1 458.4H236.2V464.3A5.9 5.9 0 0 1 242.1 458.4ZM375 480.3A5.9 5.9 0 0 0 380.9 486.2H402.8V458.4H375ZM492 458.4H486.1V464.3A5.9 5.9 0 0 1 492 458.4ZM619 458.4H602.9A5.9 5.9 0 0 0 597 464.3H597V480.2A5.9 5.9 0 0 0 602.9 486.1H624.8V458.4ZM652.7 480.3A5.9 5.9 0 0 1 646.8 486.2H624.9V458.4H652.7ZM658.5 458.4H652.7V464.3A5.9 5.9 0 0 1 658.5 458.4ZM208.4 508A5.9 5.9 0 0 0 214.3 513.9H230.3A5.9 5.9 0 0 0 236.2 508V486.1H208.4ZM402.8 492V486.1H396.9A5.9 5.9 0 0 1 402.8 492ZM402.8 508A5.9 5.9 0 0 0 408.7 513.9H424.6A5.9 5.9 0 0 0 430.5 508V486.1H402.8ZM436.4 486.1H430.5V492A5.9 5.9 0 0 1 436.4 486.1ZM458.3 492V486.1H452.4A5.9 5.9 0 0 1 458.3 492ZM458.3 508A5.9 5.9 0 0 0 464.2 513.9H480.2A5.9 5.9 0 0 0 486.1 508V486.1H458.3ZM646.8 513.9A5.9 5.9 0 0 0 652.7 508V513.9ZM658.5 486.1A5.9 5.9 0 0 0 652.7 492H652.7V513.9H680.4V486.1ZM741.8 513.9H757.8A5.9 5.9 0 0 0 763.7 508V492A5.9 5.9 0 0 0 757.8 486.2H735.9V513.9ZM813.3 486.1H797.4A5.9 5.9 0 0 0 791.5 492H791.5V508A5.9 5.9 0 0 0 797.4 513.9H819.2V486.1ZM825.1 513.9H841.1A5.9 5.9 0 0 0 847 508V492A5.9 5.9 0 0 0 841.1 486.2H819.3V513.9ZM180.7 535.7V519.8A5.9 5.9 0 0 0 174.7 513.9H158.8A5.9 5.9 0 0 0 152.9 519.8H152.9V541.7H180.7ZM230.3 541.7A5.9 5.9 0 0 0 236.2 535.7V541.7ZM264 535.7V519.8A5.9 5.9 0 0 0 258.1 513.9H242.1A5.9 5.9 0 0 0 236.2 519.8H236.2V541.7H264ZM269.8 541.7A5.9 5.9 0 0 1 264 535.7V541.7ZM341.3 541.7A5.9 5.9 0 0 0 347.2 535.7V541.7ZM375 535.7V519.8A5.9 5.9 0 0 0 369.1 513.9H353.1A5.9 5.9 0 0 0 347.2 519.8H347.2V541.7H375ZM535.6 541.7A5.9 5.9 0 0 0 541.5 535.7V541.7ZM569.3 535.7V519.8A5.9 5.9 0 0 0 563.4 513.9H547.4A5.9 5.9 0 0 0 541.5 519.8H541.5V541.7H569.3ZM619 513.9H602.9A5.9 5.9 0 0 0 597 519.8H597V535.8A5.9 5.9 0 0 0 602.9 541.7H624.8V513.9ZM741.8 513.9H735.9V519.8A5.9 5.9 0 0 1 741.8 513.9ZM214.3 541.7A5.9 5.9 0 0 0 208.4 547.6H208.4V569.4H236.2V541.7ZM396.9 569.4A5.9 5.9 0 0 0 402.8 563.5V569.4ZM380.9 569.4A5.9 5.9 0 0 1 375 563.5V569.4ZM430.5 563.5V547.6A5.9 5.9 0 0 0 424.6 541.7H408.7A5.9 5.9 0 0 0 402.8 547.6H402.8V569.5H430.5ZM535.6 541.7H519.7A5.9 5.9 0 0 0 513.8 547.6H513.8V563.5A5.9 5.9 0 0 0 519.7 569.4H541.5V541.7ZM624.9 547.6V541.7H619A5.9 5.9 0 0 1 624.9 547.6ZM680.4 563.5A5.9 5.9 0 0 1 674.5 569.4H652.7V541.7H680.4ZM686.3 541.7H680.4V547.6A5.9 5.9 0 0 1 686.3 541.7ZM708.2 547.6V541.7H702.3A5.9 5.9 0 0 1 708.2 547.6ZM708.2 563.5A5.9 5.9 0 0 0 714.1 569.4H730A5.9 5.9 0 0 0 735.9 563.5V541.7H708.2ZM785.6 541.7H769.7A5.9 5.9 0 0 0 763.8 547.6H763.8V563.5A5.9 5.9 0 0 0 769.7 569.4H791.6V541.7ZM841.1 541.7A5.9 5.9 0 0 1 847 547.6V569.4H819.3V541.7ZM208.4 591.3A5.9 5.9 0 0 0 214.3 597.2H230.3A5.9 5.9 0 0 0 236.2 591.3V569.4H208.4ZM242.1 569.4H236.2V575.3A5.9 5.9 0 0 1 242.1 569.4ZM347.2 575.3V569.4H341.3A5.9 5.9 0 0 1 347.2 575.3ZM341.3 597.2A5.9 5.9 0 0 0 347.2 591.3V597.2ZM436.4 597.2A5.9 5.9 0 0 1 430.5 591.3V597.2ZM513.8 591.3V575.3A5.9 5.9 0 0 0 507.9 569.4H492A5.9 5.9 0 0 0 486.1 575.3H486.1V597.2H513.8ZM541.6 575.3V569.4H535.6A5.9 5.9 0 0 1 541.6 575.3ZM575.2 597.2A5.9 5.9 0 0 1 569.4 591.3V597.2ZM619 597.2A5.9 5.9 0 0 0 624.9 591.3V597.2ZM658.5 569.4H652.7V575.3A5.9 5.9 0 0 1 658.5 569.4ZM658.5 597.2A5.9 5.9 0 0 1 652.7 591.3V597.2ZM791.5 575.3V569.4H785.6A5.9 5.9 0 0 1 791.5 575.3ZM791.5 591.3A5.9 5.9 0 0 0 797.4 597.2H819.2V569.4H791.5ZM152.9 619A5.9 5.9 0 0 0 158.8 625H174.7A5.9 5.9 0 0 0 180.7 619V597.2H152.9ZM341.3 597.2H325.4A5.9 5.9 0 0 0 319.5 603.1H319.5V619A5.9 5.9 0 0 0 325.4 625H347.2V597.2ZM375 619A5.9 5.9 0 0 1 369.1 625H347.2V597.2H375ZM380.9 597.2H375V603.1A5.9 5.9 0 0 1 380.9 597.2ZM402.8 603.1V597.2H396.9A5.9 5.9 0 0 1 402.8 603.1ZM396.9 625A5.9 5.9 0 0 0 402.8 619V625ZM436.4 625H452.4A5.9 5.9 0 0 0 458.3 619V603.1A5.9 5.9 0 0 0 452.4 597.2H430.5V625ZM486.1 619A5.9 5.9 0 0 0 492 625H507.9A5.9 5.9 0 0 0 513.8 619V597.2H486.1ZM741.8 625H757.8A5.9 5.9 0 0 0 763.7 619V603.1A5.9 5.9 0 0 0 757.8 597.2H735.9V625ZM819.3 603.1V597.2H813.4A5.9 5.9 0 0 1 819.3 603.1ZM380.9 625A5.9 5.9 0 0 0 375 630.8H375V652.7H402.8V625ZM430.5 646.8A5.9 5.9 0 0 1 424.6 652.7H402.8V625H430.5ZM436.4 625H430.5V630.8A5.9 5.9 0 0 1 436.4 625ZM575.2 625H569.3V630.8A5.9 5.9 0 0 1 575.2 625ZM597.1 630.8V625H591.2A5.9 5.9 0 0 1 597.1 630.8ZM630.8 625H624.9V630.8A5.9 5.9 0 0 1 630.8 625ZM708.2 630.8V625H702.3A5.9 5.9 0 0 1 708.2 630.8ZM741.8 625H735.9V630.8A5.9 5.9 0 0 1 741.8 625ZM813.3 652.7A5.9 5.9 0 0 0 819.2 646.8V652.7ZM375 674.6A5.9 5.9 0 0 0 380.9 680.5H396.9A5.9 5.9 0 0 0 402.8 674.6V652.7H375ZM408.7 652.7H402.8V658.6A5.9 5.9 0 0 1 408.7 652.7ZM464.2 652.7A5.9 5.9 0 0 0 458.3 658.6H458.3V680.5H486.1V652.7ZM492 680.5H507.9A5.9 5.9 0 0 0 513.8 674.6V658.6A5.9 5.9 0 0 0 507.9 652.7H486.1V680.5ZM541.6 674.6A5.9 5.9 0 0 0 547.5 680.5H563.5A5.9 5.9 0 0 0 569.4 674.6V652.7H541.6ZM741.8 680.5A5.9 5.9 0 0 1 735.9 674.6V680.5ZM785.6 652.7H769.7A5.9 5.9 0 0 0 763.8 658.6H763.8V674.6A5.9 5.9 0 0 0 769.7 680.5H791.6V652.7ZM847 674.6A5.9 5.9 0 0 1 841.1 680.5H819.3V652.7H847.1ZM452.4 708.2A5.9 5.9 0 0 0 458.3 702.3V708.2ZM492 680.5H486.1V686.4A5.9 5.9 0 0 1 492 680.5ZM492 708.2A5.9 5.9 0 0 1 486.1 702.3V708.2ZM630.8 708.2A5.9 5.9 0 0 1 624.9 702.3V708.2ZM702.3 708.2A5.9 5.9 0 0 0 708.2 702.3V708.2ZM757.8 680.5A5.9 5.9 0 0 1 763.7 686.4V708.2H735.9V680.5ZM402.8 730.1V714.1A5.9 5.9 0 0 0 396.9 708.2H380.9A5.9 5.9 0 0 0 375 714.1H375V736H402.8ZM452.4 708.2H436.4A5.9 5.9 0 0 0 430.5 714.1H430.5V730.1A5.9 5.9 0 0 0 436.4 736H458.3V708.2ZM507.9 708.2A5.9 5.9 0 0 1 513.8 714.1V736H486.1V708.2ZM591.2 736A5.9 5.9 0 0 0 597.1 730.1V736ZM763.7 730.1A5.9 5.9 0 0 1 757.8 736H735.9V708.2H763.7ZM408.7 763.8A5.9 5.9 0 0 1 402.8 757.9V763.8ZM486.1 741.9V736H480.2A5.9 5.9 0 0 1 486.1 741.9ZM591.2 736H575.2A5.9 5.9 0 0 0 569.4 741.9H569.4V757.9A5.9 5.9 0 0 0 575.2 763.8H597.1V736ZM624.9 757.9A5.9 5.9 0 0 1 619 763.8H597.1V736H624.9ZM630.8 736H624.9V741.9A5.9 5.9 0 0 1 630.8 736ZM652.7 741.9V736H646.8A5.9 5.9 0 0 1 652.7 741.9ZM652.7 757.9A5.9 5.9 0 0 0 658.5 763.8H674.5A5.9 5.9 0 0 0 680.4 757.9V736H652.7ZM686.3 736H680.4V741.9A5.9 5.9 0 0 1 686.3 736ZM708.2 741.9V736H702.3A5.9 5.9 0 0 1 708.2 741.9ZM741.8 736H735.9V741.9A5.9 5.9 0 0 1 741.8 736ZM813.3 736H797.4A5.9 5.9 0 0 0 791.5 741.9H791.5V757.9A5.9 5.9 0 0 0 797.4 763.8H819.2V736ZM841.1 736A5.9 5.9 0 0 1 847 741.9V763.8H819.3V736ZM436.4 791.5H452.4A5.9 5.9 0 0 0 458.3 785.6V769.7A5.9 5.9 0 0 0 452.4 763.8H430.5V791.5ZM535.6 791.5A5.9 5.9 0 0 0 541.5 785.6V791.5ZM519.7 791.5A5.9 5.9 0 0 1 513.8 785.6V791.5ZM569.3 785.6V769.6A5.9 5.9 0 0 0 563.4 763.7H547.4A5.9 5.9 0 0 0 541.5 769.6H541.5V791.5H569.3ZM702.3 791.5A5.9 5.9 0 0 0 708.2 785.6V791.5ZM741.8 791.5A5.9 5.9 0 0 1 735.9 785.6V791.5ZM819.3 769.7V763.8H813.4A5.9 5.9 0 0 1 819.3 769.7ZM819.3 785.6A5.9 5.9 0 0 0 825.2 791.5H841.1A5.9 5.9 0 0 0 847.1 785.6V763.7H819.3ZM408.7 791.5H402.8V797.4A5.9 5.9 0 0 1 408.7 791.5ZM569.3 813.4A5.9 5.9 0 0 1 563.4 819.3H541.5V791.5H569.3ZM619 791.5H602.9A5.9 5.9 0 0 0 597 797.4H597V813.4A5.9 5.9 0 0 0 602.9 819.3H624.8V791.5ZM741.8 819.2H757.8A5.9 5.9 0 0 0 763.7 813.3V797.4A5.9 5.9 0 0 0 757.8 791.5H735.9V819.2ZM785.6 819.2A5.9 5.9 0 0 0 791.6 813.3V819.2ZM819.3 813.4V797.4A5.9 5.9 0 0 0 813.4 791.5H797.4A5.9 5.9 0 0 0 791.5 797.4H791.5V819.3H819.3ZM825.1 819.2A5.9 5.9 0 0 1 819.2 813.3V819.2ZM375 841.2A5.9 5.9 0 0 0 380.9 847.1H396.9A5.9 5.9 0 0 0 402.8 841.2V819.3H375ZM486.1 841.2A5.9 5.9 0 0 0 492 847.1H513.8V819.2H486.1ZM541.6 841.2A5.9 5.9 0 0 1 535.7 847.1H513.8V819.2H541.6ZM547.5 819.2H541.6V825.1A5.9 5.9 0 0 1 547.5 819.2ZM785.6 819.2H769.7A5.9 5.9 0 0 0 763.8 825.1H763.8V841.1A5.9 5.9 0 0 0 769.7 847H791.6V819.2ZM825.1 847.1H841.1A5.9 5.9 0 0 0 847 841.2V825.2A5.9 5.9 0 0 0 841.1 819.3H819.3V847.1ZM341.3 152.9H158.8A6 6 0 0 0 152.8 158.8V341.5A5.9 5.9 0 0 0 158.8 347.4H341.3A5.9 5.9 0 0 0 347.2 341.5V158.8A5.9 5.9 0 0 0 341.3 152.9ZM319.5 316.1A3.4 3.4 0 0 1 316.1 319.5H184A3.4 3.4 0 0 1 180.6 316.1V184.1A3.4 3.4 0 0 1 184 180.7H316.1A3.4 3.4 0 0 1 319.5 184.1ZM291.7 263.9V214.3A5.9 5.9 0 0 0 285.8 208.4H214.3A5.9 5.9 0 0 0 208.4 214.3V285.8A5.9 5.9 0 0 0 214.3 291.7H285.8A5.9 5.9 0 0 0 291.7 285.8ZM841.1 152.9H658.4A6 6 0 0 0 652.5 158.8V341.5A5.9 5.9 0 0 0 658.4 347.4H841.1A5.9 5.9 0 0 0 847 341.5V158.8A5.9 5.9 0 0 0 841.1 152.9ZM819.2 316.1A3.4 3.4 0 0 1 815.8 319.5H683.8A3.4 3.4 0 0 1 680.4 316.1V184.1A3.4 3.4 0 0 1 683.8 180.7H815.8A3.4 3.4 0 0 1 819.2 184.1ZM791.5 263.9V214.3A5.9 5.9 0 0 0 785.6 208.4H714.1A5.9 5.9 0 0 0 708.2 214.3V285.8A5.9 5.9 0 0 0 714.1 291.7H785.6A5.9 5.9 0 0 0 791.6 285.8ZM341.3 652.7H158.8A5.9 5.9 0 0 0 152.8 658.6V841.3A5.9 5.9 0 0 0 158.8 847.2H341.3A5.9 5.9 0 0 0 347.2 841.3V658.6A5.9 5.9 0 0 0 341.3 652.7ZM319.5 815.9A3.4 3.4 0 0 1 316.1 819.3H184A3.4 3.4 0 0 1 180.6 815.9V683.9A3.4 3.4 0 0 1 184 680.5H316.1A3.4 3.4 0 0 1 319.5 683.9ZM291.7 763.8V714.1A5.9 5.9 0 0 0 285.8 708.2H214.3A5.9 5.9 0 0 0 208.4 714.1V785.6A5.9 5.9 0 0 0 214.3 791.5H285.8A5.9 5.9 0 0 0 291.7 785.6Z", + "width": 1000 + }, + "search": [ + "qr" + ] + } + ] +} \ No newline at end of file diff --git a/lib/app-icons/driver_app_icons.dart b/lib/app-icons/driver_app_icons.dart new file mode 100644 index 0000000..d6bbfb8 --- /dev/null +++ b/lib/app-icons/driver_app_icons.dart @@ -0,0 +1,30 @@ +/// Flutter icons DriverApp +/// Copyright (C) 2020 by original authors @ fluttericon.com, fontello.com +/// This font was generated by FlutterIcon.com, which is derived from Fontello. +/// +/// To use this font, place it in your fonts/ directory and include the +/// following in your pubspec.yaml +/// +/// flutter: +/// fonts: +/// - family: DriverApp +/// fonts: +/// - asset: fonts/DriverApp.ttf +/// +/// +/// +import 'package:flutter/widgets.dart'; + +class DriverApp { + DriverApp._(); + + static const _kFontFam = 'DriverApp'; + static const _kFontPkg = null; + + static const IconData logo = IconData(0xe801, 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 phone_call = IconData(0xe806, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData qr = IconData(0xe807, fontFamily: _kFontFam, fontPackage: _kFontPkg); +} diff --git a/lib/app-icons/fonts/DriverApp.ttf b/lib/app-icons/fonts/DriverApp.ttf new file mode 100644 index 0000000..9b039c2 Binary files /dev/null and b/lib/app-icons/fonts/DriverApp.ttf differ diff --git a/lib/config/config.dart b/lib/config/config.dart index e6ae40e..2a6f133 100644 --- a/lib/config/config.dart +++ b/lib/config/config.dart @@ -1,4 +1,3 @@ - import 'package:flutter/cupertino.dart'; const MAX_SMALL_SCREEN = 660; @@ -6,7 +5,10 @@ const MAX_SMALL_SCREEN = 660; 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'; class AppGlobal { static BuildContext context; diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 5916d90..5cfdfbe 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -11,6 +11,28 @@ const Map> localizedValues = { 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, - 'booking':{'en': 'Booking','ar':'حجز'} + 'booking':{'en': 'Booking','ar':'حجز'}, + 'enterId': {'en': 'User Name', 'ar': 'اسم المستخدم'}, + 'pleaseEnterYourID': { + 'en': 'Please enter your ', + 'ar': 'الرجاء ادخال اسم المستخدم' + }, + 'enterPassword': {'en': 'Password', 'ar': 'كلمه السر'}, + 'pleaseEnterPassword': { + 'en': 'Please Enter Your Password', + 'ar': 'الرجاء ادخال كلمه السر' + }, + 'enterCredentialsMsg': { + 'en': 'Please insert username and password to login', + 'ar': 'الرجاء إدخال اسم المستخدم وكلمة المرور لتسجيل الدخول' + }, + 'forgotPassword': { + 'en': 'Forgot Password?', + 'ar': 'هل نسيت كلمة المرور ؟' + }, + 'login': { + 'en': 'Login', + 'ar': 'تسجيل الدخول' + } }; diff --git a/lib/config/shared_pref_kay.dart b/lib/config/shared_pref_kay.dart index 8c03fcc..b1bfbc9 100644 --- a/lib/config/shared_pref_kay.dart +++ b/lib/config/shared_pref_kay.dart @@ -1,3 +1,5 @@ const TOKEN = 'token'; const APP_LANGUAGE = 'language'; +const USER_PROFILE = 'user-profile'; + diff --git a/lib/core/model/authentication/authenticated_user.dart b/lib/core/model/authentication/authenticated_user.dart new file mode 100644 index 0000000..0329bd5 --- /dev/null +++ b/lib/core/model/authentication/authenticated_user.dart @@ -0,0 +1,64 @@ +class AuthenticatedUser { + int iD; + int userID; + String password; + String userName; + int roleID; + String name; + bool active; + String createdOn; + int createdBy; + Null editedOn; + Null editedBy; + String mobileNumber; + int realRoleID; + + AuthenticatedUser( + {this.iD, + this.userID, + this.password, + this.userName, + this.roleID, + this.name, + this.active, + this.createdOn, + this.createdBy, + this.editedOn, + this.editedBy, + this.mobileNumber, + this.realRoleID}); + + AuthenticatedUser.fromJson(Map json) { + iD = json['ID']; + userID = json['UserID']; + password = json['password']; + userName = json['UserName']; + roleID = json['RoleID']; + name = json['Name']; + active = json['Active']; + createdOn = json['CreatedOn']; + createdBy = json['CreatedBy']; + editedOn = json['EditedOn']; + editedBy = json['EditedBy']; + mobileNumber = json['MobileNumber']; + realRoleID = json['RealRoleID']; + } + + Map toJson() { + final Map data = new Map(); + data['ID'] = this.iD; + data['UserID'] = this.userID; + data['password'] = this.password; + data['UserName'] = this.userName; + data['RoleID'] = this.roleID; + data['Name'] = this.name; + data['Active'] = this.active; + data['CreatedOn'] = this.createdOn; + data['CreatedBy'] = this.createdBy; + data['EditedOn'] = this.editedOn; + data['EditedBy'] = this.editedBy; + data['MobileNumber'] = this.mobileNumber; + data['RealRoleID'] = this.realRoleID; + return data; + } +} diff --git a/lib/core/model/authentication/login_request.dart b/lib/core/model/authentication/login_request.dart new file mode 100644 index 0000000..0e08b82 --- /dev/null +++ b/lib/core/model/authentication/login_request.dart @@ -0,0 +1,18 @@ +class LoginRequest { + int userID; + String password; + + LoginRequest({this.userID, this.password}); + + LoginRequest.fromJson(Map json) { + userID = json['UserID']; + password = json['Password']; + } + + Map toJson() { + final Map data = new Map(); + data['UserID'] = this.userID; + data['Password'] = this.password; + return data; + } +} \ No newline at end of file diff --git a/lib/core/model/pending_orders/pending_orders_model.dart b/lib/core/model/pending_orders/pending_orders_model.dart new file mode 100644 index 0000000..c2ef9e3 --- /dev/null +++ b/lib/core/model/pending_orders/pending_orders_model.dart @@ -0,0 +1,51 @@ +import 'dart:ffi'; + +class PendingOrders { + int driverID; + String searchKey; + int pageSize; + int pageIndex; + String tokenID; + String userID; + String mobileNo; + String firstName; + String lastName; + String mobileNumber; + + PendingOrders( + {this.driverID, + this.searchKey, + this.pageSize, + this.pageIndex, + this.tokenID, + this.userID, + this.mobileNo, + this.firstName, + this.lastName, + this.mobileNumber}); + + PendingOrders.fromJson(Map json) { + driverID = json['DriverID']; + searchKey = json['SearchKey']; + pageSize = json['PageSize']; + pageIndex = json['PageIndex']; + tokenID = json['TokenID']; + userID = json['UserID']; + mobileNo = json['MobileNo']; + firstName = json['FirstName']; + lastName = json['LastName']; + mobileNumber = json['MobileNumber']; + } + + Map toJson() { + final Map data = new Map(); + data['DriverID'] = this.driverID; + data['SearchKey'] = this.searchKey; + data['PageSize'] = this.pageSize; + data['PageIndex'] = this.pageIndex; + data['TokenID'] = this.tokenID; + data['UserID'] = this.userID; + data['MobileNo'] = this.mobileNo; + return data; + } +} diff --git a/lib/core/service/authentication_service.dart b/lib/core/service/authentication_service.dart new file mode 100644 index 0000000..266f2ae --- /dev/null +++ b/lib/core/service/authentication_service.dart @@ -0,0 +1,35 @@ +import 'package:driverapp/config/config.dart'; +import 'package:driverapp/core/model/authentication/authenticated_user.dart'; +import 'package:driverapp/core/model/authentication/login_request.dart'; +import 'package:driverapp/core/service/base_service.dart'; + +class AuthenticationService extends BaseService { + String selectedClinicName; + bool isLogin = false; + bool isLoading = true; + AuthenticatedUser authenticatedUser; + String token; + + AuthenticationService() { +// getUserAuthentication(); + } + + login(LoginRequest loginRequest) async { + hasError = false; + try { + await baseAppClient.post(LOGIN, + onSuccess: (dynamic response, int statusCode) { + authenticatedUser = + AuthenticatedUser.fromJson(response['PatientER_DriverFile']); + token = response['LogInTokenID']; + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: loginRequest.toJson()); + } catch (error) { + hasError = true; + super.error = error; + throw error; + } + } +} diff --git a/lib/core/service/base_service.dart b/lib/core/service/base_service.dart index 828420c..33ce779 100644 --- a/lib/core/service/base_service.dart +++ b/lib/core/service/base_service.dart @@ -1,9 +1,26 @@ +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 'client/base_app_client.dart'; -class BaseService{ +class BaseService { String error; bool hasError = false; BaseAppClient baseAppClient = BaseAppClient(); + AuthenticatedUser user; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + BaseService() { + getUser(); + } + + getUser() async { + var userProfile = await sharedPref.getObject(USER_PROFILE); + if (userProfile != null) { + user = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + } + } } \ No newline at end of file diff --git a/lib/core/service/pending_orders_service.dart b/lib/core/service/pending_orders_service.dart new file mode 100644 index 0000000..f4024a3 --- /dev/null +++ b/lib/core/service/pending_orders_service.dart @@ -0,0 +1,31 @@ +import 'package:driverapp/config/config.dart'; +import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart'; +import 'package:driverapp/core/service/base_service.dart'; + +class PendingOrdersService extends BaseService { + List _orders = List(); + List get orders => _orders; + + PendingOrders _requestGetPendingOrders = PendingOrders( + driverID: 1111, + searchKey: "", + pageSize: 0, + pageIndex: 0, + tokenID: "@dm!n", + userID: "1111", + mobileNo: "0541710575", + ); + + Future getPendingOrders() async { + await baseAppClient.post(GET_ALL_ORDERS, + onSuccess: (dynamic response, int statusCode) { + _orders.clear(); + response['PatientER_Delivery_GetAllOrderList'].forEach((order) { + _orders.add(PendingOrders.fromJson(order)); + }); + }, onFailure: (String error, int statusCode) { + hasError = true; + super.error = error; + }, body: _requestGetPendingOrders.toJson()); + } +} diff --git a/lib/core/viewModels/authentication_view_model.dart b/lib/core/viewModels/authentication_view_model.dart new file mode 100644 index 0000000..b64f49c --- /dev/null +++ b/lib/core/viewModels/authentication_view_model.dart @@ -0,0 +1,40 @@ +import 'package:driverapp/config/shared_pref_kay.dart'; +import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/model/authentication/login_request.dart'; +import 'package:driverapp/core/service/authentication_service.dart'; +import 'package:driverapp/core/service/client/base_app_client.dart'; +import 'package:driverapp/core/viewModels/base_view_model.dart'; + +import '../../locator.dart'; + +enum APP_STATUS { LOADING, UNAUTHENTICATED, AUTHENTICATED } + +class AuthenticationViewModel extends BaseViewModel { + AuthenticationService _authenticationService = locator(); + + APP_STATUS get status { + if (state == ViewState.Busy || state == ViewState.BusyLocal) { + return APP_STATUS.LOADING; + } else { + if ( user != null) { + return APP_STATUS.AUTHENTICATED; + } else { + return APP_STATUS.UNAUTHENTICATED; + } + } + } + + login(LoginRequest loginRequest) async { + setState(ViewState.BusyLocal); + await _authenticationService.login(loginRequest); + if (_authenticationService.hasError) { + error = _authenticationService.error; + setState(ViewState.ErrorLocal); + } else { + sharedPref.setObject( + USER_PROFILE, _authenticationService.authenticatedUser); + sharedPref.setString(TOKEN, _authenticationService.token); + setState(ViewState.Idle); + } + } +} diff --git a/lib/core/viewModels/base_view_model.dart b/lib/core/viewModels/base_view_model.dart index f48bc1b..2af07b6 100644 --- a/lib/core/viewModels/base_view_model.dart +++ b/lib/core/viewModels/base_view_model.dart @@ -1,4 +1,7 @@ +import 'package:driverapp/config/shared_pref_kay.dart'; import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/model/authentication/authenticated_user.dart'; +import 'package:driverapp/uitl/app_shared_preferences.dart'; import 'package:flutter/material.dart'; class BaseViewModel extends ChangeNotifier { @@ -6,8 +9,21 @@ class BaseViewModel extends ChangeNotifier { bool isInternetConnection = true; ViewState get state => _state; - + AuthenticatedUser user; String error = ""; + AppSharedPreferences sharedPref = AppSharedPreferences(); + + BaseViewModel(){ + getUser(); + } + + getUser() async { + var userProfile = await sharedPref.getObject(USER_PROFILE); + if (userProfile != null) { + user = + AuthenticatedUser.fromJson(await sharedPref.getObject(USER_PROFILE)); + } + } //TODO load user details from SP diff --git a/lib/core/viewModels/pending_orders_view_model.dart b/lib/core/viewModels/pending_orders_view_model.dart new file mode 100644 index 0000000..0f66bba --- /dev/null +++ b/lib/core/viewModels/pending_orders_view_model.dart @@ -0,0 +1,21 @@ +import 'package:driverapp/core/enum/viewstate.dart'; +import 'package:driverapp/core/service/pending_orders_service.dart'; +import 'package:driverapp/core/model/pending_orders/pending_orders_model.dart'; +import '../../locator.dart'; +import 'base_view_model.dart'; + +class PendingOrdersViewModel extends BaseViewModel { + PendingOrdersService _pendingOrdersService = locator(); + + List get orders => _pendingOrdersService.orders; + + Future getPendingOrders() async { + setState(ViewState.Busy); + await _pendingOrdersService.getPendingOrders(); + if (_pendingOrdersService.hasError) { + error = _pendingOrdersService.error; + setState(ViewState.Error); + } else + setState(ViewState.Idle); + } +} diff --git a/lib/locator.dart b/lib/locator.dart index 3d44f4c..e12abbf 100644 --- a/lib/locator.dart +++ b/lib/locator.dart @@ -1,6 +1,10 @@ import 'package:get_it/get_it.dart'; +import 'core/service/authentication_service.dart'; import 'core/service/hospital_service.dart'; +import 'core/service/pending_orders_service.dart'; +import 'core/viewModels/authentication_view_model.dart'; +import 'core/viewModels/pending_orders_view_model.dart'; import 'core/viewModels/hospital_view_model.dart'; GetIt locator = GetIt.instance; @@ -9,7 +13,11 @@ GetIt locator = GetIt.instance; void setupLocator() { /// Services locator.registerLazySingleton(() => HospitalService()); + locator.registerLazySingleton(() => AuthenticationService()); + locator.registerLazySingleton(() => PendingOrdersService()); /// View Model locator.registerFactory(() => HospitalViewModel()); + locator.registerFactory(() => AuthenticationViewModel()); + locator.registerFactory(() => PendingOrdersViewModel()); } diff --git a/lib/main.dart b/lib/main.dart index 930ca7d..9626777 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:driverapp/root_page.dart'; import 'package:driverapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; @@ -6,7 +7,8 @@ import 'package:provider/provider.dart'; import 'config/size_config.dart'; import 'core/viewModels/project_view_model.dart'; import 'locator.dart'; -import 'pages/landing/landing_page.dart'; + + void main() { setupLocator(); @@ -25,7 +27,7 @@ class MyApp extends StatelessWidget { providers: [ ChangeNotifierProvider( create: (context) => ProjectViewModel(), - ), + ) ], child: Consumer( builder: (context, projectProvider, child) => MaterialApp( @@ -51,8 +53,12 @@ class MyApp extends StatelessWidget { TargetPlatform.iOS: CupertinoPageTransitionsBuilder(), }, ), + scaffoldBackgroundColor:Color.fromRGBO(239, 245, 245, 1) , hintColor: Colors.grey[400], disabledColor: Colors.grey[300], + bottomSheetTheme: BottomSheetThemeData( + backgroundColor: Color.fromRGBO(239, 245, 245, 1) + ), errorColor: Color.fromRGBO(235, 80, 60, 1.0), textSelectionColor: Color.fromRGBO(80, 100, 253, 0.5), textSelectionHandleColor: Color.fromRGBO(80, 100, 253, 1.0), @@ -60,9 +66,10 @@ class MyApp extends StatelessWidget { backgroundColor: Color.fromRGBO(255, 255, 255, 1), highlightColor: Colors.grey[100].withOpacity(0.4), splashColor: Colors.transparent, - primaryColor: Colors.grey, + primaryColor: Color.fromRGBO(69, 183, 174, 1.0), cursorColor: Color.fromRGBO(78, 62, 253, 1.0), iconTheme: IconThemeData(), + dividerColor: Color.fromRGBO(112, 112, 112, 1.0), appBarTheme: AppBarTheme( color: Colors.grey, brightness: Brightness.light, @@ -73,7 +80,7 @@ class MyApp extends StatelessWidget { ), ), initialRoute: '/', - routes: {'/': (context) => LandingPage()}, + routes: {'/': (context) => RootPage()}, debugShowCheckedModeBanner: false, ), ), diff --git a/lib/pages/authentication/login_page.dart b/lib/pages/authentication/login_page.dart new file mode 100644 index 0000000..9d37032 --- /dev/null +++ b/lib/pages/authentication/login_page.dart @@ -0,0 +1,264 @@ +import 'package:driverapp/app-icons/driver_app_icons.dart'; +import 'package:driverapp/core/enum/viewstate.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/base/base_view.dart'; +import 'package:driverapp/pages/dashboard/dashboard_screen.dart'; +import 'package:driverapp/pages/landing/landing_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/data_display/circle-container.dart'; +import 'package:driverapp/widgets/input/text_field.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'; + +class LoginPage extends StatelessWidget { + LoginRequest loginRequest = LoginRequest(); + final loginFormKey = GlobalKey(); + ProjectViewModel projectViewModel; + + @override + Widget build(BuildContext context) { + projectViewModel = Provider.of(context); + return AnimatedSwitcher( + duration: Duration(microseconds: 350), + child: BaseView( + builder: (_, model, widget) => Scaffold( + body: SingleChildScrollView( + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + FractionallySizedBox( + widthFactor: 0.80, + child: Column( + children: [ + SizedBox( + height: 40, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + 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), + ), + ], + ), + SizedBox( + height: 20, + ), + Column( + children: [ + 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, + children: [ + CircleContainer( + onTap: () => projectViewModel.changeLanguage('en'), + child: Text( + TranslationBase.of(context).lanEnglish, + style: TextStyle( + fontSize: 12, + color: projectViewModel.isArabic + ? Colors.black + : Colors.white), + ), + color: projectViewModel.isArabic + ? Colors.transparent + : Theme.of(context).primaryColor, + borderWidth: projectViewModel.isArabic ? 3 : 0, + borderColor: projectViewModel.isArabic + ? Theme.of(context).primaryColor + : Colors.transparent, + ), + SizedBox( + width: 20, + ), + CircleContainer( + onTap: () => + projectViewModel.changeLanguage('ar'), + child: Text( + TranslationBase.of(context).lanArabic, + style: TextStyle( + fontSize: 12, + color: !projectViewModel.isArabic + ? Colors.black + : Colors.white), + ), + color: !projectViewModel.isArabic + ? Colors.transparent + : Theme.of(context).primaryColor, + borderWidth: !projectViewModel.isArabic ? 3 : 0, + borderColor: !projectViewModel.isArabic + ? Theme.of(context).primaryColor + : Colors.transparent), + ], + ), + SizedBox( + height: 10, + ), + Form( + key: loginFormKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Padding( + padding: + const EdgeInsets.symmetric(horizontal: 20), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Expanded( + child: Text( + TranslationBase.of(context).enterCredentialsMsg, + style: TextStyle( + fontSize: 13, color: Colors.grey), + ), + ), + SizedBox( + height: 10, + ) + ], + ), + ), + 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()); + }, + ), + ), + SizedBox( + height: 20, + ), + Container( + child: TextFields( + borderRadiusValue: 6, + hintText: + TranslationBase.of(context).enterPassword, + validator: (value) { + if (value.isEmpty) { + return TranslationBase.of(context) + .pleaseEnterPassword; + } + return null; + }, + onSaved: (value) { + loginRequest.password = value; + }, + ), + ), + SizedBox( + height: 25, + ), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text( + TranslationBase.of(context).forgotPassword, + style: TextStyle( + fontSize: 14, + color: Theme.of(context).primaryColor), + ), + ], + ), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 20, + ), + SizedBox( + height: 10, + ),Container( + margin: EdgeInsets.all(10), + height: MediaQuery.of(context).size.height * 0.22, + child: Column( + children: [ + SecondaryButton( + label: TranslationBase.of(context).login, + onTap: () { + login(model, context); + }, + disabled: model.state == ViewState.BusyLocal, + loading: model.state == ViewState.BusyLocal, + ), + SizedBox( + height: 30, + ) + ], + )) + ], + ), + ), + ), + + ), + ), + ); + } + + login(AuthenticationViewModel model, BuildContext context) async { + if (loginFormKey.currentState.validate()) { + loginFormKey.currentState.save(); + await model.login(loginRequest); + if (model.state == ViewState.ErrorLocal) { + Utils.showErrorToast(model.error); + } else { + Navigator.push( + context, MaterialPageRoute(builder: (context) => DashboardScreen())); + } + } + } +} + diff --git a/lib/pages/dashboard/dashboard_screen.dart b/lib/pages/dashboard/dashboard_screen.dart new file mode 100644 index 0000000..94ff6ae --- /dev/null +++ b/lib/pages/dashboard/dashboard_screen.dart @@ -0,0 +1,395 @@ +import 'package:driverapp/config/size_config.dart'; +import 'package:driverapp/core/viewModels/pending_orders_view_model.dart'; +import 'package:flutter/material.dart'; +import '../base/base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:driverapp/app-icons/driver_app_icons.dart'; +import 'package:driverapp/widgets/others/rounded_container.dart'; +import 'package:driverapp/pages/orders/pending_orders_page.dart'; + +class DashboardScreen extends StatefulWidget { + @override + _DashboardScreenState createState() => _DashboardScreenState(); +} + +class _DashboardScreenState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPendingOrders(), + builder: + (BuildContext context, PendingOrdersViewModel model, Widget child) => + Scaffold( + backgroundColor: Color(0xffF4F9FA), + body: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Have a great day ,', + style: TextStyle(fontSize: 12.5), + ), + Padding( + padding: EdgeInsets.only(top: 4.5), + child: Text( + 'Driver Name', + style: TextStyle( + fontWeight: FontWeight.w400, fontSize: 25.0), + ), + ), + ], + ), + ], + ), + ), + Padding( + padding: EdgeInsets.all(16.0), + child: Column( + children: [ + CircleAvatar( + radius: 25.5, + backgroundColor: Color(0xff30B7B9), + child: CircleAvatar( + backgroundColor: Color(0xff30B7B9), + maxRadius: 26.0, + child: Image.asset( + 'assets/images/driver.png', + fit: BoxFit.contain, + ), + ), + ), + ], + ), + ), + ], + ), + Row( + children: [ + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.15, + width: MediaQuery.of(context).size.width * 0.43, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + gradient: LinearGradient( + colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(12.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Text( + 'You Have', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ), + Text( + '5', + style: TextStyle( + color: Colors.white, fontSize: 25.0), + ), + Text( + 'Undelivered \n Packages', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.all(4.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Image.asset( + 'assets/images/closed_box.png', + height: + MediaQuery.of(context).size.height * + 0.09, + width: + MediaQuery.of(context).size.width * + 0.20, + //fit: BoxFit.cover, + )), + ], + ), + ) + ], + ), + ), + ) + ], + ), + Column( + children: [ + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0), + child: Container( + height: MediaQuery.of(context).size.height * 0.15, + width: MediaQuery.of(context).size.width * 0.43, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + gradient: LinearGradient( + colors: [Color(0xff17AFB8), Color(0xff49C1BC)]), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: EdgeInsets.all(12.0), + child: Column( + mainAxisAlignment: + MainAxisAlignment.spaceEvenly, + children: [ + Text( + 'You Have', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ), + Text( + '25', + style: TextStyle( + color: Colors.white, fontSize: 25.0), + ), + Text( + 'unWanted\n Packge', + style: TextStyle( + color: Colors.white, fontSize: 10.0), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.only(right: 9.5), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/open_box.png', + height: MediaQuery.of(context).size.height * + 0.11, + width: MediaQuery.of(context).size.width * + 0.24, + scale: 0.9, + fit: BoxFit.cover, + ), + ], + ), + ), + ], + ), + ), + ) + ], + ), + ], + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 16.0, horizontal: 12.0), + child: Row( + children: [ + Expanded( + child: InkWell( + child: Container( + height: 140, + width: 350, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12.0), + gradient: LinearGradient(colors: [ + Color(0xff48C0BC), + Color(0xff17AFB8) + ])), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/qr_code.png', + width: + MediaQuery.of(context).size.width * 0.25, + height: + MediaQuery.of(context).size.height * 0.14, + fit: BoxFit.fitHeight, + ) + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'SCAN', + style: TextStyle( + fontSize: 35.0, color: Colors.white), + ), + Padding( + padding: EdgeInsets.only(top: 6.0), + child: Text( + 'To add package to que ', + style: TextStyle( + fontSize: 12.0, + color: Colors.white, + letterSpacing: 0.5, + wordSpacing: 5.5, + ), + ), + ), + ], + ) + ], + ), + ), + ), + ) + ], + ), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0, vertical: 10.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + children: [ + Text( + 'Nearest Drop-Offs', + style: TextStyle( + fontSize: 21.0, + fontWeight: FontWeight.w400, + ), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + InkWell( + child: Row( + children: [ + Text( + 'See All', + style: TextStyle(fontSize: 14.5), + ), + Icon( + Icons.arrow_forward_ios, + size: 15.0, + ), + ], + ), + onTap: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => OrdersListScreen()), + )), + ], + ), + ], + ), + ), + Column( + children: [ + ListView.builder( + shrinkWrap: true, + scrollDirection: Axis.vertical, + itemCount: //model.orders == null ? 0 : model.orders.length, + 2, + itemBuilder: (BuildContext context, int index) { + return Padding( + padding: EdgeInsets.symmetric(horizontal: 12.0), + child: RoundedContainer( + height: SizeConfig.heightMultiplier * 10.5, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.only(left: 22.0), + child: Image.asset( + 'assets/images/location.png'), + ) + ], + ), + if (model.orders.length != 0) + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + model.orders[index].firstName + + ' ' + + model.orders[index].lastName, + style: TextStyle(fontSize: 20.0), + ), + Text( + model.orders[index].mobileNumber, + style: TextStyle( + color: Color(0xff30B7B9), + fontWeight: FontWeight.w600, + fontSize: 15.0), + ), + Text( + 'Olaya ST, Behind kfc next to king-\ndom tower 2nd floor n.o 247', + style: TextStyle(color: Colors.black45), + ) + ], + ), + Padding( + padding: EdgeInsets.all(10.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircleAvatar( + backgroundColor: Colors.black45, + radius: 30.0, + child: CircleAvatar( + backgroundColor: Colors.white, + maxRadius: 28.9, + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + '3 K.m \n away', + style: TextStyle( + color: Color(0xff30B7B9), + fontSize: 14.0), + ), + ), + ), + ) + ], + ), + ) + ], + ), + ), + ); + }) + ], + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/orders/pending_orders_page.dart b/lib/pages/orders/pending_orders_page.dart new file mode 100644 index 0000000..f7caff9 --- /dev/null +++ b/lib/pages/orders/pending_orders_page.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; +import 'package:driverapp/config/size_config.dart'; +import 'package:driverapp/core/viewModels/pending_orders_view_model.dart'; +import '../base/base_view.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:driverapp/widgets/others/rounded_container.dart'; + +class OrdersListScreen extends StatefulWidget { + @override + _OrdersListScreenState createState() => _OrdersListScreenState(); +} + +class _OrdersListScreenState extends State { + @override + Widget build(BuildContext context) { + return BaseView( + onModelReady: (model) => model.getPendingOrders(), + builder: + (BuildContext context, PendingOrdersViewModel model, Widget child) => + Scaffold( + appBar: AppBar( + centerTitle: true, + backgroundColor: Color(0xffF4F9FA), + title: Text( + 'Your Delivery Que', + ), + ), + ), + ); + } +} diff --git a/lib/root_page.dart b/lib/root_page.dart new file mode 100644 index 0000000..3e1dbff --- /dev/null +++ b/lib/root_page.dart @@ -0,0 +1,35 @@ +import 'package:driverapp/pages/authentication/login_page.dart'; +import 'package:driverapp/pages/base/base_view.dart'; +import 'package:driverapp/pages/landing/landing_page.dart'; +import 'package:driverapp/widgets/others/app_scaffold_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:driverapp/pages/dashboard/dashboard_screen.dart'; + +import 'core/viewModels/authentication_view_model.dart'; + +class RootPage extends StatelessWidget { + @override + Widget build(BuildContext context) { + Widget buildRoot(APP_STATUS status) { + switch (status) { + case APP_STATUS.UNAUTHENTICATED: + return LoginPage (); + break; + case APP_STATUS.AUTHENTICATED: + return DashboardScreen(); + break; + } + } + + return AnimatedSwitcher( + duration: Duration(microseconds: 350), + child: BaseView( + builder: (_, model, widget) => AppScaffold( + baseViewModel: model, + body: buildRoot((model.status)), + ), + ), + ); + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 1a61090..400292e 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -39,6 +39,19 @@ class TranslationBase { String get logout => localizedValues['logout'][locale.languageCode]; String get booking => localizedValues['booking'][locale.languageCode]; + 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]; + String get enterCredentialsMsg => localizedValues['enterCredentialsMsg'][locale.languageCode]; + String get forgotPassword => localizedValues['forgotPassword'][locale.languageCode]; + String get login => localizedValues['login'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/buttons/secondary_button.dart b/lib/widgets/buttons/secondary_button.dart index a63f027..dc88f3d 100644 --- a/lib/widgets/buttons/secondary_button.dart +++ b/lib/widgets/buttons/secondary_button.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; /// SecondaryButton widget /// [label] button label @@ -87,6 +88,7 @@ class _SecondaryButtonState extends State _rippleSize = _rippleAnimation.value; }); }); + super.initState(); } @@ -160,17 +162,22 @@ class _SecondaryButtonState extends State child: ClipRRect( borderRadius: widget.noBorderRadius ? BorderRadius.all(Radius.circular(0.0)) - : BorderRadius.all(Radius.circular(10.0)), + : BorderRadius.all(Radius.circular(40.0)), child: Stack( children: [ Positioned( left: 0, bottom: 0, child: Container( - width: MediaQuery.of(context).size.width, + width: MediaQuery + .of(context) + .size + .width, height: 100, decoration: BoxDecoration( - color: Theme.of(context).disabledColor, + color: Theme + .of(context) + .disabledColor, ), ), ), @@ -184,7 +191,8 @@ class _SecondaryButtonState extends State height: MediaQuery.of(context).size.width * 2.2, decoration: BoxDecoration( shape: BoxShape.circle, - color: widget.color, + color: widget.color != null ? widget.color : Hexcolor( + "#1CA4AA"), ), ), ), @@ -193,8 +201,8 @@ class _SecondaryButtonState extends State padding: widget.iconOnly ? EdgeInsets.symmetric(vertical: 4.0, horizontal: 5.0) : EdgeInsets.only( - top: widget.small ? 8.0 : 14.0, - bottom: widget.small ? 6.0 : 14.0, + top: widget.small ? 8.0 : 12.0, + bottom: widget.small ? 6.0 : 12.0, left: 18.0, right: 18.0), child: Stack( @@ -223,12 +231,13 @@ class _SecondaryButtonState extends State ) : Padding( padding: EdgeInsets.only( - bottom: widget.small ? 4.0 : 3.0), + bottom: widget.small ? 4.0 : 2.0), child: Text(widget.label, style: TextStyle( - color: widget.textColor, + color: widget.textColor != null + ? widget.textColor + : Colors.white, fontSize: 17.0, - fontWeight: FontWeight.w800, fontFamily: "WorkSans")), ) ], diff --git a/lib/widgets/data_display/circle-container.dart b/lib/widgets/data_display/circle-container.dart new file mode 100644 index 0000000..bb0ebdd --- /dev/null +++ b/lib/widgets/data_display/circle-container.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class CircleContainer extends StatelessWidget { + const CircleContainer( + {this.child, + this.color = Colors.white, + this.borderColor, + this.borderWidth = 2.0, + this.onTap}); + + final Widget child; + final Color color; + final Color borderColor; + final double borderWidth; + final Function onTap; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Container( + child: Center(child: child), + decoration: BoxDecoration( + shape: BoxShape.circle, + color: color, + border: Border.all( + color: borderColor ?? Hexcolor("#707070"), width: borderWidth)), + height: 60, + width: 60, + ), + ); + } +} diff --git a/lib/widgets/input/text_field.dart b/lib/widgets/input/text_field.dart index 900c340..12b0adc 100644 --- a/lib/widgets/input/text_field.dart +++ b/lib/widgets/input/text_field.dart @@ -39,38 +39,44 @@ class NumberTextInputFormatter extends TextInputFormatter { final _mobileFormatter = NumberTextInputFormatter(); class TextFields extends StatefulWidget { - TextFields( - {Key key, - this.type, - this.hintText, - this.suffixIcon, - this.autoFocus, - this.onChanged, - this.initialValue, - this.minLines, - this.maxLines, - this.inputFormatters, - this.padding, - this.focus = false, - this.maxLengthEnforced = true, - this.suffixIconColor, - this.inputAction, - this.onSubmit, - this.keepPadding = true, - this.textCapitalization = TextCapitalization.none, - this.controller, - this.keyboardType, - this.validator, - this.borderOnlyError = false, - this.onSaved, - this.onSuffixTap, - this.readOnly: false, - this.maxLength, - this.prefixIcon, - this.bare = false, - this.fontSize = 16.0, - this.fontWeight = FontWeight.w700, - this.autoValidate = false}) + TextFields({Key key, + this.type, + this.hintText, + this.suffixIcon, + this.autoFocus, + this.onChanged, + this.initialValue, + this.minLines, + this.maxLines, + this.inputFormatters, + this.padding, + this.focus = false, + this.maxLengthEnforced = true, + this.suffixIconColor, + this.inputAction, + this.onSubmit, + this.keepPadding = true, + this.textCapitalization = TextCapitalization.none, + this.onTap, + this.controller, + this.keyboardType, + this.validator, + this.borderOnlyError = false, + this.onSaved, + this.onSuffixTap, + this.readOnly: false, + this.maxLength, + this.prefixIcon, + this.bare = false, + this.fontSize = 14.0, + this.color = Colors.black, + this.fontWeight = FontWeight.w600, + this.autoValidate = false, + this.borderRadiusValue = 8.0, + this.borderWidth = 1.5, + this.fieldTextColor, + this.textAlign = TextAlign.start, + this.borderRadius}) : super(key: key); final String hintText; @@ -80,6 +86,7 @@ class TextFields extends StatefulWidget { final IconData suffixIcon; final Color suffixIconColor; final IconData prefixIcon; + final VoidCallback onTap; final TextEditingController controller; final TextInputType keyboardType; final FormFieldValidator validator; @@ -96,6 +103,7 @@ class TextFields extends StatefulWidget { final TextInputAction inputAction; final double fontSize; final FontWeight fontWeight; + final Color color; final bool keepPadding; final TextCapitalization textCapitalization; final List inputFormatters; @@ -103,6 +111,11 @@ class TextFields extends StatefulWidget { final EdgeInsets padding; final bool focus; final bool borderOnlyError; + final double borderRadiusValue; + final BorderRadius borderRadius; + final double borderWidth; + final Color fieldTextColor; + final TextAlign textAlign; @override _TextFieldsState createState() => _TextFieldsState(); @@ -138,43 +151,46 @@ class _TextFieldsState extends State { Widget _buildSuffixIcon() { switch (widget.type) { case "password": - return Padding( - padding: const EdgeInsets.only(right: 8.0), - child: view - ? InkWell( + { + return Padding( + padding: const EdgeInsets.only(right: 8.0), + child: view + ? InkWell( onTap: () { - this.setState( - () { - view = false; - }, - ); + this.setState(() { + view = false; + }); }, - child: Icon( - EvaIcons.eye, - size: 24.0, - color: Color.fromRGBO(78, 62, 253, 1.0), - ), - ) - : InkWell( + child: Icon(EvaIcons.eye, + size: 24.0, color: Theme + .of(context) + .primaryColor)) + : InkWell( onTap: () { this.setState(() { view = true; }); }, child: Icon(EvaIcons.eyeOff, - size: 24.0, color: Colors.grey[500]), - ), - ); + size: 24.0, color: Colors.grey[500]))); + } + case "hourly": + return Align( + alignment: Alignment.centerRight, + child: Text( + '/ hr ', + style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700), + )); + break; default: if (widget.suffixIcon != null) return InkWell( - onTap: widget.onSuffixTap, - child: Icon(widget.suffixIcon, - size: 22.0, - color: widget.suffixIconColor != null - ? widget.suffixIconColor - : Colors.grey[500]), - ); + onTap: widget.onSuffixTap, + child: Icon(widget.suffixIcon, + size: 22.0, + color: widget.suffixIconColor != null + ? widget.suffixIconColor + : Colors.grey[500])); else return null; } @@ -196,22 +212,26 @@ class _TextFieldsState extends State { decoration: widget.bare ? null : BoxDecoration(boxShadow: [ - BoxShadow( - color: Color.fromRGBO(110, 68, 80, focus ? 0.20 : 0), - offset: Offset(0.0, 13.0), - blurRadius: focus ? 34.0 : 12.0) - ]), + BoxShadow( + color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0), + offset: Offset(0.0, 13.0), + blurRadius: focus ? 34.0 : 12.0) + ]), child: TextFormField( - keyboardAppearance: Theme.of(context).brightness, + keyboardAppearance: Theme + .of(context) + .brightness, scrollPhysics: BouncingScrollPhysics(), autovalidate: widget.autoValidate, + onTap: widget.onTap, + textAlign: widget.textAlign, textCapitalization: widget.textCapitalization, onFieldSubmitted: widget.inputAction == TextInputAction.next ? (widget.onSubmit != null - ? widget.onSubmit - : (val) { - _focusNode.nextFocus(); - }) + ? widget.onSubmit + : (val) { + _focusNode.nextFocus(); + }) : widget.onSubmit, textInputAction: widget.inputAction, minLines: widget.minLines ?? 1, @@ -228,87 +248,118 @@ class _TextFieldsState extends State { autofocus: widget.autoFocus ?? false, validator: widget.validator, onSaved: widget.onSaved, - style: Theme.of(context) + style: Theme + .of(context) .textTheme .body2 - .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight), + .copyWith( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: widget.color), inputFormatters: widget.keyboardType == TextInputType.phone ? [ - WhitelistingTextInputFormatter.digitsOnly, - _mobileFormatter, - ] + WhitelistingTextInputFormatter.digitsOnly, + _mobileFormatter, + ] : widget.inputFormatters, decoration: InputDecoration( - counterText: "", - hintText: widget.hintText, - hintStyle: TextStyle( - fontSize: widget.fontSize, - fontWeight: widget.fontWeight, - color: Theme.of(context).hintColor), - contentPadding: widget.padding != null - ? widget.padding - : EdgeInsets.symmetric( - vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, - horizontal: 16.0), - filled: true, - fillColor: widget.bare - ? Colors.transparent - : Theme.of(context).backgroundColor, - suffixIcon: _buildSuffixIcon(), - prefixIcon: widget.type != "search" - ? widget.prefixIcon != null - ? Padding( - padding: EdgeInsets.only( - left: 28.0, top: 14.0, bottom: 14.0, right: 0), - child: Text( - "\$", - style: TextStyle( - fontSize: 14, fontWeight: FontWeight.w800), - ), - ) - : null - : Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), - errorStyle: TextStyle( - fontSize: 14.0, - fontWeight: widget.fontWeight, - height: widget.borderOnlyError ? 0.0 : null), - errorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - focusedErrorBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .errorColor - .withOpacity(widget.bare ? 0.0 : 0.5), - width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .dividerColor - .withOpacity(widget.bare ? 0.0 : 1.0), - width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - disabledBorder: OutlineInputBorder( + counterText: "", + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: widget.fontSize, + fontWeight: widget.fontWeight, + color: Theme + .of(context) + .hintColor), + contentPadding: widget.padding != null + ? widget.padding + : EdgeInsets.symmetric( + vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0, + horizontal: 16.0), + filled: true, + fillColor: widget.bare + ? Colors.transparent + : widget.fieldTextColor != null + ? widget.fieldTextColor + : Theme + .of(context) + .backgroundColor, + suffixIcon: _buildSuffixIcon(), + prefixIcon: widget.type != "search" + ? widget.prefixIcon != null + ? Padding( + padding: EdgeInsets.only( + left: 28.0, top: 14.0, bottom: 14.0, right: 0), + child: Text( + "\$", + style: TextStyle( + fontSize: 14, fontWeight: FontWeight.w800), + ), + ) + : null + : Icon(EvaIcons.search, size: 20.0, color: Colors.grey[500]), + errorStyle: TextStyle( + fontSize: 14.0, + fontWeight: widget.fontWeight, + height: widget.borderOnlyError ? 0.0 : null), + errorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme + .of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: widget.borderWidth), + borderRadius: widget.bare + ? BorderRadius.circular(0.0) + : widget.borderRadius != null + ? widget.borderRadius + : BorderRadius.circular(widget.borderRadiusValue)), + focusedErrorBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme + .of(context) + .errorColor + .withOpacity(widget.bare ? 0.0 : 0.5), + width: widget.borderWidth), + borderRadius: widget.bare + ? BorderRadius.circular(0.0) + : widget.borderRadius != null + ? widget.borderRadius + : BorderRadius.circular(widget.borderRadiusValue)), + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: Theme + .of(context) + .dividerColor + .withOpacity(widget.bare ? 0.0 : 1.0), + width: widget.borderWidth), + borderRadius: widget.bare + ? BorderRadius.circular(0.0) + : widget.borderRadius != null + ? widget.borderRadius + : BorderRadius.circular(widget.borderRadiusValue)), + disabledBorder: + OutlineInputBorder(borderSide: BorderSide(color: Theme + .of(context) + .dividerColor + .withOpacity(widget.bare ? 0.0 : 1.0), + width: widget.borderWidth), + borderRadius: widget.bare ? BorderRadius.circular(0.0) : widget + .borderRadius != null ? widget.borderRadius : BorderRadius + .circular(widget.borderRadiusValue)), + enabledBorder: OutlineInputBorder( borderSide: BorderSide( - color: Theme.of(context) + color: Theme + .of(context) .dividerColor .withOpacity(widget.bare ? 0.0 : 1.0), - width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Theme.of(context) - .dividerColor - .withOpacity(widget.bare ? 0.0 : 1.0), - width: 2.0), - borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0), - ), - ), + width: widget.borderWidth), + borderRadius: widget.bare + ? BorderRadius.circular(0.0) + : widget.borderRadius != null + ? widget.borderRadius + : BorderRadius.circular(widget.borderRadiusValue), + )), ), )); } diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index d5e9c51..3005588 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -24,40 +24,42 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { AppGlobal.context = context; - return Scaffold( - backgroundColor: Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar - ? AppBar( - elevation: 0, - backgroundColor: Theme.of(context).appBarTheme.color, - textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), - ), - title: Text(appBarTitle.toUpperCase()), - leading: Builder( - builder: (BuildContext context) { - return ArrowBack(); - }, - ), - centerTitle: true, - actions: [ - IconButton( - icon: Icon(FontAwesomeIcons.home), - color: Colors.white, - onPressed: () { - // TODO add navigator to home page + return SafeArea( + child: Scaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(appBarTitle.toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return ArrowBack(); }, ), - ], - ) - : null, - body: baseViewModel != null - ? NetworkBaseView( - child: buildBodyWidget(), - baseViewModel: baseViewModel, - ) - : buildBodyWidget(), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + // TODO add navigator to home page + }, + ), + ], + ) + : null, + body: baseViewModel != null + ? NetworkBaseView( + child: buildBodyWidget(), + baseViewModel: baseViewModel, + ) + : buildBodyWidget(), + ), ); } diff --git a/lib/widgets/others/network_base_view.dart b/lib/widgets/others/network_base_view.dart index 5776e84..fe409bc 100644 --- a/lib/widgets/others/network_base_view.dart +++ b/lib/widgets/others/network_base_view.dart @@ -20,6 +20,8 @@ class NetworkBaseView extends StatelessWidget { buildBaseViewWidget() { switch (baseViewModel.state) { case ViewState.Idle: + case ViewState.BusyLocal: + case ViewState.ErrorLocal: return child; break; case ViewState.Busy: @@ -31,7 +33,6 @@ class NetworkBaseView extends StatelessWidget { error: baseViewModel.error, ), ); - break; } } } diff --git a/lib/widgets/others/rounded_container.dart b/lib/widgets/others/rounded_container.dart new file mode 100644 index 0000000..93dc6cc --- /dev/null +++ b/lib/widgets/others/rounded_container.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; + +class RoundedContainer extends StatefulWidget { + final double width; + final double height; + final double raduis; + final Color backgroundColor; + final double margin; + final double elevation; + final bool showBorder; + final Color borderColor; + final bool customCornerRaduis; + final double topLeft; + final double bottomRight; + final double topRight; + final double bottomLeft; + final Widget child; + final double borderWidth; + + RoundedContainer( + {@required this.child, + this.width, + this.height, + this.raduis = 10, + this.backgroundColor = Colors.white, + this.margin = 10, + this.elevation = 1, + this.showBorder = false, + this.borderColor = Colors.red, + this.customCornerRaduis = false, + this.topLeft = 0, + this.topRight = 0, + this.bottomRight = 0, + this.bottomLeft = 0, + this.borderWidth = 1}); + + @override + _RoundedContainerState createState() => _RoundedContainerState(); +} + +class _RoundedContainerState extends State { + @override + Widget build(BuildContext context) { + return Container( + width: widget.width, + height: widget.height, + margin: EdgeInsets.all(widget.margin), + decoration: widget.showBorder == true + ? BoxDecoration( + color: Theme.of(context).primaryColor, + border: Border.all( + color: widget.borderColor, width: widget.borderWidth), + borderRadius: widget.customCornerRaduis + ? BorderRadius.only( + topLeft: Radius.circular(widget.topLeft), + topRight: Radius.circular(widget.topRight), + bottomRight: Radius.circular(widget.bottomRight), + bottomLeft: Radius.circular(widget.bottomLeft)) + : BorderRadius.circular(widget.raduis), + boxShadow: [ + BoxShadow( + color: Colors.grey.withOpacity(0.1), + spreadRadius: 10, + blurRadius: 5, + offset: Offset(0, 5), // changes position of shadow + ), + ]) + : null, + child: Card( + margin: EdgeInsets.all(0), + shape: RoundedRectangleBorder( + borderRadius: widget.customCornerRaduis + ? BorderRadius.only( + topLeft: Radius.circular(widget.topLeft), + topRight: Radius.circular(widget.topRight), + bottomRight: Radius.circular(widget.bottomRight), + bottomLeft: Radius.circular(widget.bottomLeft)) + : BorderRadius.circular(widget.raduis), + ), + color: widget.backgroundColor, + child: widget.child, + )); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index fefcf54..358a44e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -92,3 +92,7 @@ flutter: - asset: assets/fonts/Work_Sans/WorkSans-Bold.ttf - asset: assets/fonts/Work_Sans/WorkSans-Bold.ttf weight: 700 + + - family: DriverApp + fonts: + - asset: lib/app-icons/fonts/DriverApp.ttf