diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3820a95 --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ +/coverage/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..b3e578d --- /dev/null +++ b/.metadata @@ -0,0 +1,33 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "ff37bef603469fb030f2b72995ab929ccfc227f0" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + - platform: android + create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + - platform: ios + create_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + base_revision: ff37bef603469fb030f2b72995ab929ccfc227f0 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..be3943c --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,14 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java +.cxx/ + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle.kts b/android/app/build.gradle.kts new file mode 100644 index 0000000..953f44d --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,44 @@ +plugins { + id("com.android.application") + id("kotlin-android") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "ma.rentaldrivego.car_rental_app" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_17.toString() + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "ma.rentaldrivego.car_rental_app" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.getByName("debug") + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..df5c145 --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/ma/rentaldrivego/car_rental_app/MainActivity.kt b/android/app/src/main/kotlin/ma/rentaldrivego/car_rental_app/MainActivity.kt new file mode 100644 index 0000000..2592430 --- /dev/null +++ b/android/app/src/main/kotlin/ma/rentaldrivego/car_rental_app/MainActivity.kt @@ -0,0 +1,5 @@ +package ma.rentaldrivego.car_rental_app + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity : FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-hdpi/launcher_icon.png b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png new file mode 100644 index 0000000..83c6905 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/launcher_icon.png b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png new file mode 100644 index 0000000..9b4bb8f Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png new file mode 100644 index 0000000..a67f608 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png new file mode 100644 index 0000000..762aa72 Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png new file mode 100644 index 0000000..3bb8a2f Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/launcher_icon.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle.kts b/android/build.gradle.kts new file mode 100644 index 0000000..dbee657 --- /dev/null +++ b/android/build.gradle.kts @@ -0,0 +1,24 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +val newBuildDir: Directory = + rootProject.layout.buildDirectory + .dir("../../build") + .get() +rootProject.layout.buildDirectory.value(newBuildDir) + +subprojects { + val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) + project.layout.buildDirectory.value(newSubprojectBuildDir) +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean") { + delete(rootProject.layout.buildDirectory) +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..fbee1d8 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,2 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e4ef43f --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..ca7fe06 --- /dev/null +++ b/android/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + val flutterSdkPath = + run { + val properties = java.util.Properties() + file("local.properties").inputStream().use { properties.load(it) } + val flutterSdkPath = properties.getProperty("flutter.sdk") + require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } + flutterSdkPath + } + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id("dev.flutter.flutter-plugin-loader") version "1.0.0" + id("com.android.application") version "8.11.1" apply false + id("org.jetbrains.kotlin.android") version "2.2.20" apply false +} + +include(":app") diff --git a/app_search.jpeg b/app_search.jpeg new file mode 100644 index 0000000..ca8a978 Binary files /dev/null and b/app_search.jpeg differ diff --git a/assets/images/logo.jpeg b/assets/images/logo.jpeg new file mode 100644 index 0000000..3ba550b Binary files /dev/null and b/assets/images/logo.jpeg differ diff --git a/ios/.gitignore b/ios/.gitignore new file mode 100644 index 0000000..7a7f987 --- /dev/null +++ b/ios/.gitignore @@ -0,0 +1,34 @@ +**/dgph +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 0000000..391a902 --- /dev/null +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + + diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig new file mode 100644 index 0000000..ec97fc6 --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..c4855bf --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" +#include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..620e46e --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,43 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '13.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 flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..6f5cdd9 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,620 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 54; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; + 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + 331C8082294A63A400263BE5 /* RunnerTests */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + 331C8081294A63A400263BE5 /* RunnerTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, + 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */, + 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, + ); + path = Runner; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 331C8080294A63A400263BE5 /* RunnerTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; + buildPhases = ( + 331C807D294A63A400263BE5 /* Sources */, + 331C807F294A63A400263BE5 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 331C8086294A63A400263BE5 /* PBXTargetDependency */, + ); + name = RunnerTests; + productName = RunnerTests; + productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; + ORGANIZATIONNAME = ""; + TargetAttributes = { + 331C8080294A63A400263BE5 = { + CreatedOnToolsVersion = 14.0; + TestTargetID = 97C146ED1CF9000F007C117D; + }; + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + LastSwiftMigration = 1100; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 9.3"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + 331C8080294A63A400263BE5 /* RunnerTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 331C807F294A63A400263BE5 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 331C807D294A63A400263BE5 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + 7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 331C8086294A63A400263BE5 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 249021D3217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Profile; + }; + 249021D4217E4FDB00AE95B9 /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Profile; + }; + 331C8088294A63A400263BE5 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Debug; + }; + 331C8089294A63A400263BE5 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Release; + }; + 331C808A294A63A400263BE5 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp.RunnerTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; + }; + name = Profile; + }; + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = AppIcon; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SUPPORTED_PLATFORMS = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; + ENABLE_BITCODE = NO; + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = ma.rentaldrivego.carRentalApp; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_VERSION = 5.0; + VERSIONING_SYSTEM = "apple-generic"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 331C8088294A63A400263BE5 /* Debug */, + 331C8089294A63A400263BE5 /* Release */, + 331C808A294A63A400263BE5 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + 249021D3217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + 249021D4217E4FDB00AE95B9 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 0000000..e3773d4 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d526a1 --- /dev/null +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 0000000..f9b0d7c --- /dev/null +++ b/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift new file mode 100644 index 0000000..c30b367 --- /dev/null +++ b/ios/Runner/AppDelegate.swift @@ -0,0 +1,16 @@ +import Flutter +import UIKit + +@main +@objc class AppDelegate: FlutterAppDelegate, FlutterImplicitEngineDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } + + func didInitializeImplicitFlutterEngine(_ engineBridge: FlutterImplicitEngineBridge) { + GeneratedPluginRegistrant.register(with: engineBridge.pluginRegistry) + } +} diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..d0d98aa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1 @@ +{"images":[{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"20x20","idiom":"iphone","filename":"Icon-App-20x20@3x.png","scale":"3x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"29x29","idiom":"iphone","filename":"Icon-App-29x29@3x.png","scale":"3x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"40x40","idiom":"iphone","filename":"Icon-App-40x40@3x.png","scale":"3x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@1x.png","scale":"1x"},{"size":"57x57","idiom":"iphone","filename":"Icon-App-57x57@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@2x.png","scale":"2x"},{"size":"60x60","idiom":"iphone","filename":"Icon-App-60x60@3x.png","scale":"3x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@1x.png","scale":"1x"},{"size":"20x20","idiom":"ipad","filename":"Icon-App-20x20@2x.png","scale":"2x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@1x.png","scale":"1x"},{"size":"29x29","idiom":"ipad","filename":"Icon-App-29x29@2x.png","scale":"2x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@1x.png","scale":"1x"},{"size":"40x40","idiom":"ipad","filename":"Icon-App-40x40@2x.png","scale":"2x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@1x.png","scale":"1x"},{"size":"50x50","idiom":"ipad","filename":"Icon-App-50x50@2x.png","scale":"2x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@1x.png","scale":"1x"},{"size":"72x72","idiom":"ipad","filename":"Icon-App-72x72@2x.png","scale":"2x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@1x.png","scale":"1x"},{"size":"76x76","idiom":"ipad","filename":"Icon-App-76x76@2x.png","scale":"2x"},{"size":"83.5x83.5","idiom":"ipad","filename":"Icon-App-83.5x83.5@2x.png","scale":"2x"},{"size":"1024x1024","idiom":"ios-marketing","filename":"Icon-App-1024x1024@1x.png","scale":"1x"}],"info":{"version":1,"author":"xcode"}} \ No newline at end of file diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 0000000..c001ca5 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 0000000..3158c6c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 0000000..c8af80e Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 0000000..c255276 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 0000000..2b777d6 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 0000000..3cc4e91 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 0000000..8c6550e Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 0000000..c8af80e Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 0000000..bfdf759 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 0000000..89c4fe7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png new file mode 100644 index 0000000..0016fc3 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png new file mode 100644 index 0000000..e7dff9c Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-50x50@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png new file mode 100644 index 0000000..fffc8cf Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png new file mode 100644 index 0000000..72bf616 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..89c4fe7 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 0000000..bf43242 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png new file mode 100644 index 0000000..83c6905 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png new file mode 100644 index 0000000..762aa72 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..98510d0 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 0000000..485dc14 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 0000000..aea5823 Binary files /dev/null and b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 0000000..0bedcf2 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 0000000..9da19ea Binary files /dev/null and b/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 0000000..89c2725 --- /dev/null +++ b/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/ios/Runner/Base.lproj/LaunchScreen.storyboard b/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 0000000..f2e259c --- /dev/null +++ b/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 0000000..f3c2851 --- /dev/null +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist new file mode 100644 index 0000000..56084c4 --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,70 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Car Rental App + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + car_rental_app + CFBundlePackageType + APPL + CFBundleShortVersionString + $(FLUTTER_BUILD_NAME) + CFBundleSignature + ???? + CFBundleVersion + $(FLUTTER_BUILD_NUMBER) + LSRequiresIPhoneOS + + UIApplicationSceneManifest + + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + + UIWindowSceneSessionRoleApplication + + + UISceneClassName + UIWindowScene + UISceneConfigurationName + flutter + UISceneDelegateClassName + $(PRODUCT_MODULE_NAME).SceneDelegate + UISceneStoryboardFile + Main + + + + + UIApplicationSupportsIndirectInputEvents + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/ios/Runner/Runner-Bridging-Header.h b/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 0000000..308a2a5 --- /dev/null +++ b/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/ios/Runner/SceneDelegate.swift b/ios/Runner/SceneDelegate.swift new file mode 100644 index 0000000..b9ce8ea --- /dev/null +++ b/ios/Runner/SceneDelegate.swift @@ -0,0 +1,6 @@ +import Flutter +import UIKit + +class SceneDelegate: FlutterSceneDelegate { + +} diff --git a/ios/RunnerTests/RunnerTests.swift b/ios/RunnerTests/RunnerTests.swift new file mode 100644 index 0000000..86a7c3b --- /dev/null +++ b/ios/RunnerTests/RunnerTests.swift @@ -0,0 +1,12 @@ +import Flutter +import UIKit +import XCTest + +class RunnerTests: XCTestCase { + + func testExample() { + // If you add code to the Runner application, consider adding tests here. + // See https://developer.apple.com/documentation/xctest for more information about using XCTest. + } + +} diff --git a/l10n.yaml b/l10n.yaml new file mode 100644 index 0000000..06c3dba --- /dev/null +++ b/l10n.yaml @@ -0,0 +1,5 @@ +arb-dir: lib/l10n +template-arb-file: app_en.arb +output-localization-file: app_localizations.dart +output-dir: lib/l10n +nullable-getter: false diff --git a/lib/app.dart b/lib/app.dart new file mode 100644 index 0000000..e25182a --- /dev/null +++ b/lib/app.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'core/router/app_router.dart'; +import 'core/theme/app_theme.dart'; +import 'core/providers/locale_provider.dart'; +import 'core/providers/theme_provider.dart'; +import 'l10n/app_localizations.dart'; + +class CarRentalApp extends ConsumerWidget { + const CarRentalApp({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final router = ref.watch(routerProvider); + final locale = ref.watch(localeProvider); + final themeMode = ref.watch(themeProvider); + + return MaterialApp.router( + title: 'RentalDriveGo', + theme: AppTheme.light, + darkTheme: AppTheme.dark, + themeMode: themeMode, + routerConfig: router, + debugShowCheckedModeBanner: false, + locale: locale, + supportedLocales: const [ + Locale('en'), + Locale('fr'), + Locale('ar'), + ], + localizationsDelegates: const [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + ); + } +} diff --git a/lib/core/constants/app_constants.dart b/lib/core/constants/app_constants.dart new file mode 100644 index 0000000..eb4e2f2 --- /dev/null +++ b/lib/core/constants/app_constants.dart @@ -0,0 +1,14 @@ +import 'dart:io'; + +class AppConstants { + // Android emulator routes localhost as 10.0.2.2; iOS simulator uses localhost fine + static String get baseUrl => Platform.isAndroid + ? 'http://10.0.2.2:4000/api/v1' + : 'http://localhost:4000/api/v1'; + + static const String tokenKey = 'auth_token'; + static const String userTypeKey = 'user_type'; + + static const String userTypeEmployee = 'employee'; + static const String userTypeRenter = 'renter'; +} diff --git a/lib/core/models/analytics.dart b/lib/core/models/analytics.dart new file mode 100644 index 0000000..054810a --- /dev/null +++ b/lib/core/models/analytics.dart @@ -0,0 +1,40 @@ +class DashboardMetrics { + final int totalReservations; + final int activeReservations; + final double totalRevenue; + final int totalVehicles; + final int availableVehicles; + final int totalCustomers; + final double occupancyRate; + + const DashboardMetrics({ + required this.totalReservations, + required this.activeReservations, + required this.totalRevenue, + required this.totalVehicles, + required this.availableVehicles, + required this.totalCustomers, + required this.occupancyRate, + }); + + factory DashboardMetrics.fromJson(Map json) => + DashboardMetrics( + totalReservations: json['totalReservations'] as int? ?? 0, + activeReservations: json['activeReservations'] as int? ?? 0, + totalRevenue: (json['totalRevenue'] as num?)?.toDouble() ?? 0, + totalVehicles: json['totalVehicles'] as int? ?? 0, + availableVehicles: json['availableVehicles'] as int? ?? 0, + totalCustomers: json['totalCustomers'] as int? ?? 0, + occupancyRate: (json['occupancyRate'] as num?)?.toDouble() ?? 0, + ); + + factory DashboardMetrics.empty() => const DashboardMetrics( + totalReservations: 0, + activeReservations: 0, + totalRevenue: 0, + totalVehicles: 0, + availableVehicles: 0, + totalCustomers: 0, + occupancyRate: 0, + ); +} diff --git a/lib/core/models/auth_models.dart b/lib/core/models/auth_models.dart new file mode 100644 index 0000000..af313b8 --- /dev/null +++ b/lib/core/models/auth_models.dart @@ -0,0 +1,54 @@ +class Employee { + final String id; + final String firstName; + final String lastName; + final String email; + final String role; + final bool isActive; + final String? companyId; + + const Employee({ + required this.id, + required this.firstName, + required this.lastName, + required this.email, + required this.role, + required this.isActive, + this.companyId, + }); + + String get fullName => '$firstName $lastName'; + + factory Employee.fromJson(Map json) => Employee( + id: json['id'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + email: json['email'] as String, + role: json['role'] as String, + isActive: json['isActive'] as bool? ?? true, + companyId: json['companyId'] as String?, + ); +} + +class Renter { + final String id; + final String firstName; + final String lastName; + final String email; + + const Renter({ + required this.id, + required this.firstName, + required this.lastName, + required this.email, + }); + + String get fullName => '$firstName $lastName'; + + factory Renter.fromJson(Map json) => Renter( + id: json['id'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + email: json['email'] as String, + ); +} diff --git a/lib/core/models/customer.dart b/lib/core/models/customer.dart new file mode 100644 index 0000000..8f37f18 --- /dev/null +++ b/lib/core/models/customer.dart @@ -0,0 +1,70 @@ +class Customer { + final String id; + final String firstName; + final String lastName; + final String? email; + final String? phone; + final String licenseStatus; + final bool isFlagged; + final String? flagReason; + final DateTime? dateOfBirth; + final String? nationality; + final DateTime createdAt; + + const Customer({ + required this.id, + required this.firstName, + required this.lastName, + this.email, + this.phone, + required this.licenseStatus, + required this.isFlagged, + this.flagReason, + this.dateOfBirth, + this.nationality, + required this.createdAt, + }); + + String get fullName => '$firstName $lastName'; + + factory Customer.fromJson(Map json) => Customer( + id: json['id'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + email: json['email'] as String?, + phone: json['phone'] as String?, + licenseStatus: json['licenseStatus'] as String? ?? 'PENDING', + isFlagged: json['isFlagged'] as bool? ?? false, + flagReason: json['flagReason'] as String?, + dateOfBirth: json['dateOfBirth'] != null + ? DateTime.tryParse(json['dateOfBirth'] as String) + : null, + nationality: json['nationality'] as String?, + createdAt: DateTime.parse( + json['createdAt'] as String? ?? DateTime.now().toIso8601String()), + ); +} + +class CustomerListResponse { + final List data; + final int total; + final int page; + final int pageSize; + + const CustomerListResponse({ + required this.data, + required this.total, + required this.page, + required this.pageSize, + }); + + factory CustomerListResponse.fromJson(Map json) => + CustomerListResponse( + data: (json['data'] as List) + .map((e) => Customer.fromJson(e as Map)) + .toList(), + total: json['total'] as int? ?? 0, + page: json['page'] as int? ?? 1, + pageSize: json['pageSize'] as int? ?? 20, + ); +} diff --git a/lib/core/models/marketplace.dart b/lib/core/models/marketplace.dart new file mode 100644 index 0000000..d253cbb --- /dev/null +++ b/lib/core/models/marketplace.dart @@ -0,0 +1,223 @@ +class CompanyBrand { + final String displayName; + final String? logoUrl; + final String subdomain; + final double? marketplaceRating; + final String primaryColor; + + const CompanyBrand({ + required this.displayName, + this.logoUrl, + required this.subdomain, + this.marketplaceRating, + required this.primaryColor, + }); + + factory CompanyBrand.fromJson(Map json) => CompanyBrand( + displayName: json['displayName'] as String? ?? '', + logoUrl: json['logoUrl'] as String?, + subdomain: json['subdomain'] as String? ?? '', + marketplaceRating: + (json['marketplaceRating'] as num?)?.toDouble(), + primaryColor: json['primaryColor'] as String? ?? '#1A56DB', + ); +} + +class MarketplaceCompany { + final String id; + final CompanyBrand brand; + + const MarketplaceCompany({required this.id, required this.brand}); + + factory MarketplaceCompany.fromJson(Map json) => + MarketplaceCompany( + id: json['id'] as String, + brand: CompanyBrand.fromJson( + json['brand'] as Map), + ); +} + +class MarketplaceVehicle { + final String id; + final String companyId; + final String make; + final String model; + final int year; + final String? color; + final String licensePlate; + final String category; + final int seats; + final String transmission; + final String fuelType; + final List features; + // dailyRate comes in cents from the API + final int dailyRateCents; + final String status; + final List photos; + final int? mileage; + final bool isPublished; + final MarketplaceCompany company; + final bool availability; + final String availabilityStatus; + final DateTime? nextAvailableAt; + + const MarketplaceVehicle({ + required this.id, + required this.companyId, + required this.make, + required this.model, + required this.year, + this.color, + required this.licensePlate, + required this.category, + required this.seats, + required this.transmission, + required this.fuelType, + required this.features, + required this.dailyRateCents, + required this.status, + required this.photos, + this.mileage, + required this.isPublished, + required this.company, + required this.availability, + required this.availabilityStatus, + this.nextAvailableAt, + }); + + String get displayName => '$year $make $model'; + String? get primaryPhoto => photos.isNotEmpty ? photos.first : null; + // Convert cents to dollars for display + double get dailyRate => dailyRateCents / 100; + String get companySlug => company.brand.subdomain; + + factory MarketplaceVehicle.fromJson(Map json) => + MarketplaceVehicle( + id: json['id'] as String, + companyId: json['companyId'] as String, + make: json['make'] as String, + model: json['model'] as String, + year: json['year'] as int, + color: json['color'] as String?, + licensePlate: json['licensePlate'] as String, + category: json['category'] as String? ?? 'ECONOMY', + seats: json['seats'] as int? ?? 5, + transmission: json['transmission'] as String? ?? 'MANUAL', + fuelType: json['fuelType'] as String? ?? 'GASOLINE', + features: (json['features'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + dailyRateCents: json['dailyRate'] as int? ?? 0, + status: json['status'] as String? ?? 'AVAILABLE', + photos: (json['photos'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + mileage: json['mileage'] as int?, + isPublished: json['isPublished'] as bool? ?? false, + company: MarketplaceCompany.fromJson( + json['company'] as Map), + availability: json['availability'] as bool? ?? true, + availabilityStatus: + json['availabilityStatus'] as String? ?? 'AVAILABLE', + nextAvailableAt: json['nextAvailableAt'] != null + ? DateTime.tryParse(json['nextAvailableAt'] as String) + : null, + ); +} + +class MarketplaceSearchResult { + final List data; + final int total; + final int page; + final int pageSize; + + const MarketplaceSearchResult({ + required this.data, + required this.total, + required this.page, + required this.pageSize, + }); + + factory MarketplaceSearchResult.fromJson(Map json) { + final raw = json['data'] ?? json; + if (raw is List) { + return MarketplaceSearchResult( + data: raw + .map((e) => + MarketplaceVehicle.fromJson(e as Map)) + .toList(), + total: json['total'] as int? ?? raw.length, + page: json['page'] as int? ?? 1, + pageSize: json['pageSize'] as int? ?? 20, + ); + } + return MarketplaceSearchResult( + data: (json['data'] as List) + .map((e) => + MarketplaceVehicle.fromJson(e as Map)) + .toList(), + total: json['total'] as int? ?? 0, + page: json['page'] as int? ?? 1, + pageSize: json['pageSize'] as int? ?? 20, + ); + } +} + +class MarketplaceOffer { + final String id; + final String title; + final String? description; + final String? imageUrl; + final String type; + final int discountValue; + final String? promoCode; + final bool isFeatured; + final DateTime validUntil; + final MarketplaceCompany company; + + const MarketplaceOffer({ + required this.id, + required this.title, + this.description, + this.imageUrl, + required this.type, + required this.discountValue, + this.promoCode, + required this.isFeatured, + required this.validUntil, + required this.company, + }); + + String get discountLabel { + switch (type) { + case 'PERCENTAGE': + return '${discountValue}% off'; + case 'FIXED_AMOUNT': + return '\$${(discountValue / 100).toStringAsFixed(0)} off'; + case 'FREE_DAY': + return '$discountValue free day(s)'; + case 'SPECIAL_RATE': + return 'Special rate'; + default: + return 'Offer'; + } + } + + factory MarketplaceOffer.fromJson(Map json) => + MarketplaceOffer( + id: json['id'] as String, + title: json['title'] as String, + description: json['description'] as String?, + imageUrl: json['imageUrl'] as String?, + type: json['type'] as String, + discountValue: json['discountValue'] as int? ?? 0, + promoCode: json['promoCode'] as String?, + isFeatured: json['isFeatured'] as bool? ?? false, + validUntil: + DateTime.parse(json['validUntil'] as String), + company: MarketplaceCompany.fromJson( + json['company'] as Map), + ); +} diff --git a/lib/core/models/reservation.dart b/lib/core/models/reservation.dart new file mode 100644 index 0000000..a0b0744 --- /dev/null +++ b/lib/core/models/reservation.dart @@ -0,0 +1,137 @@ +class Reservation { + final String id; + final String status; + final DateTime startDate; + final DateTime endDate; + final double totalAmount; + final String paymentStatus; + final String? vehicleId; + final String? customerId; + final VehicleSummary? vehicle; + final CustomerSummary? customer; + final DateTime createdAt; + final String? source; + + const Reservation({ + required this.id, + required this.status, + required this.startDate, + required this.endDate, + required this.totalAmount, + required this.paymentStatus, + this.vehicleId, + this.customerId, + this.vehicle, + this.customer, + required this.createdAt, + this.source, + }); + + int get days => endDate.difference(startDate).inDays; + + factory Reservation.fromJson(Map json) => Reservation( + id: json['id'] as String, + status: json['status'] as String, + startDate: DateTime.parse(json['startDate'] as String), + endDate: DateTime.parse(json['endDate'] as String), + totalAmount: (json['totalAmount'] as num?)?.toDouble() ?? 0, + paymentStatus: json['paymentStatus'] as String? ?? 'PENDING', + vehicleId: json['vehicleId'] as String?, + customerId: json['customerId'] as String?, + vehicle: json['vehicle'] != null + ? VehicleSummary.fromJson( + json['vehicle'] as Map) + : null, + customer: json['customer'] != null + ? CustomerSummary.fromJson( + json['customer'] as Map) + : null, + createdAt: DateTime.parse( + json['createdAt'] as String? ?? DateTime.now().toIso8601String()), + source: json['source'] as String?, + ); +} + +class VehicleSummary { + final String id; + final String make; + final String model; + final int year; + final String licensePlate; + final List photos; + + const VehicleSummary({ + required this.id, + required this.make, + required this.model, + required this.year, + required this.licensePlate, + required this.photos, + }); + + String get displayName => '$year $make $model'; + String? get primaryPhoto => photos.isNotEmpty ? photos.first : null; + + factory VehicleSummary.fromJson(Map json) => VehicleSummary( + id: json['id'] as String, + make: json['make'] as String, + model: json['model'] as String, + year: json['year'] as int, + licensePlate: json['licensePlate'] as String, + photos: (json['photos'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + ); +} + +class CustomerSummary { + final String id; + final String firstName; + final String lastName; + final String? email; + final String? phone; + + const CustomerSummary({ + required this.id, + required this.firstName, + required this.lastName, + this.email, + this.phone, + }); + + String get fullName => '$firstName $lastName'; + + factory CustomerSummary.fromJson(Map json) => + CustomerSummary( + id: json['id'] as String, + firstName: json['firstName'] as String, + lastName: json['lastName'] as String, + email: json['email'] as String?, + phone: json['phone'] as String?, + ); +} + +class ReservationListResponse { + final List data; + final int total; + final int page; + final int pageSize; + + const ReservationListResponse({ + required this.data, + required this.total, + required this.page, + required this.pageSize, + }); + + factory ReservationListResponse.fromJson(Map json) => + ReservationListResponse( + data: (json['data'] as List) + .map((e) => Reservation.fromJson(e as Map)) + .toList(), + total: json['total'] as int? ?? 0, + page: json['page'] as int? ?? 1, + pageSize: json['pageSize'] as int? ?? 20, + ); +} diff --git a/lib/core/models/vehicle.dart b/lib/core/models/vehicle.dart new file mode 100644 index 0000000..339f728 --- /dev/null +++ b/lib/core/models/vehicle.dart @@ -0,0 +1,81 @@ +class Vehicle { + final String id; + final String make; + final String model; + final int year; + final String licensePlate; + final double dailyRate; + final String status; + final String category; + final List photos; + final int? mileage; + final int? seats; + final String? transmission; + final String? fuelType; + final bool isPublished; + + const Vehicle({ + required this.id, + required this.make, + required this.model, + required this.year, + required this.licensePlate, + required this.dailyRate, + required this.status, + required this.category, + required this.photos, + this.mileage, + this.seats, + this.transmission, + this.fuelType, + required this.isPublished, + }); + + String get displayName => '$year $make $model'; + + String? get primaryPhoto => photos.isNotEmpty ? photos.first : null; + + factory Vehicle.fromJson(Map json) => Vehicle( + id: json['id'] as String, + make: json['make'] as String, + model: json['model'] as String, + year: json['year'] as int, + licensePlate: json['licensePlate'] as String, + dailyRate: (json['dailyRate'] as num).toDouble(), + status: json['status'] as String? ?? 'AVAILABLE', + category: json['category'] as String? ?? 'ECONOMY', + photos: (json['photos'] as List?) + ?.map((e) => e as String) + .toList() ?? + [], + mileage: json['mileage'] as int?, + seats: json['seats'] as int?, + transmission: json['transmission'] as String?, + fuelType: json['fuelType'] as String?, + isPublished: json['isPublished'] as bool? ?? false, + ); +} + +class VehicleListResponse { + final List data; + final int total; + final int page; + final int pageSize; + + const VehicleListResponse({ + required this.data, + required this.total, + required this.page, + required this.pageSize, + }); + + factory VehicleListResponse.fromJson(Map json) => + VehicleListResponse( + data: (json['data'] as List) + .map((e) => Vehicle.fromJson(e as Map)) + .toList(), + total: json['total'] as int? ?? 0, + page: json['page'] as int? ?? 1, + pageSize: json['pageSize'] as int? ?? 20, + ); +} diff --git a/lib/core/providers/auth_provider.dart b/lib/core/providers/auth_provider.dart new file mode 100644 index 0000000..45ddb94 --- /dev/null +++ b/lib/core/providers/auth_provider.dart @@ -0,0 +1,92 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../constants/app_constants.dart'; +import '../models/auth_models.dart'; +import '../services/auth_service.dart'; +import '../storage/token_storage.dart'; + +enum AuthStatus { unknown, authenticated, unauthenticated } + +class AuthState { + final AuthStatus status; + final String? userType; + final Employee? employee; + final Renter? renter; + + const AuthState({ + required this.status, + this.userType, + this.employee, + this.renter, + }); + + AuthState copyWith({ + AuthStatus? status, + String? userType, + Employee? employee, + Renter? renter, + }) => + AuthState( + status: status ?? this.status, + userType: userType ?? this.userType, + employee: employee ?? this.employee, + renter: renter ?? this.renter, + ); +} + +class AuthNotifier extends StateNotifier { + final AuthService _service; + + AuthNotifier(this._service) + : super(const AuthState(status: AuthStatus.unknown)); + + Future init() async { + final token = await TokenStorage.getToken(); + final userType = await TokenStorage.getUserType(); + if (token == null || userType == null) { + state = const AuthState(status: AuthStatus.unauthenticated); + return; + } + try { + if (userType == AppConstants.userTypeEmployee) { + final employee = await _service.getMe(); + state = AuthState( + status: AuthStatus.authenticated, + userType: userType, + employee: employee, + ); + } else { + final renter = await _service.getRenterMe(); + state = AuthState( + status: AuthStatus.authenticated, + userType: userType, + renter: renter, + ); + } + } catch (_) { + await TokenStorage.clear(); + state = const AuthState(status: AuthStatus.unauthenticated); + } + } + + Future loginEmployee(String email, String password) async { + final result = await _service.loginEmployee(email: email, password: password); + await TokenStorage.saveToken(result.token); + await TokenStorage.saveUserType(AppConstants.userTypeEmployee); + state = AuthState( + status: AuthStatus.authenticated, + userType: AppConstants.userTypeEmployee, + employee: result.employee, + ); + } + + Future logout() async { + await _service.logout(); + state = const AuthState(status: AuthStatus.unauthenticated); + } +} + +final authServiceProvider = Provider((_) => AuthService()); + +final authProvider = StateNotifierProvider((ref) { + return AuthNotifier(ref.read(authServiceProvider)); +}); diff --git a/lib/core/providers/locale_provider.dart b/lib/core/providers/locale_provider.dart new file mode 100644 index 0000000..576e499 --- /dev/null +++ b/lib/core/providers/locale_provider.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +const _localeKey = 'app_locale'; + +const _storage = FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true), +); + +class LocaleNotifier extends StateNotifier { + LocaleNotifier() : super(const Locale('en')) { + _load(); + } + + Future _load() async { + final code = await _storage.read(key: _localeKey); + if (code != null) state = Locale(code); + } + + Future setLocale(Locale locale) async { + await _storage.write(key: _localeKey, value: locale.languageCode); + state = locale; + } +} + +final localeProvider = StateNotifierProvider( + (_) => LocaleNotifier(), +); diff --git a/lib/core/providers/theme_provider.dart b/lib/core/providers/theme_provider.dart new file mode 100644 index 0000000..0655a16 --- /dev/null +++ b/lib/core/providers/theme_provider.dart @@ -0,0 +1,34 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +const _themeKey = 'app_theme'; + +const _storage = FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true), +); + +class ThemeNotifier extends StateNotifier { + ThemeNotifier() : super(ThemeMode.dark) { + _load(); + } + + Future _load() async { + final val = await _storage.read(key: _themeKey); + if (val == 'light') state = ThemeMode.light; + if (val == 'dark') state = ThemeMode.dark; + } + + Future setMode(ThemeMode mode) async { + await _storage.write( + key: _themeKey, value: mode == ThemeMode.light ? 'light' : 'dark'); + state = mode; + } + + void toggle() => + setMode(state == ThemeMode.dark ? ThemeMode.light : ThemeMode.dark); +} + +final themeProvider = StateNotifierProvider( + (_) => ThemeNotifier(), +); diff --git a/lib/core/router/app_router.dart b/lib/core/router/app_router.dart new file mode 100644 index 0000000..fb5305a --- /dev/null +++ b/lib/core/router/app_router.dart @@ -0,0 +1,159 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../constants/app_constants.dart'; +import '../models/marketplace.dart'; +import '../providers/auth_provider.dart'; +import '../../features/auth/screens/splash_screen.dart'; +import '../../features/auth/screens/landing_screen.dart'; +import '../../features/auth/screens/role_screen.dart'; +import '../../features/auth/screens/employee_login_screen.dart'; +import '../../features/dashboard/screens/dashboard_shell.dart'; +import '../../features/dashboard/screens/home_screen.dart'; +import '../../features/dashboard/screens/vehicles_screen.dart'; +import '../../features/dashboard/screens/vehicle_detail_screen.dart'; +import '../../features/dashboard/screens/reservations_screen.dart'; +import '../../features/dashboard/screens/reservation_detail_screen.dart'; +import '../../features/dashboard/screens/customers_screen.dart'; +import '../../features/dashboard/screens/customer_detail_screen.dart'; +import '../../features/client/screens/client_shell.dart'; +import '../../features/client/screens/client_home_screen.dart'; +import '../../features/client/screens/client_vehicle_detail_screen.dart'; +import '../../features/client/screens/booking_screen.dart'; +import '../../features/client/screens/my_bookings_screen.dart'; + +final routerProvider = Provider((ref) { + final router = GoRouter( + initialLocation: '/splash', + redirect: (context, state) { + // Read (not watch) so redirect is evaluated on router.refresh() + final auth = ref.read(authProvider); + final status = auth.status; + final loc = state.matchedLocation; + final isSplash = loc == '/splash'; + final isLanding = loc == '/landing'; + final isLogin = loc.startsWith('/login'); + + // Still initialising — stay on splash + if (status == AuthStatus.unknown) { + return isSplash ? null : '/splash'; + } + + // Auth resolved — always leave splash + if (isSplash) { + if (status == AuthStatus.authenticated) { + return auth.userType == AppConstants.userTypeEmployee + ? '/dashboard' + : '/client'; + } + return '/landing'; + } + + if (status == AuthStatus.unauthenticated) { + // Allow landing, login routes, and the entire client section without auth + if (isLanding || isLogin || loc.startsWith('/client')) return null; + return '/landing'; + } + + if (status == AuthStatus.authenticated) { + if (isLogin) { + return auth.userType == AppConstants.userTypeEmployee + ? '/dashboard' + : '/client'; + } + } + return null; + }, + routes: [ + GoRoute( + path: '/splash', + builder: (context, _) => const SplashScreen(), + ), + GoRoute( + path: '/landing', + builder: (context, _) => const LandingScreen(), + ), + GoRoute( + path: '/role', + builder: (context, _) => const RoleScreen(), + ), + GoRoute( + path: '/login/employee', + builder: (context, _) => const EmployeeLoginScreen(), + ), + ShellRoute( + builder: (context, state, child) => DashboardShell(child: child), + routes: [ + GoRoute( + path: '/dashboard', + builder: (context, _) => const HomeScreen(), + ), + GoRoute( + path: '/dashboard/vehicles', + builder: (context, _) => const VehiclesScreen(), + routes: [ + GoRoute( + path: ':id', + builder: (_, state) => + VehicleDetailScreen(id: state.pathParameters['id']!), + ), + ], + ), + GoRoute( + path: '/dashboard/reservations', + builder: (context, _) => const ReservationsScreen(), + routes: [ + GoRoute( + path: ':id', + builder: (_, state) => + ReservationDetailScreen(id: state.pathParameters['id']!), + ), + ], + ), + GoRoute( + path: '/dashboard/customers', + builder: (context, _) => const CustomersScreen(), + routes: [ + GoRoute( + path: ':id', + builder: (_, state) => + CustomerDetailScreen(id: state.pathParameters['id']!), + ), + ], + ), + ], + ), + ShellRoute( + builder: (context, state, child) => ClientShell(child: child), + routes: [ + GoRoute( + path: '/client', + builder: (context, _) => const ClientHomeScreen(), + ), + GoRoute( + path: '/client/vehicles/:id', + builder: (_, state) => ClientVehicleDetailScreen( + id: state.pathParameters['id']!, + vehicle: state.extra as MarketplaceVehicle?, + ), + ), + GoRoute( + path: '/client/book/:vehicleId', + builder: (_, state) => BookingScreen( + vehicleId: state.pathParameters['vehicleId']!, + vehicle: state.extra as MarketplaceVehicle?, + ), + ), + GoRoute( + path: '/client/bookings', + builder: (context, _) => const MyBookingsScreen(), + ), + ], + ), + ], + ); + + // Trigger redirect re-evaluation whenever auth state changes + ref.listen(authProvider, (_, _) => router.refresh()); + + return router; +}); diff --git a/lib/core/services/analytics_service.dart b/lib/core/services/analytics_service.dart new file mode 100644 index 0000000..4ff17d9 --- /dev/null +++ b/lib/core/services/analytics_service.dart @@ -0,0 +1,11 @@ +import '../models/analytics.dart'; +import 'api_client.dart'; + +class AnalyticsService { + final _client = ApiClient.instance; + + Future getDashboard() async { + final res = await _client.get('/analytics/dashboard'); + return DashboardMetrics.fromJson(res.data as Map); + } +} diff --git a/lib/core/services/api_client.dart b/lib/core/services/api_client.dart new file mode 100644 index 0000000..d8297fa --- /dev/null +++ b/lib/core/services/api_client.dart @@ -0,0 +1,58 @@ +import 'package:dio/dio.dart'; +import '../constants/app_constants.dart'; +import '../storage/token_storage.dart'; + +class ApiClient { + static final ApiClient _instance = ApiClient._(); + late final Dio _dio; + + ApiClient._() { + _dio = Dio(BaseOptions( + baseUrl: AppConstants.baseUrl, + connectTimeout: const Duration(seconds: 10), + receiveTimeout: const Duration(seconds: 30), + headers: {'Content-Type': 'application/json'}, + )); + + _dio.interceptors.add(InterceptorsWrapper( + onRequest: (options, handler) async { + final token = await TokenStorage.getToken(); + if (token != null) { + options.headers['Authorization'] = 'Bearer $token'; + } + handler.next(options); + }, + onResponse: (response, handler) { + // Every successful response from this API is wrapped: { data: } + // Unwrap it so services always receive the raw payload. + final body = response.data; + if (body is Map && + body.length == 1 && + body.containsKey('data')) { + response.data = body['data']; + } + handler.next(response); + }, + onError: (e, handler) { + handler.next(e); + }, + )); + } + + static ApiClient get instance => _instance; + + // baseUrl is dynamic (platform-aware), so recreate when it may have changed. + // In practice this is called once and cached via the singleton. + Dio get dio => _dio; + + Future get(String path, {Map? params}) => + _dio.get(path, queryParameters: params); + + Future post(String path, {dynamic data}) => + _dio.post(path, data: data); + + Future patch(String path, {dynamic data}) => + _dio.patch(path, data: data); + + Future delete(String path) => _dio.delete(path); +} diff --git a/lib/core/services/auth_service.dart b/lib/core/services/auth_service.dart new file mode 100644 index 0000000..3f36f6b --- /dev/null +++ b/lib/core/services/auth_service.dart @@ -0,0 +1,38 @@ +import '../models/auth_models.dart'; +import '../storage/token_storage.dart'; +import 'api_client.dart'; + +class AuthService { + final _client = ApiClient.instance; + + // Response after envelope unwrap: { token, employee: { id, firstName, ... } } + Future<({String token, Employee employee})> loginEmployee({ + required String email, + required String password, + }) async { + final res = await _client.post('/auth/employee/login', data: { + 'email': email, + 'password': password, + }); + final data = res.data as Map; + final token = data['token'] as String; + final employee = + Employee.fromJson(data['employee'] as Map); + return (token: token, employee: employee); + } + + // Response after envelope unwrap: { employee: { id, firstName, ... } } + Future getMe() async { + final res = await _client.get('/auth/employee/me'); + final data = res.data as Map; + return Employee.fromJson(data['employee'] as Map); + } + + Future getRenterMe() async { + final res = await _client.get('/auth/renter/me'); + final data = res.data as Map; + return Renter.fromJson(data); + } + + Future logout() => TokenStorage.clear(); +} diff --git a/lib/core/services/customer_service.dart b/lib/core/services/customer_service.dart new file mode 100644 index 0000000..5421ed6 --- /dev/null +++ b/lib/core/services/customer_service.dart @@ -0,0 +1,29 @@ +import '../models/customer.dart'; +import 'api_client.dart'; + +class CustomerService { + final _client = ApiClient.instance; + + Future getCustomers({ + int page = 1, + int pageSize = 20, + String? search, + }) async { + final res = await _client.get('/customers', params: { + 'page': page, + 'pageSize': pageSize, + if (search != null && search.isNotEmpty) 'search': search, + }); + return CustomerListResponse.fromJson(res.data as Map); + } + + Future getCustomer(String id) async { + final res = await _client.get('/customers/$id'); + return Customer.fromJson(res.data as Map); + } + + Future createCustomer(Map data) async { + final res = await _client.post('/customers', data: data); + return Customer.fromJson(res.data as Map); + } +} diff --git a/lib/core/services/marketplace_service.dart b/lib/core/services/marketplace_service.dart new file mode 100644 index 0000000..c6dd716 --- /dev/null +++ b/lib/core/services/marketplace_service.dart @@ -0,0 +1,98 @@ +import '../models/marketplace.dart'; +import 'api_client.dart'; + +class MarketplaceService { + final _client = ApiClient.instance; + + // After envelope unwrap: [ "City1", "City2", ... ] + Future> getCities() async { + final res = await _client.get('/marketplace/cities'); + final data = res.data; + if (data is List) { + return data.whereType().toList(); + } + return []; + } + + // After envelope unwrap: [ { id, title, ... }, ... ] + Future> getOffers() async { + final res = await _client.get('/marketplace/offers'); + final data = res.data; + if (data is List) { + return data + .map((e) => MarketplaceOffer.fromJson(e as Map)) + .toList(); + } + return []; + } + + // After envelope unwrap: [ { id, make, model, ... }, ... ] + Future search({ + String? city, + DateTime? startDate, + DateTime? endDate, + String? category, + String? transmission, + String? make, + int? maxPriceCents, + int page = 1, + int pageSize = 20, + }) async { + final res = await _client.get('/marketplace/search', params: { + 'page': page, + 'pageSize': pageSize, + if (city != null && city.isNotEmpty) 'city': city, + if (startDate != null) + 'startDate': '${startDate.toIso8601String().substring(0, 10)}T00:00:00.000Z', + if (endDate != null) + 'endDate': '${endDate.toIso8601String().substring(0, 10)}T00:00:00.000Z', + if (category != null) 'category': category, + if (transmission != null) 'transmission': transmission, + if (make != null && make.isNotEmpty) 'make': make, + if (maxPriceCents != null) 'maxPrice': maxPriceCents, + }); + + final data = res.data; + if (data is List) { + final vehicles = data + .map((e) => MarketplaceVehicle.fromJson(e as Map)) + .toList(); + return MarketplaceSearchResult( + data: vehicles, + total: vehicles.length, + page: page, + pageSize: pageSize, + ); + } + // Fallback: paginated object shape { data: [...], total: N } + return MarketplaceSearchResult.fromJson(data as Map); + } + + Future createReservation({ + required String vehicleId, + required String companySlug, + required String firstName, + required String lastName, + required String email, + String? phone, + required DateTime startDate, + required DateTime endDate, + String? notes, + String language = 'en', + }) async { + final res = await _client.post('/marketplace/reservations', data: { + 'vehicleId': vehicleId, + 'companySlug': companySlug, + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + if (phone != null && phone.isNotEmpty) 'phone': phone, + 'startDate': '${startDate.toIso8601String().substring(0, 10)}T00:00:00.000Z', + 'endDate': '${endDate.toIso8601String().substring(0, 10)}T00:00:00.000Z', + if (notes != null && notes.isNotEmpty) 'notes': notes, + 'language': language, + }); + final data = res.data as Map; + return data['reservationId'] as String; + } +} diff --git a/lib/core/services/reservation_service.dart b/lib/core/services/reservation_service.dart new file mode 100644 index 0000000..d5bb887 --- /dev/null +++ b/lib/core/services/reservation_service.dart @@ -0,0 +1,47 @@ +import '../models/reservation.dart'; +import 'api_client.dart'; + +class ReservationService { + final _client = ApiClient.instance; + + Future getReservations({ + int page = 1, + int pageSize = 20, + String? status, + String? search, + }) async { + final res = await _client.get('/reservations', params: { + 'page': page, + 'pageSize': pageSize, + if (status != null) 'status': status, + if (search != null && search.isNotEmpty) 'search': search, + }); + return ReservationListResponse.fromJson(res.data as Map); + } + + Future getReservation(String id) async { + final res = await _client.get('/reservations/$id'); + return Reservation.fromJson(res.data as Map); + } + + Future createReservation(Map data) async { + final res = await _client.post('/reservations', data: data); + return Reservation.fromJson(res.data as Map); + } + + Future confirmReservation(String id) async { + await _client.post('/reservations/$id/confirm'); + } + + Future cancelReservation(String id, String reason) async { + await _client.post('/reservations/$id/cancel', data: {'reason': reason}); + } + + Future checkin(String id, int mileage) async { + await _client.post('/reservations/$id/checkin', data: {'mileage': mileage}); + } + + Future checkout(String id, int mileage) async { + await _client.post('/reservations/$id/checkout', data: {'mileage': mileage}); + } +} diff --git a/lib/core/services/vehicle_service.dart b/lib/core/services/vehicle_service.dart new file mode 100644 index 0000000..2504a64 --- /dev/null +++ b/lib/core/services/vehicle_service.dart @@ -0,0 +1,40 @@ +import '../models/vehicle.dart'; +import 'api_client.dart'; + +class VehicleService { + final _client = ApiClient.instance; + + Future getVehicles({ + int page = 1, + int pageSize = 20, + String? status, + String? search, + }) async { + final res = await _client.get('/vehicles', params: { + 'page': page, + 'pageSize': pageSize, + if (status != null) 'status': status, + if (search != null && search.isNotEmpty) 'search': search, + }); + return VehicleListResponse.fromJson(res.data as Map); + } + + Future getVehicle(String id) async { + final res = await _client.get('/vehicles/$id'); + return Vehicle.fromJson(res.data as Map); + } + + Future createVehicle(Map data) async { + final res = await _client.post('/vehicles', data: data); + return Vehicle.fromJson(res.data as Map); + } + + Future updateVehicle(String id, Map data) async { + final res = await _client.patch('/vehicles/$id', data: data); + return Vehicle.fromJson(res.data as Map); + } + + Future togglePublish(String id, bool publish) async { + await _client.patch('/vehicles/$id/publish', data: {'isPublished': publish}); + } +} diff --git a/lib/core/storage/token_storage.dart b/lib/core/storage/token_storage.dart new file mode 100644 index 0000000..6e28723 --- /dev/null +++ b/lib/core/storage/token_storage.dart @@ -0,0 +1,22 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import '../constants/app_constants.dart'; + +class TokenStorage { + static const _storage = FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true), + ); + + static Future saveToken(String token) => + _storage.write(key: AppConstants.tokenKey, value: token); + + static Future getToken() => + _storage.read(key: AppConstants.tokenKey); + + static Future saveUserType(String type) => + _storage.write(key: AppConstants.userTypeKey, value: type); + + static Future getUserType() => + _storage.read(key: AppConstants.userTypeKey); + + static Future clear() => _storage.deleteAll(); +} diff --git a/lib/core/theme/app_theme.dart b/lib/core/theme/app_theme.dart new file mode 100644 index 0000000..40814f8 --- /dev/null +++ b/lib/core/theme/app_theme.dart @@ -0,0 +1,177 @@ +import 'package:flutter/material.dart'; + +const _blue = Color(0xFF1A56DB); +const _orange = Color(0xFFFF6B00); + +class AppTheme { + static ThemeData get light => ThemeData( + useMaterial3: true, + colorScheme: const ColorScheme.light( + primary: _blue, + onPrimary: Colors.white, + secondary: _orange, + onSecondary: Colors.white, + surface: Color(0xFFF4F5F7), + surfaceContainerHigh: Color(0xFFFFFFFF), + surfaceContainerHighest: Color(0xFFEFF0F2), + onSurface: Color(0xFF111928), + onSurfaceVariant: Color(0xFF6B7280), + outline: Color(0xFFD1D5DB), + outlineVariant: Color(0xFFE5E7EB), + ), + scaffoldBackgroundColor: const Color(0xFFF4F5F7), + appBarTheme: const AppBarTheme( + backgroundColor: Colors.white, + foregroundColor: Color(0xFF111928), + elevation: 0, + surfaceTintColor: Colors.transparent, + ), + cardTheme: CardThemeData( + color: Colors.white, + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: const BorderSide(color: Color(0xFFE5E7EB)), + ), + ), + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: Colors.white, + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: Color(0xFFD1D5DB)), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: Color(0xFFD1D5DB)), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: _blue, width: 2), + ), + contentPadding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 14), + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: _blue, + foregroundColor: Colors.white, + padding: + const EdgeInsets.symmetric(horizontal: 24, vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + textStyle: const TextStyle( + fontSize: 16, fontWeight: FontWeight.w600), + ), + ), + textButtonTheme: + TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: _blue)), + chipTheme: ChipThemeData( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + navigationBarTheme: NavigationBarThemeData( + backgroundColor: Colors.white, + indicatorColor: _orange.withValues(alpha: 0.12), + iconTheme: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const IconThemeData(color: _orange); + } + return const IconThemeData(color: Color(0xFF9CA3AF)); + }), + labelTextStyle: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const TextStyle( + color: _orange, fontWeight: FontWeight.w600, fontSize: 12); + } + return const TextStyle(color: Color(0xFF9CA3AF), fontSize: 12); + }), + ), + ); + + static ThemeData get dark => ThemeData( + useMaterial3: true, + colorScheme: const ColorScheme.dark( + primary: _blue, + onPrimary: Colors.white, + secondary: _orange, + onSecondary: Colors.white, + surface: Color(0xFF1C1C28), + surfaceContainerHigh: Color(0xFF28293A), + surfaceContainerHighest: Color(0xFF32334A), + onSurface: Colors.white, + onSurfaceVariant: Color(0xFF9CA3AF), + outline: Color(0xFF4B4C63), + outlineVariant: Color(0xFF3A3B52), + ), + scaffoldBackgroundColor: const Color(0xFF1C1C28), + appBarTheme: const AppBarTheme( + backgroundColor: Color(0xFF1C1C28), + foregroundColor: Colors.white, + elevation: 0, + surfaceTintColor: Colors.transparent, + ), + cardTheme: CardThemeData( + color: const Color(0xFF28293A), + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: const BorderSide(color: Color(0xFF3A3B52)), + ), + ), + inputDecorationTheme: InputDecorationTheme( + filled: true, + fillColor: const Color(0xFF28293A), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: Color(0xFF3A3B52)), + ), + enabledBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: Color(0xFF3A3B52)), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(10), + borderSide: const BorderSide(color: _blue, width: 2), + ), + hintStyle: const TextStyle(color: Color(0xFF9CA3AF)), + contentPadding: + const EdgeInsets.symmetric(horizontal: 16, vertical: 14), + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + backgroundColor: _blue, + foregroundColor: Colors.white, + padding: + const EdgeInsets.symmetric(horizontal: 24, vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(10), + ), + textStyle: const TextStyle( + fontSize: 16, fontWeight: FontWeight.w600), + ), + ), + textButtonTheme: + TextButtonThemeData(style: TextButton.styleFrom(foregroundColor: _blue)), + chipTheme: ChipThemeData( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + ), + navigationBarTheme: NavigationBarThemeData( + backgroundColor: const Color(0xFF1E1F2E), + indicatorColor: _orange.withValues(alpha: 0.18), + iconTheme: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const IconThemeData(color: _orange); + } + return const IconThemeData(color: Color(0xFF9CA3AF)); + }), + labelTextStyle: WidgetStateProperty.resolveWith((states) { + if (states.contains(WidgetState.selected)) { + return const TextStyle( + color: _orange, fontWeight: FontWeight.w600, fontSize: 12); + } + return const TextStyle(color: Color(0xFF9CA3AF), fontSize: 12); + }), + ), + ); +} diff --git a/lib/features/auth/screens/employee_login_screen.dart b/lib/features/auth/screens/employee_login_screen.dart new file mode 100644 index 0000000..33cfe97 --- /dev/null +++ b/lib/features/auth/screens/employee_login_screen.dart @@ -0,0 +1,164 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../../core/providers/auth_provider.dart'; + +class EmployeeLoginScreen extends ConsumerStatefulWidget { + const EmployeeLoginScreen({super.key}); + + @override + ConsumerState createState() => + _EmployeeLoginScreenState(); +} + +class _EmployeeLoginScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _emailController = TextEditingController(); + final _passwordController = TextEditingController(); + bool _obscurePassword = true; + bool _loading = false; + String? _error; + + @override + void dispose() { + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + Future _login() async { + if (!_formKey.currentState!.validate()) return; + setState(() { + _loading = true; + _error = null; + }); + try { + await ref.read(authProvider.notifier).loginEmployee( + _emailController.text.trim(), + _passwordController.text, + ); + } catch (e) { + setState(() { + _error = 'Invalid email or password. Please try again.'; + }); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.all(24), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 32), + IconButton( + onPressed: () => Navigator.of(context).pop(), + icon: const Icon(Icons.arrow_back), + padding: EdgeInsets.zero, + ), + const SizedBox(height: 24), + const Text( + 'Employee Login', + style: TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 8), + const Text( + 'Sign in to your company dashboard', + style: TextStyle(fontSize: 15, color: Color(0xFF6B7280)), + ), + const SizedBox(height: 40), + if (_error != null) ...[ + Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFFDE8E8), + borderRadius: BorderRadius.circular(10), + ), + child: Row( + children: [ + const Icon(Icons.error_outline, + color: Color(0xFFE02424), size: 18), + const SizedBox(width: 8), + Expanded( + child: Text( + _error!, + style: const TextStyle( + color: Color(0xFF9B1C1C), + fontSize: 13, + ), + ), + ), + ], + ), + ), + const SizedBox(height: 20), + ], + TextFormField( + controller: _emailController, + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + ), + validator: (v) => (v == null || !v.contains('@')) + ? 'Enter a valid email' + : null, + ), + const SizedBox(height: 16), + TextFormField( + controller: _passwordController, + obscureText: _obscurePassword, + textInputAction: TextInputAction.done, + onFieldSubmitted: (_) => _login(), + decoration: InputDecoration( + labelText: 'Password', + prefixIcon: const Icon(Icons.lock_outline), + suffixIcon: IconButton( + icon: Icon(_obscurePassword + ? Icons.visibility_outlined + : Icons.visibility_off_outlined), + onPressed: () => setState( + () => _obscurePassword = !_obscurePassword), + ), + ), + validator: (v) => (v == null || v.isEmpty) + ? 'Password is required' + : null, + ), + const SizedBox(height: 32), + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: _loading ? null : _login, + child: _loading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: + AlwaysStoppedAnimation(Colors.white), + ), + ) + : const Text('Sign In'), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/features/auth/screens/landing_screen.dart b/lib/features/auth/screens/landing_screen.dart new file mode 100644 index 0000000..15076e4 --- /dev/null +++ b/lib/features/auth/screens/landing_screen.dart @@ -0,0 +1,105 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import '../../../l10n/app_localizations.dart'; +import '../../../widgets/preferences_bar.dart'; + +class LandingScreen extends StatelessWidget { + const LandingScreen({super.key}); + + @override + Widget build(BuildContext context) { + final l10n = AppLocalizations.of(context); + + return Scaffold( + backgroundColor: const Color(0xFF0F2140), + body: SafeArea( + child: Padding( + padding: const EdgeInsets.symmetric(horizontal: 28), + child: Column( + children: [ + const SizedBox(height: 8), + // Preferences bar (language + theme) + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: const [PreferencesBar(onDark: true)], + ), + const Spacer(flex: 2), + // Logo + Hero( + tag: 'app_logo', + child: Image.asset( + 'assets/images/logo.jpeg', + width: 160, + height: 160, + fit: BoxFit.contain, + ), + ), + const SizedBox(height: 28), + Text( + l10n.appName, + style: const TextStyle( + color: Colors.white, + fontSize: 32, + fontWeight: FontWeight.bold, + letterSpacing: 0.5, + ), + ), + const SizedBox(height: 10), + Text( + l10n.tagline, + textAlign: TextAlign.center, + style: TextStyle( + color: Colors.white.withValues(alpha: 0.55), + fontSize: 15, + height: 1.5, + ), + ), + const Spacer(flex: 3), + // Find your car + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: () => context.go('/client'), + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFFFF6B00), + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric(vertical: 18), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14), + ), + elevation: 0, + textStyle: const TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + letterSpacing: 0.3, + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.search_rounded, size: 22), + const SizedBox(width: 10), + Text(l10n.findYourCar), + ], + ), + ), + ), + const SizedBox(height: 16), + TextButton( + onPressed: () => context.push('/login/employee'), + style: TextButton.styleFrom( + foregroundColor: Colors.white.withValues(alpha: 0.5), + ), + child: Text( + l10n.companySignIn, + style: const TextStyle(fontSize: 13), + ), + ), + const SizedBox(height: 16), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/auth/screens/role_screen.dart b/lib/features/auth/screens/role_screen.dart new file mode 100644 index 0000000..5262da6 --- /dev/null +++ b/lib/features/auth/screens/role_screen.dart @@ -0,0 +1,138 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; + +class RoleScreen extends StatelessWidget { + const RoleScreen({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: SafeArea( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 40), + Container( + width: 60, + height: 60, + decoration: BoxDecoration( + color: const Color(0xFF1A56DB), + borderRadius: BorderRadius.circular(16), + ), + child: const Icon(Icons.directions_car, + size: 32, color: Colors.white), + ), + const SizedBox(height: 24), + const Text( + 'Welcome to\nCar Rental', + style: TextStyle( + fontSize: 32, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + height: 1.2, + ), + ), + const SizedBox(height: 12), + const Text( + 'How would you like to continue?', + style: TextStyle(fontSize: 16, color: Color(0xFF6B7280)), + ), + const SizedBox(height: 48), + _RoleCard( + icon: Icons.dashboard_rounded, + title: 'Company Dashboard', + subtitle: 'Manage fleet, reservations & customers', + color: const Color(0xFF1A56DB), + onTap: () => context.push('/login/employee'), + ), + const SizedBox(height: 16), + _RoleCard( + icon: Icons.search_rounded, + title: 'Browse & Reserve', + subtitle: 'Find and book a vehicle', + color: const Color(0xFF0E9F6E), + onTap: () => context.go('/client'), + ), + ], + ), + ), + ), + ); + } +} + +class _RoleCard extends StatelessWidget { + final IconData icon; + final String title; + final String subtitle; + final Color color; + final VoidCallback onTap; + + const _RoleCard({ + required this.icon, + required this.title, + required this.subtitle, + required this.color, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return Material( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(16), + child: Container( + padding: const EdgeInsets.all(20), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: Row( + children: [ + Container( + width: 52, + height: 52, + decoration: BoxDecoration( + color: color.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(12), + ), + child: Icon(icon, color: color, size: 26), + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 16, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 4), + Text( + subtitle, + style: const TextStyle( + fontSize: 13, + color: Color(0xFF6B7280), + ), + ), + ], + ), + ), + Icon(Icons.arrow_forward_ios_rounded, + size: 16, color: color), + ], + ), + ), + ), + ); + } +} diff --git a/lib/features/auth/screens/splash_screen.dart b/lib/features/auth/screens/splash_screen.dart new file mode 100644 index 0000000..2f4b892 --- /dev/null +++ b/lib/features/auth/screens/splash_screen.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../../core/providers/auth_provider.dart'; + +class SplashScreen extends ConsumerStatefulWidget { + const SplashScreen({super.key}); + + @override + ConsumerState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends ConsumerState { + @override + void initState() { + super.initState(); + WidgetsBinding.instance.addPostFrameCallback((_) { + ref.read(authProvider.notifier).init(); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: const Color(0xFF0F2140), + body: Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + 'assets/images/logo.jpeg', + width: 130, + height: 130, + fit: BoxFit.contain, + ), + const SizedBox(height: 20), + const Text( + 'RentalDriveGo', + style: TextStyle( + color: Colors.white, + fontSize: 28, + fontWeight: FontWeight.bold, + letterSpacing: 0.5, + ), + ), + const SizedBox(height: 6), + Text( + 'Find & Reserve Your Car', + style: TextStyle( + color: Colors.white.withValues(alpha: 0.6), + fontSize: 14, + ), + ), + const SizedBox(height: 52), + const CircularProgressIndicator( + valueColor: AlwaysStoppedAnimation(Color(0xFFFF6B00)), + strokeWidth: 2.5, + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/client/providers/client_providers.dart b/lib/features/client/providers/client_providers.dart new file mode 100644 index 0000000..a03d81e --- /dev/null +++ b/lib/features/client/providers/client_providers.dart @@ -0,0 +1,131 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../../core/models/marketplace.dart'; +import '../../../core/services/marketplace_service.dart'; + +final marketplaceServiceProvider = Provider((_) => MarketplaceService()); + +final citiesProvider = FutureProvider>((ref) { + return ref.read(marketplaceServiceProvider).getCities(); +}); + +final offersProvider = FutureProvider>((ref) { + return ref.read(marketplaceServiceProvider).getOffers(); +}); + +class SearchParams { + final String? city; + final DateTime? startDate; + final DateTime? endDate; + final Set? categories; // null = all; multi-select + final String? transmission; + final int? maxPriceCents; + final int? minPriceCents; // client-side filter only + final int page; + + const SearchParams({ + this.city, + this.startDate, + this.endDate, + this.categories, + this.transmission, + this.maxPriceCents, + this.minPriceCents, + this.page = 1, + }); + + bool get hasDateRange => startDate != null && endDate != null; + + bool get hasFilters => + city != null || + (categories != null && categories!.isNotEmpty) || + transmission != null || + maxPriceCents != null || + minPriceCents != null || + hasDateRange; + + SearchParams copyWith({ + Object? city = _sentinel, + DateTime? startDate, + DateTime? endDate, + Object? categories = _sentinel, + Object? transmission = _sentinel, + Object? maxPriceCents = _sentinel, + Object? minPriceCents = _sentinel, + int? page, + bool clearDates = false, + }) => + SearchParams( + city: city == _sentinel ? this.city : city as String?, + startDate: clearDates ? null : (startDate ?? this.startDate), + endDate: clearDates ? null : (endDate ?? this.endDate), + categories: categories == _sentinel + ? this.categories + : categories as Set?, + transmission: transmission == _sentinel + ? this.transmission + : transmission as String?, + maxPriceCents: maxPriceCents == _sentinel + ? this.maxPriceCents + : maxPriceCents as int?, + minPriceCents: minPriceCents == _sentinel + ? this.minPriceCents + : minPriceCents as int?, + page: page ?? this.page, + ); + + static bool _setsEqual(Set? a, Set? b) { + if (a == null && b == null) return true; + if (a == null || b == null) return false; + if (a.length != b.length) return false; + return a.containsAll(b); + } + + @override + bool operator ==(Object other) => + other is SearchParams && + other.city == city && + other.startDate == startDate && + other.endDate == endDate && + _setsEqual(other.categories, categories) && + other.transmission == transmission && + other.maxPriceCents == maxPriceCents && + other.minPriceCents == minPriceCents && + other.page == page; + + @override + int get hashCode { + final catKey = categories == null + ? null + : (categories!.toList()..sort()).join(','); + return Object.hash(city, startDate, endDate, catKey, transmission, + maxPriceCents, minPriceCents, page); + } +} + +const _sentinel = Object(); + +final searchParamsProvider = StateProvider((_) { + final now = DateTime.now(); + return SearchParams( + startDate: now, + endDate: now.add(const Duration(days: 1)), + ); +}); + +final vehicleSearchProvider = + FutureProvider.family( + (ref, params) { + // Only send a single category to the API; multi-category is filtered client-side + final apiCategory = + params.categories?.length == 1 ? params.categories!.first : null; + + return ref.read(marketplaceServiceProvider).search( + city: params.city, + startDate: params.startDate, + endDate: params.endDate, + category: apiCategory, + transmission: params.transmission, + maxPriceCents: params.maxPriceCents, + page: params.page, + ); +}); diff --git a/lib/features/client/screens/booking_screen.dart b/lib/features/client/screens/booking_screen.dart new file mode 100644 index 0000000..77801fb --- /dev/null +++ b/lib/features/client/screens/booking_screen.dart @@ -0,0 +1,418 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; +import '../../../core/models/marketplace.dart'; +import '../providers/client_providers.dart'; + +class BookingScreen extends ConsumerStatefulWidget { + final String vehicleId; + final MarketplaceVehicle? vehicle; + + const BookingScreen({ + super.key, + required this.vehicleId, + this.vehicle, + }); + + @override + ConsumerState createState() => _BookingScreenState(); +} + +class _BookingScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _firstNameCtrl = TextEditingController(); + final _lastNameCtrl = TextEditingController(); + final _emailCtrl = TextEditingController(); + final _phoneCtrl = TextEditingController(); + final _notesCtrl = TextEditingController(); + + bool _loading = false; + String? _error; + + @override + void dispose() { + _firstNameCtrl.dispose(); + _lastNameCtrl.dispose(); + _emailCtrl.dispose(); + _phoneCtrl.dispose(); + _notesCtrl.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!_formKey.currentState!.validate()) return; + + final params = ref.read(searchParamsProvider); + if (!params.hasDateRange) { + setState(() => _error = 'Please select dates before booking.'); + return; + } + + final vehicle = widget.vehicle; + if (vehicle == null) { + setState(() => _error = 'Vehicle information missing.'); + return; + } + + setState(() { + _loading = true; + _error = null; + }); + + try { + final reservationId = + await ref.read(marketplaceServiceProvider).createReservation( + vehicleId: vehicle.id, + companySlug: vehicle.companySlug, + firstName: _firstNameCtrl.text.trim(), + lastName: _lastNameCtrl.text.trim(), + email: _emailCtrl.text.trim(), + phone: _phoneCtrl.text.trim().isEmpty + ? null + : _phoneCtrl.text.trim(), + startDate: params.startDate!, + endDate: params.endDate!, + notes: _notesCtrl.text.trim().isEmpty + ? null + : _notesCtrl.text.trim(), + ); + + if (mounted) _showSuccess(reservationId, vehicle, params); + } catch (e) { + setState(() => + _error = 'Booking failed. Please check your details and try again.'); + } finally { + if (mounted) setState(() => _loading = false); + } + } + + void _showSuccess( + String reservationId, MarketplaceVehicle v, SearchParams params) { + final fmt = DateFormat('MMM d, yyyy'); + final days = params.endDate!.difference(params.startDate!).inDays; + final total = v.dailyRateCents * days / 100; + + showDialog( + context: context, + barrierDismissible: false, + builder: (_) => AlertDialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + content: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 8), + Container( + padding: const EdgeInsets.all(16), + decoration: const BoxDecoration( + color: Color(0xFFDEF7EC), + shape: BoxShape.circle, + ), + child: const Icon(Icons.check, + color: Color(0xFF057A55), size: 32), + ), + const SizedBox(height: 16), + const Text('Booking Confirmed!', + style: TextStyle( + fontSize: 18, fontWeight: FontWeight.bold)), + const SizedBox(height: 8), + Text( + v.displayName, + style: const TextStyle( + color: Color(0xFF6B7280), fontSize: 14), + ), + const SizedBox(height: 12), + Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFF9FAFB), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + children: [ + _ConfirmRow( + label: 'Dates', + value: + '${fmt.format(params.startDate!)} → ${fmt.format(params.endDate!)}'), + const SizedBox(height: 6), + _ConfirmRow( + label: 'Duration', value: '$days days'), + const SizedBox(height: 6), + _ConfirmRow( + label: 'Total', + value: '\$${total.toStringAsFixed(2)}'), + const SizedBox(height: 6), + _ConfirmRow( + label: 'Reference', + value: reservationId.substring(0, 8).toUpperCase(), + ), + ], + ), + ), + const SizedBox(height: 8), + const Text( + 'A confirmation has been sent\nto your email.', + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 12, color: Color(0xFF9CA3AF)), + ), + ], + ), + actions: [ + SizedBox( + width: double.infinity, + child: ElevatedButton( + onPressed: () { + Navigator.pop(context); + context.go('/client'); + }, + child: const Text('Back to Search'), + ), + ), + ], + ), + ); + } + + @override + Widget build(BuildContext context) { + final vehicle = widget.vehicle; + final params = ref.watch(searchParamsProvider); + final hasDates = params.hasDateRange; + final days = hasDates + ? params.endDate!.difference(params.startDate!).inDays + : 0; + final fmt = DateFormat('MMM d, yyyy'); + final total = vehicle != null && hasDates + ? vehicle.dailyRateCents * days / 100 + : null; + + return Scaffold( + appBar: AppBar(title: const Text('Complete Booking')), + body: Form( + key: _formKey, + child: ListView( + padding: const EdgeInsets.all(16), + children: [ + // Vehicle summary + if (vehicle != null) + Card( + margin: const EdgeInsets.only(bottom: 16), + child: Padding( + padding: const EdgeInsets.all(14), + child: Row( + children: [ + const Icon(Icons.directions_car, + color: Color(0xFF1A56DB), size: 28), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(vehicle.displayName, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15)), + Text(vehicle.company.brand.displayName, + style: const TextStyle( + color: Color(0xFF6B7280), + fontSize: 12)), + ], + ), + ), + if (total != null) + Text( + '\$${total.toStringAsFixed(0)}', + style: const TextStyle( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Color(0xFF1A56DB), + ), + ), + ], + ), + ), + ), + + // Date summary + if (hasDates) + Container( + margin: const EdgeInsets.only(bottom: 16), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFEBF5FF), + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFBFDBFE)), + ), + child: Row( + children: [ + const Icon(Icons.calendar_today, + color: Color(0xFF1A56DB), size: 16), + const SizedBox(width: 10), + Text( + '${fmt.format(params.startDate!)} → ${fmt.format(params.endDate!)} · $days day${days == 1 ? '' : 's'}', + style: const TextStyle( + color: Color(0xFF1A56DB), + fontWeight: FontWeight.w600, + fontSize: 13, + ), + ), + ], + ), + ) + else + Container( + margin: const EdgeInsets.only(bottom: 16), + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFFDF6B2), + borderRadius: BorderRadius.circular(10), + ), + child: const Row( + children: [ + Icon(Icons.warning_amber, + color: Color(0xFFB45309), size: 16), + SizedBox(width: 8), + Text( + 'No dates selected — go back and pick dates', + style: TextStyle( + color: Color(0xFF92400E), fontSize: 13), + ), + ], + ), + ), + + if (_error != null) ...[ + Container( + padding: const EdgeInsets.all(12), + margin: const EdgeInsets.only(bottom: 16), + decoration: BoxDecoration( + color: const Color(0xFFFDE8E8), + borderRadius: BorderRadius.circular(10), + ), + child: Text(_error!, + style: const TextStyle(color: Color(0xFF9B1C1C))), + ), + ], + + // Personal info + const _SectionLabel('Your Information'), + Row( + children: [ + Expanded( + child: TextFormField( + controller: _firstNameCtrl, + textCapitalization: TextCapitalization.words, + textInputAction: TextInputAction.next, + decoration: + const InputDecoration(labelText: 'First Name'), + validator: (v) => + v == null || v.trim().isEmpty ? 'Required' : null, + ), + ), + const SizedBox(width: 12), + Expanded( + child: TextFormField( + controller: _lastNameCtrl, + textCapitalization: TextCapitalization.words, + textInputAction: TextInputAction.next, + decoration: + const InputDecoration(labelText: 'Last Name'), + validator: (v) => + v == null || v.trim().isEmpty ? 'Required' : null, + ), + ), + ], + ), + const SizedBox(height: 14), + TextFormField( + controller: _emailCtrl, + keyboardType: TextInputType.emailAddress, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + ), + validator: (v) => (v == null || !v.contains('@')) + ? 'Enter a valid email' + : null, + ), + const SizedBox(height: 14), + TextFormField( + controller: _phoneCtrl, + keyboardType: TextInputType.phone, + textInputAction: TextInputAction.next, + decoration: const InputDecoration( + labelText: 'Phone (optional)', + prefixIcon: Icon(Icons.phone_outlined), + ), + ), + const SizedBox(height: 14), + TextFormField( + controller: _notesCtrl, + maxLines: 2, + textInputAction: TextInputAction.done, + decoration: const InputDecoration( + labelText: 'Notes (optional)', + prefixIcon: Icon(Icons.notes_outlined), + alignLabelWithHint: true, + ), + ), + const SizedBox(height: 28), + ElevatedButton( + onPressed: (_loading || !hasDates) ? null : _submit, + style: ElevatedButton.styleFrom( + minimumSize: const Size.fromHeight(52)), + child: _loading + ? const SizedBox( + height: 22, + width: 22, + child: CircularProgressIndicator( + strokeWidth: 2, + valueColor: + AlwaysStoppedAnimation(Colors.white)), + ) + : const Text('Confirm Booking', + style: TextStyle(fontSize: 16)), + ), + const SizedBox(height: 24), + ], + ), + ), + ); + } +} + +class _SectionLabel extends StatelessWidget { + final String text; + const _SectionLabel(this.text); + + @override + Widget build(BuildContext context) => Padding( + padding: const EdgeInsets.only(bottom: 12), + child: Text(text, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + color: Color(0xFF374151))), + ); +} + +class _ConfirmRow extends StatelessWidget { + final String label; + final String value; + const _ConfirmRow({required this.label, required this.value}); + + @override + Widget build(BuildContext context) => Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text(label, + style: const TextStyle( + fontSize: 13, color: Color(0xFF6B7280))), + Text(value, + style: const TextStyle( + fontSize: 13, fontWeight: FontWeight.w600)), + ], + ); +} diff --git a/lib/features/client/screens/client_home_screen.dart b/lib/features/client/screens/client_home_screen.dart new file mode 100644 index 0000000..352a803 --- /dev/null +++ b/lib/features/client/screens/client_home_screen.dart @@ -0,0 +1,1249 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; + +import '../providers/client_providers.dart'; +import '../../../core/models/marketplace.dart'; +import '../../../l10n/app_localizations.dart'; +import '../../../widgets/preferences_bar.dart'; +import 'widgets/marketplace_vehicle_card.dart'; + +const _orange = Color(0xFFFF6B00); +const _blue = Color(0xFF1A56DB); + +const _allCarTypes = [ + 'ECONOMY', 'COMPACT', 'MIDSIZE', 'FULLSIZE', + 'SUV', 'LUXURY', 'VAN', 'TRUCK', +]; + +String _capitalize(String s) => + s.isEmpty ? s : s[0] + s.substring(1).toLowerCase(); + +// ── Screen ──────────────────────────────────────────────────────────────────── + +class ClientHomeScreen extends ConsumerStatefulWidget { + const ClientHomeScreen({super.key}); + + @override + ConsumerState createState() => _ClientHomeScreenState(); +} + +class _ClientHomeScreenState extends ConsumerState { + // Pending form state (committed to provider only when Search is pressed) + String? _city; + String? _dropoffCity; + DateTime? _startDate; + DateTime? _endDate; + Set _selectedTypes = {}; + int _minPriceCents = 0; + int _maxPriceCents = 50000; + bool _priceFilterActive = false; + bool _sameDropoff = true; + + @override + void initState() { + super.initState(); + final params = ref.read(searchParamsProvider); + _city = params.city; + _startDate = params.startDate; + _endDate = params.endDate; + _selectedTypes = Set.from(params.categories ?? {}); + _minPriceCents = params.minPriceCents ?? 0; + _maxPriceCents = params.maxPriceCents ?? 50000; + _priceFilterActive = + params.maxPriceCents != null || params.minPriceCents != null; + } + + void _applySearch() { + ref.read(searchParamsProvider.notifier).state = SearchParams( + city: _city, + startDate: _startDate, + endDate: _endDate, + categories: _selectedTypes.isEmpty ? null : Set.from(_selectedTypes), + maxPriceCents: _priceFilterActive ? _maxPriceCents : null, + minPriceCents: + _priceFilterActive && _minPriceCents > 0 ? _minPriceCents : null, + ); + } + + Future _pickDates() async { + final cs = Theme.of(context).colorScheme; + final now = DateTime.now(); + final picked = await showDateRangePicker( + context: context, + firstDate: now, + lastDate: now.add(const Duration(days: 365)), + initialDateRange: _startDate != null && _endDate != null + ? DateTimeRange(start: _startDate!, end: _endDate!) + : DateTimeRange(start: now, end: now.add(const Duration(days: 1))), + builder: (context, child) => Theme( + data: Theme.of(context).copyWith( + colorScheme: cs.copyWith(primary: _orange), + ), + child: child!, + ), + ); + if (picked != null && mounted) { + setState(() { + _startDate = picked.start; + _endDate = picked.end; + }); + } + } + + void _showCitySheet(List cities, AppLocalizations l10n) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (_) => _CitySheet( + cities: cities, + selected: _city, + l10n: l10n, + onSelect: (city) { + Navigator.pop(context); + setState(() => _city = city); + }, + ), + ); + } + + void _showDropoffCitySheet(List cities, AppLocalizations l10n) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (_) => _CitySheet( + cities: cities, + selected: _dropoffCity, + l10n: l10n, + titleOverride: l10n.dropoffLocation, + onSelect: (city) { + Navigator.pop(context); + setState(() => _dropoffCity = city); + }, + ), + ); + } + + void _showCarTypeSheet(AppLocalizations l10n) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (_) => _CarTypeSheet( + selected: Set.from(_selectedTypes), + l10n: l10n, + onApply: (types) { + Navigator.pop(context); + setState(() => _selectedTypes = types); + }, + ), + ); + } + + void _showPriceSheet(AppLocalizations l10n) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(20)), + ), + builder: (_) => _PriceSheet( + minCents: _minPriceCents, + maxCents: _maxPriceCents, + active: _priceFilterActive, + l10n: l10n, + onApply: (min, max, active) { + Navigator.pop(context); + setState(() { + _minPriceCents = min; + _maxPriceCents = max; + _priceFilterActive = active; + }); + }, + ), + ); + } + + List _applyClientFilters( + List all, SearchParams params) { + var result = all; + final cats = params.categories; + if (cats != null && cats.length > 1) { + result = result.where((v) => cats.contains(v.category)).toList(); + } + final minP = params.minPriceCents; + if (minP != null && minP > 0) { + result = result.where((v) => v.dailyRateCents >= minP).toList(); + } + return result; + } + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final l10n = AppLocalizations.of(context); + final params = ref.watch(searchParamsProvider); + final searchAsync = ref.watch(vehicleSearchProvider(params)); + final citiesAsync = ref.watch(citiesProvider); + final langCode = Localizations.localeOf(context).languageCode; + + final typeLabel = _selectedTypes.isEmpty + ? l10n.allCarTypes + : _selectedTypes.length == 1 + ? _capitalize(_selectedTypes.first) + : '${_selectedTypes.length} types'; + + final priceLabel = _priceFilterActive + ? '\$${(_minPriceCents / 100).toStringAsFixed(0)} – \$${(_maxPriceCents / 100).toStringAsFixed(0)}/day' + : l10n.anyPrice; + + return Scaffold( + backgroundColor: cs.surface, + body: CustomScrollView( + slivers: [ + // ── Search form ────────────────────────────────────────────────── + SliverToBoxAdapter( + child: SafeArea( + bottom: false, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Title + preferences + Padding( + padding: const EdgeInsets.fromLTRB(20, 16, 12, 0), + child: Row( + children: [ + Text( + l10n.findCarToRent, + style: TextStyle( + color: cs.onSurface, + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + const Spacer(), + const PreferencesBar(), + ], + ), + ), + const SizedBox(height: 20), + + // Same / Different drop-off toggle + Padding( + padding: const EdgeInsets.symmetric(horizontal: 20), + child: Row( + children: [ + _DropoffTab( + label: l10n.sameDropoff, + active: _sameDropoff, + onTap: () => setState(() { + _sameDropoff = true; + _dropoffCity = null; + }), + ), + const SizedBox(width: 28), + _DropoffTab( + label: l10n.differentDropoff, + active: !_sameDropoff, + onTap: () => setState(() => _sameDropoff = false), + ), + ], + ), + ), + const SizedBox(height: 16), + + // Location field(s) + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Column( + children: [ + // Pickup + _SearchInputBox( + onTap: () => citiesAsync + .whenData((c) => _showCitySheet(c, l10n)), + child: _LocationRow( + icon: Icons.radio_button_checked, + iconColor: _orange, + text: _city ?? + (_sameDropoff + ? l10n.findCarToRent + : l10n.pickupLocation), + placeholder: _city == null, + cs: cs, + onClear: _city != null + ? () => setState(() => _city = null) + : null, + ), + ), + + // Animated drop-off field + AnimatedSize( + duration: const Duration(milliseconds: 250), + curve: Curves.easeInOut, + child: _sameDropoff + ? const SizedBox.shrink() + : Column( + children: [ + // Connector line + Row( + children: [ + const SizedBox(width: 23), + Container( + width: 2, + height: 16, + color: cs.outlineVariant, + ), + ], + ), + // Drop-off box + _SearchInputBox( + onTap: () => citiesAsync.whenData( + (c) => _showDropoffCitySheet(c, l10n)), + child: _LocationRow( + icon: Icons.location_on, + iconColor: _blue, + text: _dropoffCity ?? + l10n.dropoffLocation, + placeholder: _dropoffCity == null, + cs: cs, + onClear: _dropoffCity != null + ? () => setState( + () => _dropoffCity = null) + : null, + ), + ), + ], + ), + ), + ], + ), + ), + const SizedBox(height: 10), + + // Date range field + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: _SearchInputBox( + onTap: _pickDates, + child: _startDate != null && _endDate != null + ? _DateRangeRow( + start: _startDate!, + end: _endDate!, + langCode: langCode, + cs: cs, + ) + : Row( + children: [ + Icon(Icons.calendar_today_outlined, + size: 18, color: cs.onSurfaceVariant), + const SizedBox(width: 12), + Text( + l10n.pickDates, + style: TextStyle( + color: cs.onSurfaceVariant, fontSize: 15), + ), + ], + ), + ), + ), + const SizedBox(height: 10), + + // Car type + Price chips + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: Row( + children: [ + Expanded( + child: _OptionTile( + label: typeLabel, + icon: Icons.directions_car_outlined, + active: _selectedTypes.isNotEmpty, + onTap: () => _showCarTypeSheet(l10n), + onClear: _selectedTypes.isNotEmpty + ? () => setState(() => _selectedTypes = {}) + : null, + ), + ), + const SizedBox(width: 10), + Expanded( + child: _OptionTile( + label: priceLabel, + icon: Icons.attach_money_rounded, + active: _priceFilterActive, + onTap: () => _showPriceSheet(l10n), + onClear: _priceFilterActive + ? () => setState(() { + _priceFilterActive = false; + _minPriceCents = 0; + _maxPriceCents = 50000; + }) + : null, + ), + ), + ], + ), + ), + const SizedBox(height: 20), + + // Search button + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: SizedBox( + width: double.infinity, + height: 54, + child: ElevatedButton( + onPressed: _applySearch, + style: ElevatedButton.styleFrom( + backgroundColor: _orange, + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(16), + ), + elevation: 0, + ), + child: Text( + l10n.search, + style: const TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + ), + ), + ), + ), + ), + const SizedBox(height: 16), + + // Results count line + Padding( + padding: const EdgeInsets.fromLTRB(20, 0, 20, 10), + child: searchAsync.when( + loading: () => Row(children: [ + SizedBox( + width: 12, + height: 12, + child: CircularProgressIndicator( + strokeWidth: 1.5, + color: cs.onSurfaceVariant, + ), + ), + const SizedBox(width: 8), + Text(l10n.searching, + style: TextStyle( + color: cs.onSurfaceVariant, fontSize: 13)), + ]), + error: (_, _) => const SizedBox.shrink(), + data: (r) { + final count = + _applyClientFilters(r.data, params).length; + return Text( + l10n.vehiclesFound(count), + style: TextStyle( + color: cs.onSurfaceVariant, fontSize: 13), + ); + }, + ), + ), + Divider(height: 1, color: cs.outlineVariant), + ], + ), + ), + ), + + // ── Results ────────────────────────────────────────────────────── + searchAsync.when( + loading: () => const SliverFillRemaining( + child: Center( + child: CircularProgressIndicator( + color: _orange, strokeWidth: 2.5), + ), + ), + error: (_, _) => SliverFillRemaining( + child: _ErrorBody( + onRetry: () => ref.invalidate(vehicleSearchProvider(params)), + l10n: l10n, + cs: cs, + ), + ), + data: (result) { + final vehicles = _applyClientFilters(result.data, params); + if (vehicles.isEmpty) { + return SliverFillRemaining( + child: _EmptyBody(l10n: l10n, cs: cs)); + } + return SliverPadding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 32), + sliver: SliverList.separated( + itemCount: vehicles.length, + separatorBuilder: (_, _) => const SizedBox(height: 12), + itemBuilder: (_, i) { + final v = vehicles[i]; + return MarketplaceVehicleCard( + vehicle: v, + selectedStart: params.startDate, + selectedEnd: params.endDate, + onTap: () => + context.push('/client/vehicles/${v.id}', extra: v), + ); + }, + ), + ); + }, + ), + ], + ), + ); + } +} + +// ── Drop-off toggle tab ─────────────────────────────────────────────────────── + +class _DropoffTab extends StatelessWidget { + final String label; + final bool active; + final VoidCallback onTap; + + const _DropoffTab( + {required this.label, required this.active, required this.onTap}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return GestureDetector( + onTap: onTap, + child: Text( + label, + style: TextStyle( + fontSize: 17, + fontWeight: active ? FontWeight.w700 : FontWeight.w400, + color: active ? cs.onSurface : cs.onSurfaceVariant, + ), + ), + ); + } +} + +// ── Rounded input container ─────────────────────────────────────────────────── + +class _SearchInputBox extends StatelessWidget { + final VoidCallback onTap; + final Widget child; + + const _SearchInputBox({required this.onTap, required this.child}); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return GestureDetector( + onTap: onTap, + child: Container( + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 18), + decoration: BoxDecoration( + color: cs.surfaceContainerHigh, + borderRadius: BorderRadius.circular(14), + border: Border.all(color: cs.outlineVariant), + ), + child: child, + ), + ); + } +} + +// ── Location row (used in pickup + drop-off fields) ─────────────────────────── + +class _LocationRow extends StatelessWidget { + final IconData icon; + final Color iconColor; + final String text; + final bool placeholder; + final ColorScheme cs; + final VoidCallback? onClear; + + const _LocationRow({ + required this.icon, + required this.iconColor, + required this.text, + required this.placeholder, + required this.cs, + this.onClear, + }); + + @override + Widget build(BuildContext context) => Row( + children: [ + Icon(icon, size: 18, color: iconColor), + const SizedBox(width: 12), + Expanded( + child: Text( + text, + style: TextStyle( + color: placeholder ? cs.onSurfaceVariant : cs.onSurface, + fontSize: 15, + ), + ), + ), + if (onClear != null) + GestureDetector( + onTap: onClear, + child: + Icon(Icons.close, size: 16, color: cs.onSurfaceVariant), + ), + ], + ); +} + +// ── Date range display ──────────────────────────────────────────────────────── + +class _DateRangeRow extends StatelessWidget { + final DateTime start; + final DateTime end; + final String langCode; + final ColorScheme cs; + + const _DateRangeRow({ + required this.start, + required this.end, + required this.langCode, + required this.cs, + }); + + @override + Widget build(BuildContext context) { + final dayFmt = DateFormat('MMM d', langCode); + final dowFmt = DateFormat('EEE', langCode); + return Row( + children: [ + _DateChunk( + date: dayFmt.format(start), + sub: '${dowFmt.format(start)} 12:00', + cs: cs, + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Icon(Icons.arrow_forward, + size: 14, color: cs.onSurfaceVariant), + ), + _DateChunk( + date: dayFmt.format(end), + sub: '${dowFmt.format(end)} 12:00', + cs: cs, + ), + ], + ); + } +} + +class _DateChunk extends StatelessWidget { + final String date; + final String sub; + final ColorScheme cs; + + const _DateChunk( + {required this.date, required this.sub, required this.cs}); + + @override + Widget build(BuildContext context) => Row( + children: [ + Text(date, + style: TextStyle( + color: cs.onSurface, + fontSize: 16, + fontWeight: FontWeight.w600)), + const SizedBox(width: 6), + Text(sub, + style: + TextStyle(color: cs.onSurfaceVariant, fontSize: 13)), + ], + ); +} + +// ── Option tile (car type / price) ──────────────────────────────────────────── + +class _OptionTile extends StatelessWidget { + final String label; + final IconData icon; + final bool active; + final VoidCallback onTap; + final VoidCallback? onClear; + + const _OptionTile({ + required this.label, + required this.icon, + required this.active, + required this.onTap, + this.onClear, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + return GestureDetector( + onTap: onTap, + child: AnimatedContainer( + duration: const Duration(milliseconds: 180), + padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 14), + decoration: BoxDecoration( + color: active + ? _blue.withValues(alpha: 0.12) + : cs.surfaceContainerHigh, + borderRadius: BorderRadius.circular(14), + border: Border.all( + color: active ? _blue : cs.outlineVariant, + ), + ), + child: Row( + children: [ + Icon(icon, + size: 16, + color: active ? _blue : cs.onSurfaceVariant), + const SizedBox(width: 8), + Expanded( + child: Text( + label, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 13, + fontWeight: + active ? FontWeight.w600 : FontWeight.normal, + color: cs.onSurface, + ), + ), + ), + if (onClear != null) ...[ + const SizedBox(width: 4), + GestureDetector( + onTap: onClear, + child: Icon(Icons.close, + size: 14, + color: active ? _blue : cs.onSurfaceVariant), + ), + ], + ], + ), + ), + ); + } +} + +// ── Car Type Sheet ──────────────────────────────────────────────────────────── + +class _CarTypeSheet extends StatefulWidget { + final Set selected; + final AppLocalizations l10n; + final ValueChanged> onApply; + + const _CarTypeSheet({ + required this.selected, + required this.l10n, + required this.onApply, + }); + + @override + State<_CarTypeSheet> createState() => _CarTypeSheetState(); +} + +class _CarTypeSheetState extends State<_CarTypeSheet> { + late Set _selected; + + @override + void initState() { + super.initState(); + _selected = Set.from(widget.selected); + } + + bool get _allSelected => _selected.length == _allCarTypes.length; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final l10n = widget.l10n; + + return DraggableScrollableSheet( + initialChildSize: 0.7, + maxChildSize: 0.9, + minChildSize: 0.5, + expand: false, + builder: (_, controller) => Column( + children: [ + const SizedBox(height: 12), + _SheetHandle(cs: cs), + Padding( + padding: const EdgeInsets.fromLTRB(20, 14, 20, 6), + child: Row( + children: [ + Text( + l10n.carType, + style: TextStyle( + color: cs.onSurface, + fontSize: 17, + fontWeight: FontWeight.bold, + ), + ), + const Spacer(), + TextButton( + onPressed: () { + setState(() { + if (_allSelected) { + _selected = {}; + } else { + _selected = Set.from(_allCarTypes); + } + }); + }, + style: TextButton.styleFrom( + foregroundColor: _orange, + padding: EdgeInsets.zero, + minimumSize: Size.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + child: Text( + _allSelected ? l10n.clearAll : l10n.selectAll, + style: const TextStyle(fontSize: 14), + ), + ), + ], + ), + ), + Expanded( + child: ListView( + controller: controller, + children: _allCarTypes.map((type) { + final checked = _selected.contains(type); + return CheckboxListTile( + value: checked, + onChanged: (_) { + setState(() { + if (checked) { + _selected.remove(type); + } else { + _selected.add(type); + } + }); + }, + title: Text( + _capitalize(type), + style: TextStyle(color: cs.onSurface, fontSize: 15), + ), + activeColor: _orange, + checkColor: Colors.white, + side: BorderSide(color: cs.outlineVariant), + controlAffinity: ListTileControlAffinity.leading, + ); + }).toList(), + ), + ), + Padding( + padding: EdgeInsets.fromLTRB( + 16, 10, 16, 16 + MediaQuery.of(context).padding.bottom), + child: SizedBox( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: () => widget.onApply(_selected), + style: ElevatedButton.styleFrom( + backgroundColor: _orange, + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14)), + elevation: 0, + ), + child: Text(l10n.apply, + style: const TextStyle( + fontSize: 16, fontWeight: FontWeight.bold)), + ), + ), + ), + ], + ), + ); + } +} + +// ── Price Sheet ─────────────────────────────────────────────────────────────── + +class _PriceSheet extends StatefulWidget { + final int minCents; + final int maxCents; + final bool active; + final AppLocalizations l10n; + final void Function(int min, int max, bool active) onApply; + + static const double _cap = 500; // $500/day cap + + const _PriceSheet({ + required this.minCents, + required this.maxCents, + required this.active, + required this.l10n, + required this.onApply, + }); + + @override + State<_PriceSheet> createState() => _PriceSheetState(); +} + +class _PriceSheetState extends State<_PriceSheet> { + late RangeValues _range; + + @override + void initState() { + super.initState(); + _range = RangeValues( + (widget.minCents / 100).clamp(0, _PriceSheet._cap).toDouble(), + (widget.maxCents / 100).clamp(0, _PriceSheet._cap).toDouble(), + ); + } + + String _fmt(double v) => + v >= _PriceSheet._cap ? '\$${v.toStringAsFixed(0)}+' : '\$${v.toStringAsFixed(0)}'; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final l10n = widget.l10n; + + return Padding( + padding: + EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const SizedBox(height: 12), + _SheetHandle(cs: cs), + Padding( + padding: const EdgeInsets.fromLTRB(20, 14, 20, 6), + child: Row( + children: [ + Text( + l10n.price, + style: TextStyle( + color: cs.onSurface, + fontSize: 17, + fontWeight: FontWeight.bold, + ), + ), + const Spacer(), + if (widget.active) + TextButton( + onPressed: () => widget.onApply(0, 50000, false), + style: TextButton.styleFrom( + foregroundColor: _orange, + padding: EdgeInsets.zero, + minimumSize: Size.zero, + tapTargetSize: MaterialTapTargetSize.shrinkWrap, + ), + child: Text(l10n.clearAll, + style: const TextStyle(fontSize: 14)), + ), + ], + ), + ), + + // Min / max labels + Padding( + padding: const EdgeInsets.symmetric(horizontal: 24), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + _PriceTag(label: _fmt(_range.start), cs: cs), + Icon(Icons.arrow_forward, + size: 14, color: cs.onSurfaceVariant), + _PriceTag(label: '${_fmt(_range.end)}/day', cs: cs), + ], + ), + ), + const SizedBox(height: 8), + + // Range slider + Padding( + padding: const EdgeInsets.symmetric(horizontal: 8), + child: SliderTheme( + data: SliderTheme.of(context).copyWith( + activeTrackColor: _orange, + inactiveTrackColor: cs.outlineVariant, + thumbColor: _orange, + overlayColor: _orange.withValues(alpha: 0.15), + trackHeight: 4, + ), + child: RangeSlider( + values: _range, + min: 0, + max: _PriceSheet._cap, + divisions: 50, + onChanged: (v) => setState(() => _range = v), + ), + ), + ), + const SizedBox(height: 8), + + Padding( + padding: EdgeInsets.fromLTRB( + 16, 4, 16, 16 + MediaQuery.of(context).padding.bottom), + child: SizedBox( + width: double.infinity, + height: 50, + child: ElevatedButton( + onPressed: () => widget.onApply( + (_range.start * 100).round(), + (_range.end * 100).round(), + true, + ), + style: ElevatedButton.styleFrom( + backgroundColor: _orange, + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(14)), + elevation: 0, + ), + child: Text(l10n.apply, + style: const TextStyle( + fontSize: 16, fontWeight: FontWeight.bold)), + ), + ), + ), + ], + ), + ); + } +} + +class _PriceTag extends StatelessWidget { + final String label; + final ColorScheme cs; + + const _PriceTag({required this.label, required this.cs}); + + @override + Widget build(BuildContext context) => Container( + padding: + const EdgeInsets.symmetric(horizontal: 12, vertical: 6), + decoration: BoxDecoration( + color: cs.surfaceContainerHigh, + borderRadius: BorderRadius.circular(8), + border: Border.all(color: cs.outlineVariant), + ), + child: Text( + label, + style: TextStyle( + color: cs.onSurface, + fontWeight: FontWeight.w600, + fontSize: 15), + ), + ); +} + +// ── City Sheet ──────────────────────────────────────────────────────────────── + +class _CitySheet extends StatefulWidget { + final List cities; + final String? selected; + final AppLocalizations l10n; + final ValueChanged onSelect; + final String? titleOverride; + + const _CitySheet({ + required this.cities, + required this.selected, + required this.l10n, + required this.onSelect, + this.titleOverride, + }); + + @override + State<_CitySheet> createState() => _CitySheetState(); +} + +class _CitySheetState extends State<_CitySheet> { + String _query = ''; + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final filtered = widget.cities + .where((c) => c.toLowerCase().contains(_query.toLowerCase())) + .toList(); + + return DraggableScrollableSheet( + initialChildSize: 0.6, + maxChildSize: 0.9, + minChildSize: 0.4, + expand: false, + builder: (_, controller) => Column( + children: [ + const SizedBox(height: 12), + _SheetHandle(cs: cs), + Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.titleOverride ?? widget.l10n.selectCity, + style: TextStyle( + fontSize: 17, + fontWeight: FontWeight.bold, + color: cs.onSurface), + ), + const SizedBox(height: 12), + TextField( + autofocus: true, + style: TextStyle(color: cs.onSurface), + decoration: InputDecoration( + hintText: widget.l10n.searchCities, + prefixIcon: Icon(Icons.search, + size: 20, color: cs.onSurfaceVariant), + contentPadding: + const EdgeInsets.symmetric(vertical: 8), + ), + onChanged: (v) => setState(() => _query = v), + ), + ], + ), + ), + Expanded( + child: ListView( + controller: controller, + children: [ + ListTile( + leading: Icon(Icons.public_outlined, + color: cs.onSurfaceVariant), + title: Text(widget.l10n.allCities, + style: TextStyle(color: cs.onSurface)), + selected: widget.selected == null, + selectedColor: _orange, + trailing: widget.selected == null + ? const Icon(Icons.check, color: _orange, size: 18) + : null, + onTap: () => widget.onSelect(null), + ), + ...filtered.map((city) => ListTile( + leading: Icon(Icons.location_city_outlined, + color: cs.onSurfaceVariant), + title: Text(city, + style: TextStyle(color: cs.onSurface)), + selected: widget.selected == city, + selectedColor: _orange, + trailing: widget.selected == city + ? const Icon(Icons.check, + color: _orange, size: 18) + : null, + onTap: () => widget.onSelect(city), + )), + ], + ), + ), + ], + ), + ); + } +} + +// ── Shared sheet drag handle ────────────────────────────────────────────────── + +class _SheetHandle extends StatelessWidget { + final ColorScheme cs; + const _SheetHandle({required this.cs}); + + @override + Widget build(BuildContext context) => Container( + width: 40, + height: 4, + decoration: BoxDecoration( + color: cs.outlineVariant, + borderRadius: BorderRadius.circular(2), + ), + ); +} + +// ── Error / Empty states ───────────────────────────────────────────────────── + +class _ErrorBody extends StatelessWidget { + final VoidCallback onRetry; + final AppLocalizations l10n; + final ColorScheme cs; + + const _ErrorBody( + {required this.onRetry, required this.l10n, required this.cs}); + + @override + Widget build(BuildContext context) => Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.wifi_off_outlined, + size: 48, color: cs.onSurfaceVariant), + const SizedBox(height: 12), + Text( + l10n.couldNotLoadVehicles, + style: TextStyle( + color: cs.onSurface, + fontSize: 16, + fontWeight: FontWeight.w600), + ), + const SizedBox(height: 8), + Text( + l10n.checkConnectionRetry, + style: + TextStyle(color: cs.onSurfaceVariant, fontSize: 13), + textAlign: TextAlign.center, + ), + const SizedBox(height: 20), + OutlinedButton( + onPressed: onRetry, + style: OutlinedButton.styleFrom( + foregroundColor: _orange, + side: const BorderSide(color: _orange), + ), + child: Text(l10n.retry), + ), + ], + ), + ), + ); +} + +class _EmptyBody extends StatelessWidget { + final AppLocalizations l10n; + final ColorScheme cs; + + const _EmptyBody({required this.l10n, required this.cs}); + + @override + Widget build(BuildContext context) => Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.search_off, size: 56, color: cs.outlineVariant), + const SizedBox(height: 16), + Text( + l10n.noVehiclesFound, + style: TextStyle( + color: cs.onSurface, + fontSize: 16, + fontWeight: FontWeight.w600), + ), + const SizedBox(height: 8), + Text( + l10n.tryDifferentSearch, + style: + TextStyle(color: cs.onSurfaceVariant, fontSize: 13), + textAlign: TextAlign.center, + ), + ], + ), + ), + ); +} diff --git a/lib/features/client/screens/client_shell.dart b/lib/features/client/screens/client_shell.dart new file mode 100644 index 0000000..1bdba26 --- /dev/null +++ b/lib/features/client/screens/client_shell.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../../../l10n/app_localizations.dart'; + +class ClientShell extends ConsumerWidget { + final Widget child; + + const ClientShell({super.key, required this.child}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final location = GoRouterState.of(context).matchedLocation; + final l10n = AppLocalizations.of(context); + + int currentIndex = 0; + if (location == '/client/bookings') currentIndex = 1; + + return Scaffold( + body: child, + bottomNavigationBar: NavigationBar( + selectedIndex: currentIndex, + onDestinationSelected: (i) { + if (i == 0) { + context.go('/client'); + } else { + context.go('/client/bookings'); + } + }, + destinations: [ + NavigationDestination( + icon: const Icon(Icons.search_outlined), + selectedIcon: const Icon(Icons.search), + label: l10n.browse, + ), + NavigationDestination( + icon: const Icon(Icons.bookmark_outline), + selectedIcon: const Icon(Icons.bookmark), + label: l10n.myBookings, + ), + ], + ), + ); + } +} diff --git a/lib/features/client/screens/client_vehicle_detail_screen.dart b/lib/features/client/screens/client_vehicle_detail_screen.dart new file mode 100644 index 0000000..9b69c1a --- /dev/null +++ b/lib/features/client/screens/client_vehicle_detail_screen.dart @@ -0,0 +1,292 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; +import '../../../core/models/marketplace.dart'; +import '../../../core/constants/app_constants.dart'; +import '../providers/client_providers.dart'; + +class ClientVehicleDetailScreen extends ConsumerWidget { + final String id; + final MarketplaceVehicle? vehicle; + + const ClientVehicleDetailScreen({ + super.key, + required this.id, + this.vehicle, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final params = ref.watch(searchParamsProvider); + // Use vehicle passed via extra; no separate fetch needed + final v = vehicle; + if (v == null) { + return const Scaffold(body: Center(child: CircularProgressIndicator())); + } + return _DetailView(vehicle: v, searchParams: params); + } +} + +class _DetailView extends StatelessWidget { + final MarketplaceVehicle vehicle; + final SearchParams searchParams; + + const _DetailView({required this.vehicle, required this.searchParams}); + + @override + Widget build(BuildContext context) { + final hasDates = searchParams.hasDateRange; + final days = hasDates + ? searchParams.endDate!.difference(searchParams.startDate!).inDays + : null; + final fmt = DateFormat('MMM d, yyyy'); + final baseUrl = AppConstants.baseUrl.replaceAll('/api/v1', ''); + + return Scaffold( + body: CustomScrollView( + slivers: [ + SliverAppBar( + expandedHeight: 280, + pinned: true, + flexibleSpace: FlexibleSpaceBar( + background: vehicle.primaryPhoto != null + ? CachedNetworkImage( + imageUrl: vehicle.primaryPhoto!.startsWith('http') + ? vehicle.primaryPhoto! + : '$baseUrl${vehicle.primaryPhoto!}', + fit: BoxFit.cover, + errorWidget: (_, _, _) => _placeholder(), + ) + : _placeholder(), + ), + ), + SliverToBoxAdapter( + child: Padding( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Company + Row( + children: [ + const Icon(Icons.business_outlined, + size: 14, color: Color(0xFF9CA3AF)), + const SizedBox(width: 6), + Text( + vehicle.company.brand.displayName, + style: const TextStyle( + color: Color(0xFF6B7280), fontSize: 13), + ), + ], + ), + const SizedBox(height: 6), + // Name + Text( + vehicle.displayName, + style: const TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 16), + // Specs grid + _SpecsGrid(vehicle: vehicle), + const SizedBox(height: 20), + // Features + if (vehicle.features.isNotEmpty) ...[ + const Text('Features', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 15, + color: Color(0xFF374151))), + const SizedBox(height: 10), + Wrap( + spacing: 8, + runSpacing: 8, + children: vehicle.features + .map((f) => Chip( + label: Text(f, + style: const TextStyle(fontSize: 12)), + backgroundColor: + const Color(0xFFF3F4F6), + )) + .toList(), + ), + const SizedBox(height: 20), + ], + // Pricing card + Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color(0xFFF0F7FF), + borderRadius: BorderRadius.circular(12), + border: Border.all(color: const Color(0xFFBFDBFE)), + ), + child: Column( + children: [ + Row( + children: [ + const Text('Daily rate', + style: TextStyle( + color: Color(0xFF6B7280), + fontSize: 13)), + const Spacer(), + Text( + '\$${vehicle.dailyRate.toStringAsFixed(2)}/day', + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Color(0xFF1A56DB), + ), + ), + ], + ), + if (hasDates && days != null) ...[ + const SizedBox(height: 10), + const Divider(height: 1), + const SizedBox(height: 10), + Row( + children: [ + Text( + '${fmt.format(searchParams.startDate!)} → ${fmt.format(searchParams.endDate!)}', + style: const TextStyle( + fontSize: 13, + color: Color(0xFF6B7280)), + ), + const Spacer(), + Text( + '$days day${days == 1 ? '' : 's'}', + style: const TextStyle( + color: Color(0xFF6B7280), + fontSize: 13), + ), + ], + ), + const SizedBox(height: 6), + Row( + children: [ + const Text('Estimated total', + style: TextStyle( + fontWeight: FontWeight.w600)), + const Spacer(), + Text( + '\$${(vehicle.dailyRateCents * days / 100).toStringAsFixed(2)}', + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 16, + color: Color(0xFF111928), + ), + ), + ], + ), + ], + ], + ), + ), + const SizedBox(height: 100), + ], + ), + ), + ), + ], + ), + bottomNavigationBar: SafeArea( + child: Padding( + padding: const EdgeInsets.all(16), + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: const Size.fromHeight(52)), + onPressed: vehicle.availability + ? () => context.push('/client/book/${vehicle.id}', + extra: vehicle) + : null, + child: Text(vehicle.availability + ? 'Reserve This Car' + : 'Not Available'), + ), + ), + ), + ); + } + + Widget _placeholder() => Container( + color: const Color(0xFFF3F4F6), + child: const Center( + child: Icon(Icons.directions_car, + size: 72, color: Color(0xFFD1D5DB)), + ), + ); +} + +class _SpecsGrid extends StatelessWidget { + final MarketplaceVehicle vehicle; + + const _SpecsGrid({required this.vehicle}); + + @override + Widget build(BuildContext context) { + final items = [ + (Icons.category_outlined, 'Category', + vehicle.category[0] + + vehicle.category.substring(1).toLowerCase()), + (Icons.people_outline, 'Seats', '${vehicle.seats}'), + (Icons.settings_outlined, 'Transmission', + vehicle.transmission[0] + + vehicle.transmission.substring(1).toLowerCase()), + (Icons.local_gas_station_outlined, 'Fuel', + vehicle.fuelType[0] + + vehicle.fuelType.substring(1).toLowerCase()), + if (vehicle.color != null) + (Icons.palette_outlined, 'Color', vehicle.color!), + if (vehicle.mileage != null) + (Icons.speed_outlined, 'Mileage', + '${vehicle.mileage} km'), + ]; + + return GridView.builder( + shrinkWrap: true, + physics: const NeverScrollableScrollPhysics(), + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + mainAxisExtent: 64, + crossAxisSpacing: 10, + mainAxisSpacing: 10, + ), + itemCount: items.length, + itemBuilder: (_, i) => Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: const Color(0xFFF9FAFB), + borderRadius: BorderRadius.circular(10), + border: Border.all(color: const Color(0xFFE5E7EB)), + ), + child: Row( + children: [ + Icon(items[i].$1, size: 16, color: const Color(0xFF6B7280)), + const SizedBox(width: 8), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(items[i].$2, + style: const TextStyle( + fontSize: 10, color: Color(0xFF9CA3AF))), + Text(items[i].$3, + style: const TextStyle( + fontSize: 13, + fontWeight: FontWeight.w600, + color: Color(0xFF111928)), + overflow: TextOverflow.ellipsis), + ], + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/client/screens/my_bookings_screen.dart b/lib/features/client/screens/my_bookings_screen.dart new file mode 100644 index 0000000..d750277 --- /dev/null +++ b/lib/features/client/screens/my_bookings_screen.dart @@ -0,0 +1,71 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../../../core/providers/auth_provider.dart'; + +class MyBookingsScreen extends ConsumerWidget { + const MyBookingsScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final auth = ref.watch(authProvider); + + if (auth.status != AuthStatus.authenticated) { + return Scaffold( + appBar: AppBar(title: const Text('My Bookings')), + body: Center( + child: Padding( + padding: const EdgeInsets.all(32), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.bookmark_outline, + size: 64, color: Color(0xFFD1D5DB)), + const SizedBox(height: 20), + const Text( + 'Sign in to view your bookings', + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 8), + const Text( + 'Create an account or log in to manage your reservations.', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF6B7280)), + ), + const SizedBox(height: 24), + ElevatedButton( + onPressed: () => context.push('/role'), + child: const Text('Sign In'), + ), + ], + ), + ), + ), + ); + } + + return Scaffold( + appBar: AppBar(title: const Text('My Bookings')), + body: const Center( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.event_available, size: 64, color: Color(0xFFD1D5DB)), + SizedBox(height: 16), + Text( + 'No bookings yet', + style: TextStyle( + fontSize: 16, + color: Color(0xFF6B7280), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/client/screens/widgets/marketplace_vehicle_card.dart b/lib/features/client/screens/widgets/marketplace_vehicle_card.dart new file mode 100644 index 0000000..1dfcbaf --- /dev/null +++ b/lib/features/client/screens/widgets/marketplace_vehicle_card.dart @@ -0,0 +1,253 @@ +import 'dart:io'; + +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import '../../../../core/models/marketplace.dart'; +import '../../../../core/constants/app_constants.dart'; + +const _orange = Color(0xFFFF6B00); + +class MarketplaceVehicleCard extends StatelessWidget { + final MarketplaceVehicle vehicle; + final DateTime? selectedStart; + final DateTime? selectedEnd; + final VoidCallback? onTap; + + const MarketplaceVehicleCard({ + super.key, + required this.vehicle, + this.selectedStart, + this.selectedEnd, + this.onTap, + }); + + @override + Widget build(BuildContext context) { + final cs = Theme.of(context).colorScheme; + final hasDates = selectedStart != null && selectedEnd != null; + final days = + hasDates ? selectedEnd!.difference(selectedStart!).inDays : null; + final totalCents = days != null ? vehicle.dailyRateCents * days : null; + + return Material( + color: cs.surfaceContainerHigh, + borderRadius: BorderRadius.circular(16), + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: onTap, + splashColor: _orange.withValues(alpha: 0.08), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Stack( + children: [ + _VehicleImage(vehicle: vehicle, cs: cs), + if (!vehicle.availability) + Positioned( + top: 10, + left: 10, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.65), + borderRadius: BorderRadius.circular(6), + ), + child: const Text( + 'Unavailable', + style: TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w600, + ), + ), + ), + ), + Positioned( + top: 10, + right: 10, + child: Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 4), + decoration: BoxDecoration( + color: Colors.black.withValues(alpha: 0.55), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + vehicle.category[0] + + vehicle.category.substring(1).toLowerCase(), + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w500, + ), + ), + ), + ), + ], + ), + Padding( + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(Icons.business_outlined, + size: 12, color: cs.onSurfaceVariant), + const SizedBox(width: 4), + Text( + vehicle.company.brand.displayName, + style: TextStyle( + fontSize: 12, color: cs.onSurfaceVariant), + ), + ], + ), + const SizedBox(height: 4), + Text( + vehicle.displayName, + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 16, + color: cs.onSurface, + ), + ), + const SizedBox(height: 10), + Row( + children: [ + _Spec( + icon: Icons.people_outline, + label: '${vehicle.seats} seats', + cs: cs), + const SizedBox(width: 14), + _Spec( + icon: Icons.settings_outlined, + label: vehicle.transmission[0] + + vehicle.transmission + .substring(1) + .toLowerCase(), + cs: cs), + const SizedBox(width: 14), + _Spec( + icon: Icons.local_gas_station_outlined, + label: vehicle.fuelType[0] + + vehicle.fuelType.substring(1).toLowerCase(), + cs: cs), + ], + ), + const SizedBox(height: 12), + Divider(height: 1, color: cs.outlineVariant), + const SizedBox(height: 12), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + '\$${vehicle.dailyRate.toStringAsFixed(0)}', + style: const TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + color: _orange, + ), + ), + Text( + '/day', + style: TextStyle( + fontSize: 13, color: cs.onSurfaceVariant), + ), + if (totalCents != null) ...[ + const Spacer(), + Column( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text( + '$days day${days == 1 ? '' : 's'}', + style: TextStyle( + fontSize: 11, + color: cs.onSurfaceVariant), + ), + Text( + '\$${(totalCents / 100).toStringAsFixed(0)} total', + style: TextStyle( + fontWeight: FontWeight.w700, + fontSize: 14, + color: cs.onSurface, + ), + ), + ], + ), + ], + ], + ), + ], + ), + ), + ], + ), + ), + ); + } +} + +class _VehicleImage extends StatelessWidget { + final MarketplaceVehicle vehicle; + final ColorScheme cs; + + const _VehicleImage({required this.vehicle, required this.cs}); + + @override + Widget build(BuildContext context) { + final photo = vehicle.primaryPhoto; + if (photo == null) return _placeholder(); + + final url = _resolveUrl(photo); + + return CachedNetworkImage( + imageUrl: url, + height: 180, + width: double.infinity, + fit: BoxFit.cover, + placeholder: (_, _) => _placeholder(), + errorWidget: (_, _, _) => _placeholder(), + ); + } + + String _resolveUrl(String photo) { + if (!photo.startsWith('http')) { + return '${AppConstants.baseUrl.replaceAll('/api/v1', '')}$photo'; + } + if (Platform.isAndroid) { + return photo.replaceFirst('localhost', '10.0.2.2'); + } + return photo; + } + + Widget _placeholder() => Container( + height: 180, + color: const Color(0xFF1C1C28), + child: Center( + child: Icon(Icons.directions_car, + size: 56, color: cs.outlineVariant), + ), + ); +} + +class _Spec extends StatelessWidget { + final IconData icon; + final String label; + final ColorScheme cs; + + const _Spec({required this.icon, required this.label, required this.cs}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon(icon, size: 13, color: cs.onSurfaceVariant), + const SizedBox(width: 3), + Text(label, + style: + TextStyle(fontSize: 12, color: cs.onSurfaceVariant)), + ], + ); + } +} diff --git a/lib/features/client/screens/widgets/offer_banner.dart b/lib/features/client/screens/widgets/offer_banner.dart new file mode 100644 index 0000000..8a0fc68 --- /dev/null +++ b/lib/features/client/screens/widgets/offer_banner.dart @@ -0,0 +1,84 @@ +import 'package:flutter/material.dart'; +import '../../../../core/models/marketplace.dart'; + +class OfferBanner extends StatelessWidget { + final MarketplaceOffer offer; + + const OfferBanner({super.key, required this.offer}); + + @override + Widget build(BuildContext context) { + final daysLeft = + offer.validUntil.difference(DateTime.now()).inDays; + + return Container( + width: 260, + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + gradient: const LinearGradient( + colors: [Color(0xFF1A56DB), Color(0xFF3B82F6)], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + borderRadius: BorderRadius.circular(12), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Expanded( + child: Text( + offer.title, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 14, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: Colors.white.withValues(alpha: 0.2), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + offer.discountLabel, + style: const TextStyle( + color: Colors.white, + fontSize: 11, + fontWeight: FontWeight.w700, + ), + ), + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + offer.company.brand.displayName, + style: TextStyle( + color: Colors.white.withValues(alpha: 0.8), + fontSize: 11, + ), + ), + Text( + daysLeft > 0 ? '$daysLeft days left' : 'Ends today', + style: TextStyle( + color: Colors.white.withValues(alpha: 0.8), + fontSize: 11, + ), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/features/dashboard/providers/dashboard_providers.dart b/lib/features/dashboard/providers/dashboard_providers.dart new file mode 100644 index 0000000..e029bcc --- /dev/null +++ b/lib/features/dashboard/providers/dashboard_providers.dart @@ -0,0 +1,66 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../../../core/models/analytics.dart'; +import '../../../core/models/vehicle.dart'; +import '../../../core/models/reservation.dart'; +import '../../../core/models/customer.dart'; +import '../../../core/services/analytics_service.dart'; +import '../../../core/services/vehicle_service.dart'; +import '../../../core/services/reservation_service.dart'; +import '../../../core/services/customer_service.dart'; + +final analyticsServiceProvider = Provider((_) => AnalyticsService()); +final vehicleServiceProvider = Provider((_) => VehicleService()); +final reservationServiceProvider = Provider((_) => ReservationService()); +final customerServiceProvider = Provider((_) => CustomerService()); + +final dashboardMetricsProvider = FutureProvider((ref) async { + return ref.read(analyticsServiceProvider).getDashboard(); +}); + +final vehiclesProvider = FutureProvider.family>( + (ref, params) async { + return ref.read(vehicleServiceProvider).getVehicles( + page: params['page'] as int? ?? 1, + pageSize: params['pageSize'] as int? ?? 20, + status: params['status'] as String?, + search: params['search'] as String?, + ); + }, +); + +final vehicleDetailProvider = FutureProvider.family((ref, id) { + return ref.read(vehicleServiceProvider).getVehicle(id); +}); + +final reservationsProvider = + FutureProvider.family>( + (ref, params) async { + return ref.read(reservationServiceProvider).getReservations( + page: params['page'] as int? ?? 1, + pageSize: params['pageSize'] as int? ?? 20, + status: params['status'] as String?, + search: params['search'] as String?, + ); + }, +); + +final reservationDetailProvider = + FutureProvider.family((ref, id) { + return ref.read(reservationServiceProvider).getReservation(id); +}); + +final customersProvider = + FutureProvider.family>( + (ref, params) async { + return ref.read(customerServiceProvider).getCustomers( + page: params['page'] as int? ?? 1, + pageSize: params['pageSize'] as int? ?? 20, + search: params['search'] as String?, + ); + }, +); + +final customerDetailProvider = + FutureProvider.family((ref, id) { + return ref.read(customerServiceProvider).getCustomer(id); +}); diff --git a/lib/features/dashboard/screens/customer_detail_screen.dart b/lib/features/dashboard/screens/customer_detail_screen.dart new file mode 100644 index 0000000..aecadf8 --- /dev/null +++ b/lib/features/dashboard/screens/customer_detail_screen.dart @@ -0,0 +1,161 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/status_badge.dart'; +import '../../../widgets/error_view.dart'; + +class CustomerDetailScreen extends ConsumerWidget { + final String id; + + const CustomerDetailScreen({super.key, required this.id}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final async = ref.watch(customerDetailProvider(id)); + + return async.when( + loading: () => + const Scaffold(body: Center(child: CircularProgressIndicator())), + error: (e, _) => Scaffold( + appBar: AppBar(), + body: ErrorView( + message: 'Could not load customer', + onRetry: () => ref.invalidate(customerDetailProvider(id)), + ), + ), + data: (customer) { + final fmt = DateFormat('MMM d, yyyy'); + return Scaffold( + appBar: AppBar(title: Text(customer.fullName)), + body: ListView( + padding: const EdgeInsets.all(16), + children: [ + Center( + child: Column( + children: [ + CircleAvatar( + radius: 40, + backgroundColor: customer.isFlagged + ? const Color(0xFFFDE8E8) + : const Color(0xFFE1EFFE), + child: Text( + customer.firstName.substring(0, 1).toUpperCase(), + style: TextStyle( + fontSize: 32, + color: customer.isFlagged + ? const Color(0xFFE02424) + : const Color(0xFF1A56DB), + fontWeight: FontWeight.bold, + ), + ), + ), + const SizedBox(height: 12), + Text( + customer.fullName, + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + ), + ), + const SizedBox(height: 6), + StatusBadge(status: customer.licenseStatus), + if (customer.isFlagged) ...[ + const SizedBox(height: 8), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 12, vertical: 6), + decoration: BoxDecoration( + color: const Color(0xFFFDE8E8), + borderRadius: BorderRadius.circular(8), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.flag, + size: 14, color: Color(0xFFE02424)), + const SizedBox(width: 6), + Text( + customer.flagReason ?? 'Flagged', + style: const TextStyle( + color: Color(0xFF9B1C1C), fontSize: 13), + ), + ], + ), + ), + ], + ], + ), + ), + const SizedBox(height: 24), + Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Contact Information', + style: TextStyle( + fontWeight: FontWeight.bold, + color: Color(0xFF6B7280), + fontSize: 12, + ), + ), + const SizedBox(height: 12), + if (customer.email != null) + _InfoRow( + icon: Icons.email_outlined, + value: customer.email!), + if (customer.phone != null) + _InfoRow( + icon: Icons.phone_outlined, + value: customer.phone!), + if (customer.nationality != null) + _InfoRow( + icon: Icons.flag_outlined, + value: customer.nationality!), + if (customer.dateOfBirth != null) + _InfoRow( + icon: Icons.cake_outlined, + value: fmt.format(customer.dateOfBirth!), + ), + _InfoRow( + icon: Icons.calendar_today_outlined, + value: 'Joined ${fmt.format(customer.createdAt)}', + ), + ], + ), + ), + ), + ], + ), + ); + }, + ); + } +} + +class _InfoRow extends StatelessWidget { + final IconData icon; + final String value; + + const _InfoRow({required this.icon, required this.value}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 6), + child: Row( + children: [ + Icon(icon, size: 18, color: const Color(0xFF6B7280)), + const SizedBox(width: 10), + Expanded( + child: Text(value, + style: const TextStyle(fontSize: 14)), + ), + ], + ), + ); + } +} diff --git a/lib/features/dashboard/screens/customers_screen.dart b/lib/features/dashboard/screens/customers_screen.dart new file mode 100644 index 0000000..4498c9a --- /dev/null +++ b/lib/features/dashboard/screens/customers_screen.dart @@ -0,0 +1,143 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/loading_list.dart'; +import '../../../widgets/error_view.dart'; +import '../../../widgets/status_badge.dart'; + +class CustomersScreen extends ConsumerStatefulWidget { + const CustomersScreen({super.key}); + + @override + ConsumerState createState() => _CustomersScreenState(); +} + +class _CustomersScreenState extends ConsumerState { + final _searchController = TextEditingController(); + String _search = ''; + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + Map get _params => { + 'page': 1, + 'pageSize': 50, + if (_search.isNotEmpty) 'search': _search, + }; + + @override + Widget build(BuildContext context) { + final customersAsync = ref.watch(customersProvider(_params)); + + return Scaffold( + appBar: AppBar( + title: const Text('Customers'), + bottom: PreferredSize( + preferredSize: const Size.fromHeight(60), + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 8), + child: TextField( + controller: _searchController, + decoration: const InputDecoration( + hintText: 'Search customers...', + prefixIcon: Icon(Icons.search, size: 20), + contentPadding: EdgeInsets.symmetric(vertical: 8), + ), + onChanged: (v) => setState(() => _search = v), + ), + ), + ), + ), + body: customersAsync.when( + loading: () => const LoadingList(itemHeight: 80), + error: (e, _) => ErrorView( + message: 'Failed to load customers', + onRetry: () => ref.invalidate(customersProvider(_params)), + ), + data: (res) => res.data.isEmpty + ? const Center( + child: Text('No customers found', + style: TextStyle(color: Color(0xFF9CA3AF)))) + : RefreshIndicator( + onRefresh: () async => + ref.invalidate(customersProvider(_params)), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: res.data.length, + separatorBuilder: (_, _) => const SizedBox(height: 10), + itemBuilder: (_, i) { + final c = res.data[i]; + return Card( + child: InkWell( + onTap: () => + context.push('/dashboard/customers/${c.id}'), + borderRadius: BorderRadius.circular(12), + child: Padding( + padding: const EdgeInsets.all(14), + child: Row( + children: [ + CircleAvatar( + backgroundColor: c.isFlagged + ? const Color(0xFFFDE8E8) + : const Color(0xFFE1EFFE), + radius: 22, + child: Text( + c.firstName.substring(0, 1).toUpperCase(), + style: TextStyle( + color: c.isFlagged + ? const Color(0xFFE02424) + : const Color(0xFF1A56DB), + fontWeight: FontWeight.bold, + ), + ), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + c.fullName, + style: const TextStyle( + fontWeight: FontWeight.w600, + ), + ), + if (c.isFlagged) ...[ + const SizedBox(width: 6), + const Icon(Icons.flag, + size: 14, + color: Color(0xFFE02424)), + ], + ], + ), + if (c.email != null) + Text( + c.email!, + style: const TextStyle( + fontSize: 12, + color: Color(0xFF6B7280), + ), + ), + ], + ), + ), + StatusBadge(status: c.licenseStatus), + ], + ), + ), + ), + ); + }, + ), + ), + ), + ); + } +} diff --git a/lib/features/dashboard/screens/dashboard_shell.dart b/lib/features/dashboard/screens/dashboard_shell.dart new file mode 100644 index 0000000..3ee8b81 --- /dev/null +++ b/lib/features/dashboard/screens/dashboard_shell.dart @@ -0,0 +1,127 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../../../core/providers/auth_provider.dart'; + +class DashboardShell extends ConsumerWidget { + final Widget child; + + const DashboardShell({super.key, required this.child}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final location = GoRouterState.of(context).matchedLocation; + final employee = ref.watch(authProvider).employee; + + int currentIndex = 0; + if (location.startsWith('/dashboard/vehicles')) currentIndex = 1; + if (location.startsWith('/dashboard/reservations')) currentIndex = 2; + if (location.startsWith('/dashboard/customers')) currentIndex = 3; + + return Scaffold( + drawer: _Drawer(employee: employee, ref: ref), + body: child, + bottomNavigationBar: NavigationBar( + selectedIndex: currentIndex, + onDestinationSelected: (i) { + switch (i) { + case 0: + context.go('/dashboard'); + case 1: + context.go('/dashboard/vehicles'); + case 2: + context.go('/dashboard/reservations'); + case 3: + context.go('/dashboard/customers'); + } + }, + destinations: const [ + NavigationDestination( + icon: Icon(Icons.dashboard_outlined), + selectedIcon: Icon(Icons.dashboard), + label: 'Dashboard', + ), + NavigationDestination( + icon: Icon(Icons.directions_car_outlined), + selectedIcon: Icon(Icons.directions_car), + label: 'Vehicles', + ), + NavigationDestination( + icon: Icon(Icons.event_note_outlined), + selectedIcon: Icon(Icons.event_note), + label: 'Reservations', + ), + NavigationDestination( + icon: Icon(Icons.people_outlined), + selectedIcon: Icon(Icons.people), + label: 'Customers', + ), + ], + ), + ); + } +} + +class _Drawer extends StatelessWidget { + final dynamic employee; + final WidgetRef ref; + + const _Drawer({required this.employee, required this.ref}); + + @override + Widget build(BuildContext context) { + return Drawer( + child: SafeArea( + child: Column( + children: [ + Padding( + padding: const EdgeInsets.all(20), + child: Row( + children: [ + CircleAvatar( + backgroundColor: const Color(0xFF1A56DB), + radius: 24, + child: Text( + employee?.firstName.substring(0, 1).toUpperCase() ?? 'U', + style: const TextStyle( + color: Colors.white, fontWeight: FontWeight.bold), + ), + ), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + employee?.fullName ?? 'Employee', + style: const TextStyle(fontWeight: FontWeight.w600), + ), + Text( + employee?.role ?? '', + style: const TextStyle( + fontSize: 12, color: Color(0xFF6B7280)), + ), + ], + ), + ), + ], + ), + ), + const Divider(), + const Spacer(), + ListTile( + leading: const Icon(Icons.logout, color: Color(0xFFE02424)), + title: const Text('Sign Out', + style: TextStyle(color: Color(0xFFE02424))), + onTap: () async { + Navigator.of(context).pop(); + await ref.read(authProvider.notifier).logout(); + }, + ), + const SizedBox(height: 8), + ], + ), + ), + ); + } +} diff --git a/lib/features/dashboard/screens/home_screen.dart b/lib/features/dashboard/screens/home_screen.dart new file mode 100644 index 0000000..8dc8bb1 --- /dev/null +++ b/lib/features/dashboard/screens/home_screen.dart @@ -0,0 +1,201 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import 'package:intl/intl.dart'; +import '../../../core/providers/auth_provider.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/stat_card.dart'; +import '../../../widgets/error_view.dart'; +import '../../../widgets/reservation_card.dart'; + +class HomeScreen extends ConsumerWidget { + const HomeScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final employee = ref.watch(authProvider).employee; + final metricsAsync = ref.watch(dashboardMetricsProvider); + final recentAsync = ref.watch( + reservationsProvider({'page': 1, 'pageSize': 5}), + ); + + return Scaffold( + appBar: AppBar( + title: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Hello, ${employee?.firstName ?? 'there'}', + style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + ), + Text( + DateFormat('EEEE, MMMM d').format(DateTime.now()), + style: + const TextStyle(fontSize: 12, color: Color(0xFF6B7280)), + ), + ], + ), + actions: [ + Builder( + builder: (ctx) => IconButton( + icon: const Icon(Icons.menu), + onPressed: () => Scaffold.of(ctx).openDrawer(), + ), + ), + ], + ), + body: RefreshIndicator( + onRefresh: () async { + ref.invalidate(dashboardMetricsProvider); + ref.invalidate(reservationsProvider); + }, + child: ListView( + padding: const EdgeInsets.all(16), + children: [ + metricsAsync.when( + loading: () => const SizedBox( + height: 200, + child: Center(child: CircularProgressIndicator()), + ), + error: (e, _) => ErrorView( + message: 'Could not load metrics', + onRetry: () => ref.invalidate(dashboardMetricsProvider), + ), + data: (metrics) => Column( + children: [ + Row( + children: [ + Expanded( + child: StatCard( + title: 'Total Vehicles', + value: '${metrics.totalVehicles}', + icon: Icons.directions_car, + color: const Color(0xFF1A56DB), + subtitle: '${metrics.availableVehicles} available', + ), + ), + const SizedBox(width: 12), + Expanded( + child: StatCard( + title: 'Active Rentals', + value: '${metrics.activeReservations}', + icon: Icons.event_available, + color: const Color(0xFF0E9F6E), + ), + ), + ], + ), + const SizedBox(height: 12), + Row( + children: [ + Expanded( + child: StatCard( + title: 'Revenue', + value: + '\$${NumberFormat.compact().format(metrics.totalRevenue)}', + icon: Icons.attach_money, + color: const Color(0xFF5521B5), + ), + ), + const SizedBox(width: 12), + Expanded( + child: StatCard( + title: 'Customers', + value: '${metrics.totalCustomers}', + icon: Icons.people, + color: const Color(0xFFB45309), + ), + ), + ], + ), + const SizedBox(height: 12), + Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + 'Fleet Occupancy', + style: TextStyle( + fontWeight: FontWeight.w600, + color: Color(0xFF374151), + ), + ), + const SizedBox(height: 12), + LinearProgressIndicator( + value: metrics.occupancyRate / 100, + backgroundColor: const Color(0xFFE5E7EB), + valueColor: const AlwaysStoppedAnimation( + Color(0xFF1A56DB)), + minHeight: 8, + borderRadius: BorderRadius.circular(4), + ), + const SizedBox(height: 8), + Text( + '${metrics.occupancyRate.toStringAsFixed(1)}% occupied', + style: const TextStyle( + fontSize: 13, + color: Color(0xFF6B7280), + ), + ), + ], + ), + ), + ), + ], + ), + ), + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + const Text( + 'Recent Reservations', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + TextButton( + onPressed: () => context.go('/dashboard/reservations'), + child: const Text('View all'), + ), + ], + ), + const SizedBox(height: 8), + recentAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (e, _) => const ErrorView( + message: 'Could not load recent reservations'), + data: (res) => res.data.isEmpty + ? const Center( + child: Padding( + padding: EdgeInsets.all(24), + child: Text( + 'No reservations yet', + style: TextStyle(color: Color(0xFF9CA3AF)), + ), + ), + ) + : Column( + children: res.data + .map((r) => Padding( + padding: + const EdgeInsets.only(bottom: 10), + child: ReservationCard( + reservation: r, + onTap: () => context.push( + '/dashboard/reservations/${r.id}'), + ), + )) + .toList(), + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/features/dashboard/screens/reservation_detail_screen.dart b/lib/features/dashboard/screens/reservation_detail_screen.dart new file mode 100644 index 0000000..be48a53 --- /dev/null +++ b/lib/features/dashboard/screens/reservation_detail_screen.dart @@ -0,0 +1,295 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/status_badge.dart'; +import '../../../widgets/error_view.dart'; + +class ReservationDetailScreen extends ConsumerWidget { + final String id; + + const ReservationDetailScreen({super.key, required this.id}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final async = ref.watch(reservationDetailProvider(id)); + + return async.when( + loading: () => + const Scaffold(body: Center(child: CircularProgressIndicator())), + error: (e, _) => Scaffold( + appBar: AppBar(), + body: ErrorView( + message: 'Could not load reservation', + onRetry: () => ref.invalidate(reservationDetailProvider(id)), + ), + ), + data: (res) { + final fmt = DateFormat('MMM d, yyyy'); + final canConfirm = res.status == 'DRAFT'; + final canCancel = + res.status == 'DRAFT' || res.status == 'CONFIRMED'; + final canCheckin = res.status == 'CONFIRMED'; + final canCheckout = res.status == 'ACTIVE'; + + return Scaffold( + appBar: AppBar( + title: Text('Reservation #${id.substring(0, 8)}'), + actions: [ + StatusBadge(status: res.status), + const SizedBox(width: 16), + ], + ), + body: ListView( + padding: const EdgeInsets.all(16), + children: [ + _Section( + title: 'Vehicle', + child: res.vehicle != null + ? _InfoRow(label: 'Vehicle', value: res.vehicle!.displayName) + : const Text('N/A'), + ), + _Section( + title: 'Customer', + child: res.customer != null + ? Column( + children: [ + _InfoRow( + label: 'Name', value: res.customer!.fullName), + if (res.customer!.email != null) + _InfoRow( + label: 'Email', value: res.customer!.email!), + if (res.customer!.phone != null) + _InfoRow( + label: 'Phone', value: res.customer!.phone!), + ], + ) + : const Text('Walk-in customer'), + ), + _Section( + title: 'Dates', + child: Column( + children: [ + _InfoRow(label: 'Start', value: fmt.format(res.startDate)), + _InfoRow(label: 'End', value: fmt.format(res.endDate)), + _InfoRow(label: 'Duration', value: '${res.days} days'), + ], + ), + ), + _Section( + title: 'Payment', + child: Column( + children: [ + _InfoRow( + label: 'Total', + value: '\$${res.totalAmount.toStringAsFixed(2)}'), + Row( + children: [ + const Text('Status: ', + style: TextStyle(color: Color(0xFF6B7280))), + const SizedBox(width: 4), + StatusBadge(status: res.paymentStatus), + ], + ), + ], + ), + ), + const SizedBox(height: 16), + if (canConfirm) + _ActionButton( + label: 'Confirm Reservation', + color: const Color(0xFF0E9F6E), + icon: Icons.check_circle_outline, + onTap: () async { + await ref + .read(reservationServiceProvider) + .confirmReservation(id); + ref.invalidate(reservationDetailProvider(id)); + }, + ), + if (canCheckin) + _ActionButton( + label: 'Check In', + color: const Color(0xFF1A56DB), + icon: Icons.login, + onTap: () => _showMileageDialog(context, ref, 'checkin'), + ), + if (canCheckout) + _ActionButton( + label: 'Check Out', + color: const Color(0xFF5521B5), + icon: Icons.logout, + onTap: () => _showMileageDialog(context, ref, 'checkout'), + ), + if (canCancel) + _ActionButton( + label: 'Cancel Reservation', + color: const Color(0xFFE02424), + icon: Icons.cancel_outlined, + onTap: () => _showCancelDialog(context, ref), + ), + ], + ), + ); + }, + ); + } + + void _showMileageDialog( + BuildContext context, WidgetRef ref, String type) { + final ctrl = TextEditingController(); + showDialog( + context: context, + builder: (_) => AlertDialog( + title: Text(type == 'checkin' ? 'Check In' : 'Check Out'), + content: TextField( + controller: ctrl, + keyboardType: TextInputType.number, + decoration: const InputDecoration( + labelText: 'Current mileage (km)', + ), + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: const Text('Cancel')), + ElevatedButton( + onPressed: () async { + final mileage = int.tryParse(ctrl.text); + if (mileage == null) return; + Navigator.pop(context); + try { + if (type == 'checkin') { + await ref + .read(reservationServiceProvider) + .checkin(id, mileage); + } else { + await ref + .read(reservationServiceProvider) + .checkout(id, mileage); + } + ref.invalidate(reservationDetailProvider(id)); + } catch (_) {} + }, + child: const Text('Confirm'), + ), + ], + ), + ); + } + + void _showCancelDialog(BuildContext context, WidgetRef ref) { + final ctrl = TextEditingController(); + showDialog( + context: context, + builder: (_) => AlertDialog( + title: const Text('Cancel Reservation'), + content: TextField( + controller: ctrl, + decoration: const InputDecoration(labelText: 'Reason'), + maxLines: 3, + ), + actions: [ + TextButton( + onPressed: () => Navigator.pop(context), + child: const Text('Back')), + ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFFE02424)), + onPressed: () async { + Navigator.pop(context); + await ref + .read(reservationServiceProvider) + .cancelReservation(id, ctrl.text); + ref.invalidate(reservationDetailProvider(id)); + }, + child: const Text('Cancel Reservation'), + ), + ], + ), + ); + } +} + +class _Section extends StatelessWidget { + final String title; + final Widget child; + + const _Section({required this.title, required this.child}); + + @override + Widget build(BuildContext context) { + return Card( + margin: const EdgeInsets.only(bottom: 12), + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: const TextStyle( + fontWeight: FontWeight.bold, + color: Color(0xFF6B7280), + fontSize: 12)), + const SizedBox(height: 10), + child, + ], + ), + ), + ); + } +} + +class _InfoRow extends StatelessWidget { + final String label; + final String value; + + const _InfoRow({required this.label, required this.value}); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 3), + child: Row( + children: [ + Text('$label: ', + style: const TextStyle(color: Color(0xFF6B7280))), + Expanded( + child: Text(value, + style: const TextStyle(fontWeight: FontWeight.w500)), + ), + ], + ), + ); + } +} + +class _ActionButton extends StatelessWidget { + final String label; + final Color color; + final IconData icon; + final VoidCallback onTap; + + const _ActionButton({ + required this.label, + required this.color, + required this.icon, + required this.onTap, + }); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.only(bottom: 10), + child: ElevatedButton.icon( + style: ElevatedButton.styleFrom( + backgroundColor: color, + minimumSize: const Size.fromHeight(48), + ), + icon: Icon(icon), + label: Text(label), + onPressed: onTap, + ), + ); + } +} diff --git a/lib/features/dashboard/screens/reservations_screen.dart b/lib/features/dashboard/screens/reservations_screen.dart new file mode 100644 index 0000000..a55e719 --- /dev/null +++ b/lib/features/dashboard/screens/reservations_screen.dart @@ -0,0 +1,123 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/reservation_card.dart'; +import '../../../widgets/loading_list.dart'; +import '../../../widgets/error_view.dart'; + +class ReservationsScreen extends ConsumerStatefulWidget { + const ReservationsScreen({super.key}); + + @override + ConsumerState createState() => _ReservationsScreenState(); +} + +class _ReservationsScreenState extends ConsumerState + with SingleTickerProviderStateMixin { + late final TabController _tabs; + final _statuses = [null, 'CONFIRMED', 'ACTIVE', 'COMPLETED', 'CANCELLED']; + final _labels = ['All', 'Confirmed', 'Active', 'Completed', 'Cancelled']; + final _searchController = TextEditingController(); + String _search = ''; + + @override + void initState() { + super.initState(); + _tabs = TabController(length: _statuses.length, vsync: this); + } + + @override + void dispose() { + _tabs.dispose(); + _searchController.dispose(); + super.dispose(); + } + + Map _params(int tabIndex) => { + 'page': 1, + 'pageSize': 50, + if (_statuses[tabIndex] != null) 'status': _statuses[tabIndex], + if (_search.isNotEmpty) 'search': _search, + }; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Reservations'), + bottom: TabBar( + controller: _tabs, + isScrollable: true, + tabs: _labels.map((l) => Tab(text: l)).toList(), + onTap: (_) => setState(() {}), + ), + ), + body: Column( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(16, 12, 16, 0), + child: TextField( + controller: _searchController, + decoration: const InputDecoration( + hintText: 'Search reservations...', + prefixIcon: Icon(Icons.search, size: 20), + contentPadding: EdgeInsets.symmetric(vertical: 8), + ), + onChanged: (v) => setState(() => _search = v), + ), + ), + Expanded( + child: TabBarView( + controller: _tabs, + children: List.generate( + _statuses.length, + (i) => _ReservationTab( + params: _params(i), + onTap: (id) => + context.push('/dashboard/reservations/$id'), + ), + ), + ), + ), + ], + ), + ); + } +} + +class _ReservationTab extends ConsumerWidget { + final Map params; + final void Function(String id) onTap; + + const _ReservationTab({required this.params, required this.onTap}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final async = ref.watch(reservationsProvider(params)); + return async.when( + loading: () => const LoadingList(itemHeight: 110), + error: (e, _) => ErrorView( + message: 'Failed to load reservations', + onRetry: () => ref.invalidate(reservationsProvider(params)), + ), + data: (res) => res.data.isEmpty + ? const Center( + child: Text('No reservations found', + style: TextStyle(color: Color(0xFF9CA3AF)))) + : RefreshIndicator( + onRefresh: () async => + ref.invalidate(reservationsProvider(params)), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: res.data.length, + separatorBuilder: (_, _) => const SizedBox(height: 10), + itemBuilder: (_, i) => ReservationCard( + reservation: res.data[i], + onTap: () => onTap(res.data[i].id), + ), + ), + ), + ); + } +} diff --git a/lib/features/dashboard/screens/vehicle_detail_screen.dart b/lib/features/dashboard/screens/vehicle_detail_screen.dart new file mode 100644 index 0000000..c9ad330 --- /dev/null +++ b/lib/features/dashboard/screens/vehicle_detail_screen.dart @@ -0,0 +1,203 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../core/constants/app_constants.dart'; +import '../../../widgets/status_badge.dart'; +import '../../../widgets/error_view.dart'; + +class VehicleDetailScreen extends ConsumerWidget { + final String id; + + const VehicleDetailScreen({super.key, required this.id}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final vehicleAsync = ref.watch(vehicleDetailProvider(id)); + + return vehicleAsync.when( + loading: () => const Scaffold( + body: Center(child: CircularProgressIndicator()), + ), + error: (e, _) => Scaffold( + appBar: AppBar(), + body: ErrorView( + message: 'Could not load vehicle', + onRetry: () => ref.invalidate(vehicleDetailProvider(id)), + ), + ), + data: (vehicle) { + final baseUrl = + AppConstants.baseUrl.replaceAll('/api/v1', ''); + return Scaffold( + body: CustomScrollView( + slivers: [ + SliverAppBar( + expandedHeight: 240, + pinned: true, + flexibleSpace: FlexibleSpaceBar( + background: vehicle.primaryPhoto != null + ? CachedNetworkImage( + imageUrl: vehicle.primaryPhoto!.startsWith('http') + ? vehicle.primaryPhoto! + : '$baseUrl${vehicle.primaryPhoto!}', + fit: BoxFit.cover, + errorWidget: (_, _, _) => Container( + color: const Color(0xFFF3F4F6), + child: const Icon(Icons.directions_car, + size: 72, color: Color(0xFFD1D5DB)), + ), + ) + : Container( + color: const Color(0xFFF3F4F6), + child: const Icon(Icons.directions_car, + size: 72, color: Color(0xFFD1D5DB)), + ), + ), + ), + SliverPadding( + padding: const EdgeInsets.all(20), + sliver: SliverList( + delegate: SliverChildListDelegate([ + Row( + children: [ + Expanded( + child: Text( + vehicle.displayName, + style: const TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + ), + StatusBadge(status: vehicle.status), + ], + ), + const SizedBox(height: 8), + Text( + vehicle.licensePlate, + style: const TextStyle( + fontSize: 15, color: Color(0xFF6B7280)), + ), + const SizedBox(height: 20), + _InfoGrid(vehicle: vehicle), + const SizedBox(height: 20), + const Text( + 'Pricing', + style: TextStyle( + fontSize: 16, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 12), + Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Row( + children: [ + const Icon(Icons.attach_money, + color: Color(0xFF1A56DB)), + const SizedBox(width: 8), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + '\$${vehicle.dailyRate.toStringAsFixed(2)}/day', + style: const TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Color(0xFF1A56DB), + ), + ), + const Text( + 'Daily rate', + style: TextStyle( + fontSize: 12, + color: Color(0xFF6B7280)), + ), + ], + ), + const Spacer(), + Switch( + value: vehicle.isPublished, + onChanged: (v) async { + try { + await ref + .read(vehicleServiceProvider) + .togglePublish(id, v); + ref.invalidate(vehicleDetailProvider(id)); + } catch (_) {} + }, + ), + const Text( + 'Published', + style: TextStyle( + fontSize: 12, color: Color(0xFF6B7280)), + ), + ], + ), + ), + ), + ]), + ), + ), + ], + ), + ); + }, + ); + } +} + +class _InfoGrid extends StatelessWidget { + final dynamic vehicle; + + const _InfoGrid({required this.vehicle}); + + @override + Widget build(BuildContext context) { + final items = [ + ('Category', vehicle.category), + if (vehicle.seats != null) ('Seats', '${vehicle.seats}'), + if (vehicle.transmission != null) ('Transmission', vehicle.transmission!), + if (vehicle.fuelType != null) ('Fuel', vehicle.fuelType!), + if (vehicle.mileage != null) + ('Mileage', '${vehicle.mileage} km'), + ]; + + return Wrap( + spacing: 12, + runSpacing: 12, + children: items + .map((item) => Container( + padding: const EdgeInsets.symmetric( + horizontal: 14, vertical: 10), + decoration: BoxDecoration( + color: const Color(0xFFF3F4F6), + borderRadius: BorderRadius.circular(10), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + item.$1, + style: const TextStyle( + fontSize: 11, color: Color(0xFF9CA3AF)), + ), + const SizedBox(height: 2), + Text( + item.$2, + style: const TextStyle( + fontWeight: FontWeight.w600, + color: Color(0xFF111928), + ), + ), + ], + ), + )) + .toList(), + ); + } +} diff --git a/lib/features/dashboard/screens/vehicles_screen.dart b/lib/features/dashboard/screens/vehicles_screen.dart new file mode 100644 index 0000000..6233bff --- /dev/null +++ b/lib/features/dashboard/screens/vehicles_screen.dart @@ -0,0 +1,107 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; +import '../providers/dashboard_providers.dart'; +import '../../../widgets/vehicle_card.dart'; +import '../../../widgets/loading_list.dart'; +import '../../../widgets/error_view.dart'; + +class VehiclesScreen extends ConsumerStatefulWidget { + const VehiclesScreen({super.key}); + + @override + ConsumerState createState() => _VehiclesScreenState(); +} + +class _VehiclesScreenState extends ConsumerState { + String? _statusFilter; + final _searchController = TextEditingController(); + String _search = ''; + + @override + void dispose() { + _searchController.dispose(); + super.dispose(); + } + + Map get _params => { + 'page': 1, + 'pageSize': 50, + if (_statusFilter != null) 'status': _statusFilter, + if (_search.isNotEmpty) 'search': _search, + }; + + @override + Widget build(BuildContext context) { + final vehiclesAsync = ref.watch(vehiclesProvider(_params)); + + return Scaffold( + appBar: AppBar( + title: const Text('Vehicles'), + bottom: PreferredSize( + preferredSize: const Size.fromHeight(60), + child: Padding( + padding: const EdgeInsets.fromLTRB(16, 0, 16, 8), + child: TextField( + controller: _searchController, + decoration: const InputDecoration( + hintText: 'Search vehicles...', + prefixIcon: Icon(Icons.search, size: 20), + contentPadding: EdgeInsets.symmetric(vertical: 8), + ), + onChanged: (v) => setState(() => _search = v), + ), + ), + ), + actions: [ + PopupMenuButton( + icon: Icon( + Icons.filter_list, + color: _statusFilter != null + ? const Color(0xFF1A56DB) + : null, + ), + onSelected: (v) => setState(() => _statusFilter = v), + itemBuilder: (_) => [ + const PopupMenuItem(value: null, child: Text('All')), + const PopupMenuItem(value: 'AVAILABLE', child: Text('Available')), + const PopupMenuItem(value: 'RENTED', child: Text('Rented')), + const PopupMenuItem( + value: 'MAINTENANCE', child: Text('Maintenance')), + ], + ), + ], + ), + body: vehiclesAsync.when( + loading: () => const LoadingList(itemHeight: 240), + error: (e, _) => ErrorView( + message: 'Failed to load vehicles', + onRetry: () => ref.invalidate(vehiclesProvider(_params)), + ), + data: (res) => res.data.isEmpty + ? const Center( + child: Text('No vehicles found', + style: TextStyle(color: Color(0xFF9CA3AF)))) + : RefreshIndicator( + onRefresh: () async => + ref.invalidate(vehiclesProvider(_params)), + child: GridView.builder( + padding: const EdgeInsets.all(16), + gridDelegate: + const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 1, + mainAxisExtent: 240, + mainAxisSpacing: 12, + ), + itemCount: res.data.length, + itemBuilder: (_, i) => VehicleCard( + vehicle: res.data[i], + onTap: () => context + .push('/dashboard/vehicles/${res.data[i].id}'), + ), + ), + ), + ), + ); + } +} diff --git a/lib/l10n/app_ar.arb b/lib/l10n/app_ar.arb new file mode 100644 index 0000000..671acaa --- /dev/null +++ b/lib/l10n/app_ar.arb @@ -0,0 +1,53 @@ +{ + "@@locale": "ar", + "appName": "RentalDriveGo", + "tagline": "أسهل طريقة للعثور\nوحجز سيارتك المثالية", + "findYourCar": "ابحث عن سيارتك", + "companySignIn": "تسجيل دخول لوحة تحكم الشركة", + "sameDropoff": "إرجاع نفس المكان", + "differentDropoff": "إرجاع مكان آخر", + "findCarToRent": "ابحث عن سيارة للإيجار", + "allCarTypes": "جميع أنواع السيارات", + "search": "بحث", + "searching": "جارٍ البحث…", + "vehiclesFound": "{count, plural, =0{لا توجد سيارات} =1{سيارة واحدة متوفرة} =2{سيارتان متوفرتان} few{{count} سيارات متوفرة} other{{count} سيارة متوفرة}}", + "@vehiclesFound": { + "placeholders": { + "count": { "type": "num" } + } + }, + "noVehiclesFound": "لا توجد سيارات", + "tryDifferentSearch": "جرّب تواريخ أو مدينة أو نوع مختلف", + "couldNotLoadVehicles": "تعذّر تحميل السيارات", + "checkConnectionRetry": "تحقق من اتصالك وحاول مجدداً", + "retry": "إعادة المحاولة", + "myBookings": "حجوزاتي", + "browse": "تصفح", + "signInToViewBookings": "سجّل الدخول لعرض حجوزاتك", + "carType": "نوع السيارة", + "selectCity": "اختر المدينة", + "allCities": "جميع المدن", + "searchCities": "ابحث عن مدينة…", + "chooseLanguage": "اللغة", + "languageName": "العربية", + "perDay": "/يوم", + "nDays": "{count, plural, =1{يوم واحد} =2{يومان} few{{count} أيام} other{{count} يوم}}", + "@nDays": { + "placeholders": { + "count": { "type": "num" } + } + }, + "total": "الإجمالي", + "reserveThisCar": "احجز هذه السيارة", + "lightTheme": "فاتح", + "darkTheme": "داكن", + "settings": "الإعدادات", + "anyPrice": "أي سعر", + "price": "السعر", + "apply": "تطبيق", + "selectAll": "تحديد الكل", + "clearAll": "مسح الكل", + "pickDates": "اختر التواريخ", + "pickupLocation": "موقع الاستلام", + "dropoffLocation": "موقع الإرجاع" +} diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb new file mode 100644 index 0000000..1a912dc --- /dev/null +++ b/lib/l10n/app_en.arb @@ -0,0 +1,53 @@ +{ + "@@locale": "en", + "appName": "RentalDriveGo", + "tagline": "The easiest way to find\nand reserve your perfect car", + "findYourCar": "Find your car", + "companySignIn": "Company dashboard sign in", + "sameDropoff": "Same drop-off", + "differentDropoff": "Different drop-off", + "findCarToRent": "Find a car to rent", + "allCarTypes": "All car types", + "search": "Search", + "searching": "Searching…", + "vehiclesFound": "{count, plural, =0{No vehicles found} =1{1 vehicle found} other{{count} vehicles found}}", + "@vehiclesFound": { + "placeholders": { + "count": { "type": "num" } + } + }, + "noVehiclesFound": "No vehicles found", + "tryDifferentSearch": "Try different dates, city, or car type", + "couldNotLoadVehicles": "Could not load vehicles", + "checkConnectionRetry": "Check your connection and try again", + "retry": "Retry", + "myBookings": "My Bookings", + "browse": "Browse", + "signInToViewBookings": "Sign in to view your bookings", + "carType": "Car type", + "selectCity": "Select city", + "allCities": "All cities", + "searchCities": "Search cities…", + "chooseLanguage": "Language", + "languageName": "English", + "perDay": "/day", + "nDays": "{count, plural, =1{1 day} other{{count} days}}", + "@nDays": { + "placeholders": { + "count": { "type": "num" } + } + }, + "total": "total", + "reserveThisCar": "Reserve This Car", + "lightTheme": "Light", + "darkTheme": "Dark", + "settings": "Settings", + "anyPrice": "Any price", + "price": "Price", + "apply": "Apply", + "selectAll": "Select all", + "clearAll": "Clear all", + "pickDates": "Pick dates", + "pickupLocation": "Pickup location", + "dropoffLocation": "Drop-off location" +} diff --git a/lib/l10n/app_fr.arb b/lib/l10n/app_fr.arb new file mode 100644 index 0000000..41efe30 --- /dev/null +++ b/lib/l10n/app_fr.arb @@ -0,0 +1,53 @@ +{ + "@@locale": "fr", + "appName": "RentalDriveGo", + "tagline": "La façon la plus simple de trouver\net réserver la voiture parfaite", + "findYourCar": "Trouver ma voiture", + "companySignIn": "Connexion tableau de bord entreprise", + "sameDropoff": "Retour même lieu", + "differentDropoff": "Retour autre lieu", + "findCarToRent": "Trouver une voiture à louer", + "allCarTypes": "Tous les types", + "search": "Rechercher", + "searching": "Recherche…", + "vehiclesFound": "{count, plural, =0{Aucun véhicule trouvé} =1{1 véhicule trouvé} other{{count} véhicules trouvés}}", + "@vehiclesFound": { + "placeholders": { + "count": { "type": "num" } + } + }, + "noVehiclesFound": "Aucun véhicule trouvé", + "tryDifferentSearch": "Essayez d'autres dates, ville ou type", + "couldNotLoadVehicles": "Impossible de charger les véhicules", + "checkConnectionRetry": "Vérifiez votre connexion et réessayez", + "retry": "Réessayer", + "myBookings": "Mes réservations", + "browse": "Parcourir", + "signInToViewBookings": "Connectez-vous pour voir vos réservations", + "carType": "Type de voiture", + "selectCity": "Sélectionner une ville", + "allCities": "Toutes les villes", + "searchCities": "Rechercher des villes…", + "chooseLanguage": "Langue", + "languageName": "Français", + "perDay": "/jour", + "nDays": "{count, plural, =1{1 jour} other{{count} jours}}", + "@nDays": { + "placeholders": { + "count": { "type": "num" } + } + }, + "total": "total", + "reserveThisCar": "Réserver cette voiture", + "lightTheme": "Clair", + "darkTheme": "Sombre", + "settings": "Paramètres", + "anyPrice": "Tout prix", + "price": "Prix", + "apply": "Appliquer", + "selectAll": "Tout sélectionner", + "clearAll": "Tout effacer", + "pickDates": "Choisir les dates", + "pickupLocation": "Lieu de prise en charge", + "dropoffLocation": "Lieu de retour" +} diff --git a/lib/l10n/app_localizations.dart b/lib/l10n/app_localizations.dart new file mode 100644 index 0000000..de5ed8a --- /dev/null +++ b/lib/l10n/app_localizations.dart @@ -0,0 +1,378 @@ +import 'dart:async'; + +import 'package:flutter/foundation.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; +import 'package:intl/intl.dart' as intl; + +import 'app_localizations_ar.dart'; +import 'app_localizations_en.dart'; +import 'app_localizations_fr.dart'; + +// ignore_for_file: type=lint + +/// Callers can lookup localized strings with an instance of AppLocalizations +/// returned by `AppLocalizations.of(context)`. +/// +/// Applications need to include `AppLocalizations.delegate()` in their app's +/// `localizationDelegates` list, and the locales they support in the app's +/// `supportedLocales` list. For example: +/// +/// ```dart +/// import 'l10n/app_localizations.dart'; +/// +/// return MaterialApp( +/// localizationsDelegates: AppLocalizations.localizationsDelegates, +/// supportedLocales: AppLocalizations.supportedLocales, +/// home: MyApplicationHome(), +/// ); +/// ``` +/// +/// ## Update pubspec.yaml +/// +/// Please make sure to update your pubspec.yaml to include the following +/// packages: +/// +/// ```yaml +/// dependencies: +/// # Internationalization support. +/// flutter_localizations: +/// sdk: flutter +/// intl: any # Use the pinned version from flutter_localizations +/// +/// # Rest of dependencies +/// ``` +/// +/// ## iOS Applications +/// +/// iOS applications define key application metadata, including supported +/// locales, in an Info.plist file that is built into the application bundle. +/// To configure the locales supported by your app, you’ll need to edit this +/// file. +/// +/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file. +/// Then, in the Project Navigator, open the Info.plist file under the Runner +/// project’s Runner folder. +/// +/// Next, select the Information Property List item, select Add Item from the +/// Editor menu, then select Localizations from the pop-up menu. +/// +/// Select and expand the newly-created Localizations item then, for each +/// locale your application supports, add a new item and select the locale +/// you wish to add from the pop-up menu in the Value field. This list should +/// be consistent with the languages listed in the AppLocalizations.supportedLocales +/// property. +abstract class AppLocalizations { + AppLocalizations(String locale) + : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + + final String localeName; + + static AppLocalizations of(BuildContext context) { + return Localizations.of(context, AppLocalizations)!; + } + + static const LocalizationsDelegate delegate = + _AppLocalizationsDelegate(); + + /// A list of this localizations delegate along with the default localizations + /// delegates. + /// + /// Returns a list of localizations delegates containing this delegate along with + /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, + /// and GlobalWidgetsLocalizations.delegate. + /// + /// Additional delegates can be added by appending to this list in + /// MaterialApp. This list does not have to be used at all if a custom list + /// of delegates is preferred or required. + static const List> localizationsDelegates = + >[ + delegate, + GlobalMaterialLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + ]; + + /// A list of this localizations delegate's supported locales. + static const List supportedLocales = [ + Locale('ar'), + Locale('en'), + Locale('fr'), + ]; + + /// No description provided for @appName. + /// + /// In en, this message translates to: + /// **'RentalDriveGo'** + String get appName; + + /// No description provided for @tagline. + /// + /// In en, this message translates to: + /// **'The easiest way to find\nand reserve your perfect car'** + String get tagline; + + /// No description provided for @findYourCar. + /// + /// In en, this message translates to: + /// **'Find your car'** + String get findYourCar; + + /// No description provided for @companySignIn. + /// + /// In en, this message translates to: + /// **'Company dashboard sign in'** + String get companySignIn; + + /// No description provided for @sameDropoff. + /// + /// In en, this message translates to: + /// **'Same drop-off'** + String get sameDropoff; + + /// No description provided for @differentDropoff. + /// + /// In en, this message translates to: + /// **'Different drop-off'** + String get differentDropoff; + + /// No description provided for @findCarToRent. + /// + /// In en, this message translates to: + /// **'Find a car to rent'** + String get findCarToRent; + + /// No description provided for @allCarTypes. + /// + /// In en, this message translates to: + /// **'All car types'** + String get allCarTypes; + + /// No description provided for @search. + /// + /// In en, this message translates to: + /// **'Search'** + String get search; + + /// No description provided for @searching. + /// + /// In en, this message translates to: + /// **'Searching…'** + String get searching; + + /// No description provided for @vehiclesFound. + /// + /// In en, this message translates to: + /// **'{count, plural, =0{No vehicles found} =1{1 vehicle found} other{{count} vehicles found}}'** + String vehiclesFound(num count); + + /// No description provided for @noVehiclesFound. + /// + /// In en, this message translates to: + /// **'No vehicles found'** + String get noVehiclesFound; + + /// No description provided for @tryDifferentSearch. + /// + /// In en, this message translates to: + /// **'Try different dates, city, or car type'** + String get tryDifferentSearch; + + /// No description provided for @couldNotLoadVehicles. + /// + /// In en, this message translates to: + /// **'Could not load vehicles'** + String get couldNotLoadVehicles; + + /// No description provided for @checkConnectionRetry. + /// + /// In en, this message translates to: + /// **'Check your connection and try again'** + String get checkConnectionRetry; + + /// No description provided for @retry. + /// + /// In en, this message translates to: + /// **'Retry'** + String get retry; + + /// No description provided for @myBookings. + /// + /// In en, this message translates to: + /// **'My Bookings'** + String get myBookings; + + /// No description provided for @browse. + /// + /// In en, this message translates to: + /// **'Browse'** + String get browse; + + /// No description provided for @signInToViewBookings. + /// + /// In en, this message translates to: + /// **'Sign in to view your bookings'** + String get signInToViewBookings; + + /// No description provided for @carType. + /// + /// In en, this message translates to: + /// **'Car type'** + String get carType; + + /// No description provided for @selectCity. + /// + /// In en, this message translates to: + /// **'Select city'** + String get selectCity; + + /// No description provided for @allCities. + /// + /// In en, this message translates to: + /// **'All cities'** + String get allCities; + + /// No description provided for @searchCities. + /// + /// In en, this message translates to: + /// **'Search cities…'** + String get searchCities; + + /// No description provided for @chooseLanguage. + /// + /// In en, this message translates to: + /// **'Language'** + String get chooseLanguage; + + /// No description provided for @languageName. + /// + /// In en, this message translates to: + /// **'English'** + String get languageName; + + /// No description provided for @perDay. + /// + /// In en, this message translates to: + /// **'/day'** + String get perDay; + + /// No description provided for @nDays. + /// + /// In en, this message translates to: + /// **'{count, plural, =1{1 day} other{{count} days}}'** + String nDays(num count); + + /// No description provided for @total. + /// + /// In en, this message translates to: + /// **'total'** + String get total; + + /// No description provided for @reserveThisCar. + /// + /// In en, this message translates to: + /// **'Reserve This Car'** + String get reserveThisCar; + + /// No description provided for @lightTheme. + /// + /// In en, this message translates to: + /// **'Light'** + String get lightTheme; + + /// No description provided for @darkTheme. + /// + /// In en, this message translates to: + /// **'Dark'** + String get darkTheme; + + /// No description provided for @settings. + /// + /// In en, this message translates to: + /// **'Settings'** + String get settings; + + /// No description provided for @anyPrice. + /// + /// In en, this message translates to: + /// **'Any price'** + String get anyPrice; + + /// No description provided for @price. + /// + /// In en, this message translates to: + /// **'Price'** + String get price; + + /// No description provided for @apply. + /// + /// In en, this message translates to: + /// **'Apply'** + String get apply; + + /// No description provided for @selectAll. + /// + /// In en, this message translates to: + /// **'Select all'** + String get selectAll; + + /// No description provided for @clearAll. + /// + /// In en, this message translates to: + /// **'Clear all'** + String get clearAll; + + /// No description provided for @pickDates. + /// + /// In en, this message translates to: + /// **'Pick dates'** + String get pickDates; + + /// No description provided for @pickupLocation. + /// + /// In en, this message translates to: + /// **'Pickup location'** + String get pickupLocation; + + /// No description provided for @dropoffLocation. + /// + /// In en, this message translates to: + /// **'Drop-off location'** + String get dropoffLocation; +} + +class _AppLocalizationsDelegate + extends LocalizationsDelegate { + const _AppLocalizationsDelegate(); + + @override + Future load(Locale locale) { + return SynchronousFuture(lookupAppLocalizations(locale)); + } + + @override + bool isSupported(Locale locale) => + ['ar', 'en', 'fr'].contains(locale.languageCode); + + @override + bool shouldReload(_AppLocalizationsDelegate old) => false; +} + +AppLocalizations lookupAppLocalizations(Locale locale) { + // Lookup logic when only language code is specified. + switch (locale.languageCode) { + case 'ar': + return AppLocalizationsAr(); + case 'en': + return AppLocalizationsEn(); + case 'fr': + return AppLocalizationsFr(); + } + + throw FlutterError( + 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.', + ); +} diff --git a/lib/l10n/app_localizations_ar.dart b/lib/l10n/app_localizations_ar.dart new file mode 100644 index 0000000..3eb23ac --- /dev/null +++ b/lib/l10n/app_localizations_ar.dart @@ -0,0 +1,151 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for Arabic (`ar`). +class AppLocalizationsAr extends AppLocalizations { + AppLocalizationsAr([String locale = 'ar']) : super(locale); + + @override + String get appName => 'RentalDriveGo'; + + @override + String get tagline => 'أسهل طريقة للعثور\nوحجز سيارتك المثالية'; + + @override + String get findYourCar => 'ابحث عن سيارتك'; + + @override + String get companySignIn => 'تسجيل دخول لوحة تحكم الشركة'; + + @override + String get sameDropoff => 'إرجاع نفس المكان'; + + @override + String get differentDropoff => 'إرجاع مكان آخر'; + + @override + String get findCarToRent => 'ابحث عن سيارة للإيجار'; + + @override + String get allCarTypes => 'جميع أنواع السيارات'; + + @override + String get search => 'بحث'; + + @override + String get searching => 'جارٍ البحث…'; + + @override + String vehiclesFound(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count سيارة متوفرة', + few: '$count سيارات متوفرة', + two: 'سيارتان متوفرتان', + one: 'سيارة واحدة متوفرة', + zero: 'لا توجد سيارات', + ); + return '$_temp0'; + } + + @override + String get noVehiclesFound => 'لا توجد سيارات'; + + @override + String get tryDifferentSearch => 'جرّب تواريخ أو مدينة أو نوع مختلف'; + + @override + String get couldNotLoadVehicles => 'تعذّر تحميل السيارات'; + + @override + String get checkConnectionRetry => 'تحقق من اتصالك وحاول مجدداً'; + + @override + String get retry => 'إعادة المحاولة'; + + @override + String get myBookings => 'حجوزاتي'; + + @override + String get browse => 'تصفح'; + + @override + String get signInToViewBookings => 'سجّل الدخول لعرض حجوزاتك'; + + @override + String get carType => 'نوع السيارة'; + + @override + String get selectCity => 'اختر المدينة'; + + @override + String get allCities => 'جميع المدن'; + + @override + String get searchCities => 'ابحث عن مدينة…'; + + @override + String get chooseLanguage => 'اللغة'; + + @override + String get languageName => 'العربية'; + + @override + String get perDay => '/يوم'; + + @override + String nDays(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count يوم', + few: '$count أيام', + two: 'يومان', + one: 'يوم واحد', + ); + return '$_temp0'; + } + + @override + String get total => 'الإجمالي'; + + @override + String get reserveThisCar => 'احجز هذه السيارة'; + + @override + String get lightTheme => 'فاتح'; + + @override + String get darkTheme => 'داكن'; + + @override + String get settings => 'الإعدادات'; + + @override + String get anyPrice => 'أي سعر'; + + @override + String get price => 'السعر'; + + @override + String get apply => 'تطبيق'; + + @override + String get selectAll => 'تحديد الكل'; + + @override + String get clearAll => 'مسح الكل'; + + @override + String get pickDates => 'اختر التواريخ'; + + @override + String get pickupLocation => 'موقع الاستلام'; + + @override + String get dropoffLocation => 'موقع الإرجاع'; +} diff --git a/lib/l10n/app_localizations_en.dart b/lib/l10n/app_localizations_en.dart new file mode 100644 index 0000000..02658f5 --- /dev/null +++ b/lib/l10n/app_localizations_en.dart @@ -0,0 +1,147 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for English (`en`). +class AppLocalizationsEn extends AppLocalizations { + AppLocalizationsEn([String locale = 'en']) : super(locale); + + @override + String get appName => 'RentalDriveGo'; + + @override + String get tagline => 'The easiest way to find\nand reserve your perfect car'; + + @override + String get findYourCar => 'Find your car'; + + @override + String get companySignIn => 'Company dashboard sign in'; + + @override + String get sameDropoff => 'Same drop-off'; + + @override + String get differentDropoff => 'Different drop-off'; + + @override + String get findCarToRent => 'Find a car to rent'; + + @override + String get allCarTypes => 'All car types'; + + @override + String get search => 'Search'; + + @override + String get searching => 'Searching…'; + + @override + String vehiclesFound(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count vehicles found', + one: '1 vehicle found', + zero: 'No vehicles found', + ); + return '$_temp0'; + } + + @override + String get noVehiclesFound => 'No vehicles found'; + + @override + String get tryDifferentSearch => 'Try different dates, city, or car type'; + + @override + String get couldNotLoadVehicles => 'Could not load vehicles'; + + @override + String get checkConnectionRetry => 'Check your connection and try again'; + + @override + String get retry => 'Retry'; + + @override + String get myBookings => 'My Bookings'; + + @override + String get browse => 'Browse'; + + @override + String get signInToViewBookings => 'Sign in to view your bookings'; + + @override + String get carType => 'Car type'; + + @override + String get selectCity => 'Select city'; + + @override + String get allCities => 'All cities'; + + @override + String get searchCities => 'Search cities…'; + + @override + String get chooseLanguage => 'Language'; + + @override + String get languageName => 'English'; + + @override + String get perDay => '/day'; + + @override + String nDays(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count days', + one: '1 day', + ); + return '$_temp0'; + } + + @override + String get total => 'total'; + + @override + String get reserveThisCar => 'Reserve This Car'; + + @override + String get lightTheme => 'Light'; + + @override + String get darkTheme => 'Dark'; + + @override + String get settings => 'Settings'; + + @override + String get anyPrice => 'Any price'; + + @override + String get price => 'Price'; + + @override + String get apply => 'Apply'; + + @override + String get selectAll => 'Select all'; + + @override + String get clearAll => 'Clear all'; + + @override + String get pickDates => 'Pick dates'; + + @override + String get pickupLocation => 'Pickup location'; + + @override + String get dropoffLocation => 'Drop-off location'; +} diff --git a/lib/l10n/app_localizations_fr.dart b/lib/l10n/app_localizations_fr.dart new file mode 100644 index 0000000..6fd86d8 --- /dev/null +++ b/lib/l10n/app_localizations_fr.dart @@ -0,0 +1,149 @@ +// ignore: unused_import +import 'package:intl/intl.dart' as intl; +import 'app_localizations.dart'; + +// ignore_for_file: type=lint + +/// The translations for French (`fr`). +class AppLocalizationsFr extends AppLocalizations { + AppLocalizationsFr([String locale = 'fr']) : super(locale); + + @override + String get appName => 'RentalDriveGo'; + + @override + String get tagline => + 'La façon la plus simple de trouver\net réserver la voiture parfaite'; + + @override + String get findYourCar => 'Trouver ma voiture'; + + @override + String get companySignIn => 'Connexion tableau de bord entreprise'; + + @override + String get sameDropoff => 'Retour même lieu'; + + @override + String get differentDropoff => 'Retour autre lieu'; + + @override + String get findCarToRent => 'Trouver une voiture à louer'; + + @override + String get allCarTypes => 'Tous les types'; + + @override + String get search => 'Rechercher'; + + @override + String get searching => 'Recherche…'; + + @override + String vehiclesFound(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count véhicules trouvés', + one: '1 véhicule trouvé', + zero: 'Aucun véhicule trouvé', + ); + return '$_temp0'; + } + + @override + String get noVehiclesFound => 'Aucun véhicule trouvé'; + + @override + String get tryDifferentSearch => 'Essayez d\'autres dates, ville ou type'; + + @override + String get couldNotLoadVehicles => 'Impossible de charger les véhicules'; + + @override + String get checkConnectionRetry => 'Vérifiez votre connexion et réessayez'; + + @override + String get retry => 'Réessayer'; + + @override + String get myBookings => 'Mes réservations'; + + @override + String get browse => 'Parcourir'; + + @override + String get signInToViewBookings => + 'Connectez-vous pour voir vos réservations'; + + @override + String get carType => 'Type de voiture'; + + @override + String get selectCity => 'Sélectionner une ville'; + + @override + String get allCities => 'Toutes les villes'; + + @override + String get searchCities => 'Rechercher des villes…'; + + @override + String get chooseLanguage => 'Langue'; + + @override + String get languageName => 'Français'; + + @override + String get perDay => '/jour'; + + @override + String nDays(num count) { + String _temp0 = intl.Intl.pluralLogic( + count, + locale: localeName, + other: '$count jours', + one: '1 jour', + ); + return '$_temp0'; + } + + @override + String get total => 'total'; + + @override + String get reserveThisCar => 'Réserver cette voiture'; + + @override + String get lightTheme => 'Clair'; + + @override + String get darkTheme => 'Sombre'; + + @override + String get settings => 'Paramètres'; + + @override + String get anyPrice => 'Tout prix'; + + @override + String get price => 'Prix'; + + @override + String get apply => 'Appliquer'; + + @override + String get selectAll => 'Tout sélectionner'; + + @override + String get clearAll => 'Tout effacer'; + + @override + String get pickDates => 'Choisir les dates'; + + @override + String get pickupLocation => 'Lieu de prise en charge'; + + @override + String get dropoffLocation => 'Lieu de retour'; +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..55fc75d --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'app.dart'; + +void main() { + runApp(const ProviderScope(child: CarRentalApp())); +} diff --git a/lib/widgets/error_view.dart b/lib/widgets/error_view.dart new file mode 100644 index 0000000..0777124 --- /dev/null +++ b/lib/widgets/error_view.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; + +class ErrorView extends StatelessWidget { + final String message; + final VoidCallback? onRetry; + + const ErrorView({super.key, required this.message, this.onRetry}); + + @override + Widget build(BuildContext context) { + return Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + const Icon(Icons.error_outline, size: 48, color: Color(0xFFE02424)), + const SizedBox(height: 16), + Text( + message, + textAlign: TextAlign.center, + style: const TextStyle(color: Color(0xFF6B7280)), + ), + if (onRetry != null) ...[ + const SizedBox(height: 16), + ElevatedButton(onPressed: onRetry, child: const Text('Retry')), + ], + ], + ), + ), + ); + } +} diff --git a/lib/widgets/loading_list.dart b/lib/widgets/loading_list.dart new file mode 100644 index 0000000..ba51d25 --- /dev/null +++ b/lib/widgets/loading_list.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +class LoadingList extends StatelessWidget { + final int count; + final double itemHeight; + + const LoadingList({super.key, this.count = 5, this.itemHeight = 100}); + + @override + Widget build(BuildContext context) { + return Shimmer.fromColors( + baseColor: const Color(0xFFE5E7EB), + highlightColor: const Color(0xFFF9FAFB), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: count, + separatorBuilder: (_, _) => const SizedBox(height: 12), + itemBuilder: (_, _) => Container( + height: itemHeight, + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/preferences_bar.dart b/lib/widgets/preferences_bar.dart new file mode 100644 index 0000000..906cb60 --- /dev/null +++ b/lib/widgets/preferences_bar.dart @@ -0,0 +1,89 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import '../core/providers/locale_provider.dart'; +import '../core/providers/theme_provider.dart'; + +const _orange = Color(0xFFFF6B00); + +/// Compact row of language pills + theme toggle. +/// [onDark] = true when rendered on a dark background (landing screen). +class PreferencesBar extends ConsumerWidget { + final bool onDark; + + const PreferencesBar({super.key, this.onDark = false}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final currentLocale = ref.watch(localeProvider); + final themeMode = ref.watch(themeProvider); + final isDark = themeMode == ThemeMode.dark; + + final inactiveText = onDark + ? Colors.white.withValues(alpha: 0.55) + : Theme.of(context).colorScheme.onSurfaceVariant; + final activeText = Colors.white; + final inactiveBg = onDark + ? Colors.white.withValues(alpha: 0.12) + : Theme.of(context).colorScheme.surfaceContainerHighest; + + const langs = [ + ('EN', Locale('en')), + ('FR', Locale('fr')), + ('AR', Locale('ar')), + ]; + + return Row( + mainAxisSize: MainAxisSize.min, + children: [ + // Language pills + ...langs.map((item) { + final (code, locale) = item; + final selected = + currentLocale.languageCode == locale.languageCode; + return GestureDetector( + onTap: () => ref.read(localeProvider.notifier).setLocale(locale), + child: Container( + margin: const EdgeInsets.only(right: 6), + padding: + const EdgeInsets.symmetric(horizontal: 11, vertical: 6), + decoration: BoxDecoration( + color: selected ? _orange : inactiveBg, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + code, + style: TextStyle( + color: selected ? activeText : inactiveText, + fontSize: 12, + fontWeight: + selected ? FontWeight.bold : FontWeight.normal, + ), + ), + ), + ); + }), + + const SizedBox(width: 2), + + // Theme toggle icon + GestureDetector( + onTap: () => ref.read(themeProvider.notifier).toggle(), + child: Container( + padding: const EdgeInsets.all(7), + decoration: BoxDecoration( + color: inactiveBg, + borderRadius: BorderRadius.circular(20), + ), + child: Icon( + isDark ? Icons.light_mode_outlined : Icons.dark_mode_outlined, + size: 15, + color: onDark + ? Colors.white.withValues(alpha: 0.8) + : Theme.of(context).colorScheme.onSurfaceVariant, + ), + ), + ), + ], + ); + } +} diff --git a/lib/widgets/reservation_card.dart b/lib/widgets/reservation_card.dart new file mode 100644 index 0000000..5b8dce6 --- /dev/null +++ b/lib/widgets/reservation_card.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import '../core/models/reservation.dart'; +import 'status_badge.dart'; + +class ReservationCard extends StatelessWidget { + final Reservation reservation; + final VoidCallback? onTap; + + const ReservationCard({super.key, required this.reservation, this.onTap}); + + @override + Widget build(BuildContext context) { + final fmt = DateFormat('MMM d, yyyy'); + return Card( + child: InkWell( + onTap: onTap, + borderRadius: BorderRadius.circular(12), + child: Padding( + padding: const EdgeInsets.all(14), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + reservation.vehicle?.displayName ?? 'Reservation', + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + ), + ), + StatusBadge(status: reservation.status), + ], + ), + if (reservation.customer != null) ...[ + const SizedBox(height: 4), + Text( + reservation.customer!.fullName, + style: const TextStyle( + fontSize: 13, color: Color(0xFF6B7280)), + ), + ], + const SizedBox(height: 10), + Row( + children: [ + const Icon(Icons.calendar_today, + size: 14, color: Color(0xFF9CA3AF)), + const SizedBox(width: 4), + Text( + '${fmt.format(reservation.startDate)} → ${fmt.format(reservation.endDate)}', + style: const TextStyle( + fontSize: 13, color: Color(0xFF6B7280)), + ), + ], + ), + const SizedBox(height: 6), + Row( + children: [ + const Icon(Icons.attach_money, + size: 14, color: Color(0xFF9CA3AF)), + const SizedBox(width: 4), + Text( + '\$${reservation.totalAmount.toStringAsFixed(2)}', + style: const TextStyle( + fontWeight: FontWeight.w600, + color: Color(0xFF111928), + ), + ), + const SizedBox(width: 8), + StatusBadge(status: reservation.paymentStatus), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/widgets/stat_card.dart b/lib/widgets/stat_card.dart new file mode 100644 index 0000000..d1375e4 --- /dev/null +++ b/lib/widgets/stat_card.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; + +class StatCard extends StatelessWidget { + final String title; + final String value; + final IconData icon; + final Color color; + final String? subtitle; + + const StatCard({ + super.key, + required this.title, + required this.value, + required this.icon, + required this.color, + this.subtitle, + }); + + @override + Widget build(BuildContext context) { + return Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: color.withValues(alpha: 0.1), + borderRadius: BorderRadius.circular(8), + ), + child: Icon(icon, color: color, size: 20), + ), + const Spacer(), + ], + ), + const SizedBox(height: 12), + Text( + value, + style: const TextStyle( + fontSize: 24, + fontWeight: FontWeight.bold, + color: Color(0xFF111928), + ), + ), + const SizedBox(height: 4), + Text( + title, + style: const TextStyle( + fontSize: 13, + color: Color(0xFF6B7280), + ), + ), + if (subtitle != null) ...[ + const SizedBox(height: 4), + Text( + subtitle!, + style: const TextStyle( + fontSize: 11, + color: Color(0xFF9CA3AF), + ), + ), + ], + ], + ), + ), + ); + } +} diff --git a/lib/widgets/status_badge.dart b/lib/widgets/status_badge.dart new file mode 100644 index 0000000..a45e467 --- /dev/null +++ b/lib/widgets/status_badge.dart @@ -0,0 +1,68 @@ +import 'package:flutter/material.dart'; + +class StatusBadge extends StatelessWidget { + final String status; + + const StatusBadge({super.key, required this.status}); + + @override + Widget build(BuildContext context) { + final (color, bg, label) = _style(status); + return Container( + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4), + decoration: BoxDecoration( + color: bg, + borderRadius: BorderRadius.circular(20), + ), + child: Text( + label, + style: TextStyle( + color: color, + fontSize: 12, + fontWeight: FontWeight.w600, + ), + ), + ); + } + + static (Color, Color, String) _style(String status) { + switch (status.toUpperCase()) { + case 'AVAILABLE': + return (const Color(0xFF057A55), const Color(0xFFDEF7EC), 'Available'); + case 'RENTED': + return (const Color(0xFF1A56DB), const Color(0xFFE1EFFE), 'Rented'); + case 'MAINTENANCE': + return (const Color(0xFFB45309), const Color(0xFFFDF6B2), 'Maintenance'); + case 'OUT_OF_SERVICE': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'Out of Service'); + case 'CONFIRMED': + return (const Color(0xFF057A55), const Color(0xFFDEF7EC), 'Confirmed'); + case 'ACTIVE': + return (const Color(0xFF1A56DB), const Color(0xFFE1EFFE), 'Active'); + case 'COMPLETED': + return (const Color(0xFF5521B5), const Color(0xFFEDEBFE), 'Completed'); + case 'CANCELLED': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'Cancelled'); + case 'DRAFT': + return (const Color(0xFF374151), const Color(0xFFF3F4F6), 'Draft'); + case 'NO_SHOW': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'No Show'); + case 'PENDING': + return (const Color(0xFFB45309), const Color(0xFFFDF6B2), 'Pending'); + case 'SUCCEEDED': + return (const Color(0xFF057A55), const Color(0xFFDEF7EC), 'Paid'); + case 'FAILED': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'Failed'); + case 'APPROVED': + return (const Color(0xFF057A55), const Color(0xFFDEF7EC), 'Approved'); + case 'DENIED': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'Denied'); + case 'VALID': + return (const Color(0xFF057A55), const Color(0xFFDEF7EC), 'Valid'); + case 'EXPIRED': + return (const Color(0xFF9B1C1C), const Color(0xFFFDE8E8), 'Expired'); + default: + return (const Color(0xFF374151), const Color(0xFFF3F4F6), status); + } + } +} diff --git a/lib/widgets/vehicle_card.dart b/lib/widgets/vehicle_card.dart new file mode 100644 index 0000000..4dc67ee --- /dev/null +++ b/lib/widgets/vehicle_card.dart @@ -0,0 +1,122 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/material.dart'; +import '../core/models/vehicle.dart'; +import '../core/constants/app_constants.dart'; +import 'status_badge.dart'; + +class VehicleCard extends StatelessWidget { + final Vehicle vehicle; + final VoidCallback? onTap; + + const VehicleCard({super.key, required this.vehicle, this.onTap}); + + @override + Widget build(BuildContext context) { + return Card( + clipBehavior: Clip.antiAlias, + child: InkWell( + onTap: onTap, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildImage(), + Padding( + padding: const EdgeInsets.all(12), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Expanded( + child: Text( + vehicle.displayName, + style: const TextStyle( + fontWeight: FontWeight.w600, + fontSize: 15, + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + StatusBadge(status: vehicle.status), + ], + ), + const SizedBox(height: 4), + Text( + vehicle.licensePlate, + style: const TextStyle( + fontSize: 13, + color: Color(0xFF6B7280), + ), + ), + const SizedBox(height: 8), + Row( + children: [ + const Icon(Icons.attach_money, + size: 16, color: Color(0xFF1A56DB)), + Text( + '${vehicle.dailyRate.toStringAsFixed(0)}/day', + style: const TextStyle( + fontWeight: FontWeight.w600, + color: Color(0xFF1A56DB), + ), + ), + const Spacer(), + Container( + padding: const EdgeInsets.symmetric( + horizontal: 8, vertical: 3), + decoration: BoxDecoration( + color: const Color(0xFFF3F4F6), + borderRadius: BorderRadius.circular(6), + ), + child: Text( + vehicle.category, + style: const TextStyle( + fontSize: 11, color: Color(0xFF6B7280)), + ), + ), + ], + ), + ], + ), + ), + ], + ), + ), + ); + } + + Widget _buildImage() { + final photo = vehicle.primaryPhoto; + if (photo == null) { + return Container( + height: 150, + color: const Color(0xFFF3F4F6), + child: const Center( + child: Icon(Icons.directions_car, size: 48, color: Color(0xFFD1D5DB)), + ), + ); + } + final url = photo.startsWith('http') + ? photo + : '${AppConstants.baseUrl.replaceAll('/api/v1', '')}$photo'; + return CachedNetworkImage( + imageUrl: url, + height: 150, + width: double.infinity, + fit: BoxFit.cover, + placeholder: (_, _) => Container( + height: 150, + color: const Color(0xFFF3F4F6), + child: const Center(child: CircularProgressIndicator(strokeWidth: 2)), + ), + errorWidget: (_, _, _) => Container( + height: 150, + color: const Color(0xFFF3F4F6), + child: const Center( + child: Icon(Icons.directions_car, size: 48, color: Color(0xFFD1D5DB)), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..61e18c9 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,775 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + archive: + dependency: transitive + description: + name: archive + sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff + url: "https://pub.dev" + source: hosted + version: "4.0.9" + args: + dependency: transitive + description: + name: args + sha256: d0481093c50b1da8910eb0bb301626d4d8eb7284aa739614d2b394ee09e3ea04 + url: "https://pub.dev" + source: hosted + version: "2.7.0" + async: + dependency: transitive + description: + name: async + sha256: e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + cached_network_image: + dependency: "direct main" + description: + name: cached_network_image + sha256: "7c1183e361e5c8b0a0f21a28401eecdbde252441106a9816400dd4c2b2424916" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + cached_network_image_platform_interface: + dependency: transitive + description: + name: cached_network_image_platform_interface + sha256: "35814b016e37fbdc91f7ae18c8caf49ba5c88501813f73ce8a07027a395e2829" + url: "https://pub.dev" + source: hosted + version: "4.1.1" + cached_network_image_web: + dependency: transitive + description: + name: cached_network_image_web + sha256: "980842f4e8e2535b8dbd3d5ca0b1f0ba66bf61d14cc3a17a9b4788a3685ba062" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "959525d3162f249993882720d52b7e0c833978df229be20702b33d48d91de70f" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + cli_util: + dependency: transitive + description: + name: cli_util + sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c + url: "https://pub.dev" + source: hosted + version: "0.4.2" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + code_assets: + dependency: transitive + description: + name: code_assets + sha256: dad6bf6b9f4f378b0a69edbf42584d336efd1a9ce15deb1ba591cbb1b5ff440f + url: "https://pub.dev" + source: hosted + version: "1.1.0" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf + url: "https://pub.dev" + source: hosted + version: "3.0.7" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: "41e005c33bd814be4d3096aff55b1908d419fde52ca656c8c47719ec745873cd" + url: "https://pub.dev" + source: hosted + version: "1.0.9" + dio: + dependency: "direct main" + description: + name: dio + sha256: aff32c08f92787a557dd5c0145ac91536481831a01b4648136373cddb0e64f8c + url: "https://pub.dev" + source: hosted + version: "5.9.2" + dio_web_adapter: + dependency: transitive + description: + name: dio_web_adapter + sha256: "2f9e64323a7c3c7ef69567d5c800424a11f8337b8b228bad02524c9fb3c1f340" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + equatable: + dependency: transitive + description: + name: equatable + sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b" + url: "https://pub.dev" + source: hosted + version: "2.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + file: + dependency: transitive + description: + name: file + sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + url: "https://pub.dev" + source: hosted + version: "7.0.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + url: "https://pub.dev" + source: hosted + version: "1.1.1" + fl_chart: + dependency: "direct main" + description: + name: fl_chart + sha256: "74959b99b92b9eebeed1a4049426fd67c4abc3c5a0f4d12e2877097d6a11ae08" + url: "https://pub.dev" + source: hosted + version: "0.69.2" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_cache_manager: + dependency: transitive + description: + name: flutter_cache_manager + sha256: "400b6592f16a4409a7f2bb929a9a7e38c72cceb8ffb99ee57bbf2cb2cecf8386" + url: "https://pub.dev" + source: hosted + version: "3.4.1" + flutter_launcher_icons: + dependency: "direct dev" + description: + name: flutter_launcher_icons + sha256: "10f13781741a2e3972126fae08393d3c4e01fa4cd7473326b94b72cf594195e7" + url: "https://pub.dev" + source: hosted + version: "0.14.4" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" + url: "https://pub.dev" + source: hosted + version: "6.0.0" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_riverpod: + dependency: "direct main" + description: + name: flutter_riverpod + sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" + url: "https://pub.dev" + source: hosted + version: "9.2.4" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: f02fd7d2a4dc512fec615529824fdd217fecb3a3d3de68360293a551f21634b3 + url: "https://pub.dev" + source: hosted + version: "14.8.1" + hooks: + dependency: transitive + description: + name: hooks + sha256: a41af4e8fc687cd6d33de9751eb936c8c0204ebe2bcb6c15ecf707504bf47f31 + url: "https://pub.dev" + source: hosted + version: "2.0.0" + http: + dependency: transitive + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + image: + dependency: transitive + description: + name: image + sha256: f9881ff4998044947ec38d098bc7c8316ae1186fa786eddffdb867b9bc94dfce + url: "https://pub.dev" + source: hosted + version: "4.8.0" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + jni: + dependency: transitive + description: + name: jni + sha256: c2230682d5bc2362c1c9e8d3c7f406d9cbba23ab3f2e203a025dd47e0fb2e68f + url: "https://pub.dev" + source: hosted + version: "1.0.0" + jni_flutter: + dependency: transitive + description: + name: jni_flutter + sha256: "8b59e590786050b1cd866677dddaf76b1ade5e7bc751abe04b86e84d379d3ba6" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "2a743920d81b7910627f68ee2c9ac1fc0bfee32b9fc3403587d7c6791ca12f80" + url: "https://pub.dev" + source: hosted + version: "4.12.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de" + url: "https://pub.dev" + source: hosted + version: "11.0.2" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1" + url: "https://pub.dev" + source: hosted + version: "3.0.10" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1" + url: "https://pub.dev" + source: hosted + version: "3.0.2" + lints: + dependency: transitive + description: + name: lints + sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df" + url: "https://pub.dev" + source: hosted + version: "6.1.0" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861 + url: "https://pub.dev" + source: hosted + version: "0.12.19" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b" + url: "https://pub.dev" + source: hosted + version: "0.13.0" + meta: + dependency: transitive + description: + name: meta + sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394" + url: "https://pub.dev" + source: hosted + version: "1.17.0" + mime: + dependency: transitive + description: + name: mime + sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + url: "https://pub.dev" + source: hosted + version: "2.0.0" + objective_c: + dependency: transitive + description: + name: objective_c + sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed" + url: "https://pub.dev" + source: hosted + version: "9.4.1" + octo_image: + dependency: transitive + description: + name: octo_image + sha256: "34faa6639a78c7e3cbe79be6f9f96535867e879748ade7d17c9b1ae7536293bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + package_config: + dependency: transitive + description: + name: package_config + sha256: f096c55ebb7deb7e384101542bfba8c52696c1b56fca2eb62827989ef2353bbc + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "69cbd515a62b94d32a7944f086b2f82b4ac40a1d45bebfc00813a430ab2dabcd" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699" + url: "https://pub.dev" + source: hosted + version: "2.6.0" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675" + url: "https://pub.dev" + source: hosted + version: "7.0.2" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + posix: + dependency: transitive + description: + name: posix + sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07" + url: "https://pub.dev" + source: hosted + version: "6.5.0" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + record_use: + dependency: transitive + description: + name: record_use + sha256: "2551bd8eecfe95d14ae75f6021ad0248be5c27f138c2ec12fcb52b500b3ba1ed" + url: "https://pub.dev" + source: hosted + version: "0.6.0" + riverpod: + dependency: transitive + description: + name: riverpod + sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959" + url: "https://pub.dev" + source: hosted + version: "2.6.1" + rxdart: + dependency: transitive + description: + name: rxdart + sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + url: "https://pub.dev" + source: hosted + version: "0.28.0" + shimmer: + dependency: "direct main" + description: + name: shimmer + sha256: "5f88c883a22e9f9f299e5ba0e4f7e6054857224976a5d9f839d4ebdc94a14ac9" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab" + url: "https://pub.dev" + source: hosted + version: "1.10.2" + sqflite: + dependency: transitive + description: + name: sqflite + sha256: "564cfed0746fe53140c23b70b308e045c3b31f17778f2f326ccb7d804ea0250a" + url: "https://pub.dev" + source: hosted + version: "2.4.2+1" + sqflite_android: + dependency: transitive + description: + name: sqflite_android + sha256: "881e28efdcc9950fd8e9bb42713dcf1103e62a2e7168f23c9338d82db13dec40" + url: "https://pub.dev" + source: hosted + version: "2.4.2+3" + sqflite_common: + dependency: transitive + description: + name: sqflite_common + sha256: "1581ffbf7a0e333b380d6a30737d78516b826cb35beb7fb0bf8a3ea0c678b465" + url: "https://pub.dev" + source: hosted + version: "2.5.8" + sqflite_darwin: + dependency: transitive + description: + name: sqflite_darwin + sha256: "279832e5cde3fe99e8571879498c9211f3ca6391b0d818df4e17d9fff5c6ccb3" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + sqflite_platform_interface: + dependency: transitive + description: + name: sqflite_platform_interface + sha256: "8dd4515c7bdcae0a785b0062859336de775e8c65db81ae33dd5445f35be61920" + url: "https://pub.dev" + source: hosted + version: "2.4.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + state_notifier: + dependency: transitive + description: + name: state_notifier + sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb + url: "https://pub.dev" + source: hosted + version: "1.0.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + synchronized: + dependency: transitive + description: + name: synchronized + sha256: "63896c27e81b28f8cb4e69ead0d3e8f03f1d1e5fc531a3e579cabed6a2c7c9e5" + url: "https://pub.dev" + source: hosted + version: "3.4.0+1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a" + url: "https://pub.dev" + source: hosted + version: "0.7.10" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + uuid: + dependency: transitive + description: + name: uuid + sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489" + url: "https://pub.dev" + source: hosted + version: "4.5.3" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b + url: "https://pub.dev" + source: hosted + version: "2.2.0" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0016aef94fc66495ac78af5859181e3f3bf2026bd8eecc72b9565601e19ab360" + url: "https://pub.dev" + source: hosted + version: "15.2.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e + url: "https://pub.dev" + source: hosted + version: "5.15.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + xml: + dependency: transitive + description: + name: xml + sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025" + url: "https://pub.dev" + source: hosted + version: "6.6.1" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.11.1 <4.0.0" + flutter: ">=3.38.4" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..98592f8 --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,46 @@ +name: car_rental_app +description: Car rental management app for employees and clients. +publish_to: 'none' +version: 1.0.0+1 + +environment: + sdk: ^3.11.1 + +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + cupertino_icons: ^1.0.8 + flutter_riverpod: ^2.6.1 + dio: ^5.7.0 + go_router: ^14.6.3 + flutter_secure_storage: ^9.2.2 + intl: ^0.20.2 + cached_network_image: ^3.4.1 + shimmer: ^3.0.0 + fl_chart: ^0.69.0 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^6.0.0 + flutter_launcher_icons: ^0.14.1 + +flutter_launcher_icons: + android: "launcher_icon" + ios: true + image_path: "assets/images/logo.jpeg" + min_sdk_android: 21 + web: + generate: false + windows: + generate: false + macos: + generate: false + +flutter: + generate: true + uses-material-design: true + assets: + - assets/images/ diff --git a/rentaldrivego.png b/rentaldrivego.png new file mode 100644 index 0000000..473e590 Binary files /dev/null and b/rentaldrivego.png differ diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..390e432 --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,14 @@ +// This is a basic Flutter widget test. +// +// To perform an interaction with a widget in your test, use the WidgetTester +// utility in the flutter_test package. For example, you can send tap and scroll +// gestures. You can also use WidgetTester to find child widgets in the widget +// tree, read text, and verify that the values of widget properties are correct. + +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('App smoke test', (tester) async { + expect(true, isTrue); + }); +}