diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4c612c5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# Application mobile Laverie — Android + iOS uniquement (pas de web Flutter). + +# Plateformes générées par Flutter (ne pas versionner entièrement si préféré) +/android/.gradle/ +/android/app/debug/ +/android/app/profile/ +/android/app/release/ +/android/local.properties +/android/**/GeneratedPluginRegistrant.java +/android/**/GeneratedPluginRegistrant.kt + +/ios/Pods/ +/ios/.symlinks/ +/ios/Flutter/Flutter.framework +/ios/Flutter/Flutter.podspec +/ios/Flutter/Generated.xcconfig +/ios/Flutter/ephemeral/ +/ios/Runner/GeneratedPluginRegistrant.* + +# Build +/build/ +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +*.iml + +# IDE +.idea/ +.vscode/ +*.swp + +# macOS (non ciblé) +/macos/ +/web/ +/linux/ +/windows/ diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..954d671 --- /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: "ad70ec4617166f1c38e5d2bfd388af71fda14f06" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + - platform: android + create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + - platform: ios + create_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + base_revision: ad70ec4617166f1c38e5d2bfd388af71fda14f06 + + # 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/README.md b/README.md index 83cc4a8..15dd283 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,117 @@ -# mobile +# Laverie Mobile +Application **native** Android et iOS pour Laverie Connectée — consultation des laveries, portefeuille, réservations et lavages. + +> **Pas de cible web Flutter.** Le back-office web est géré séparément (Laravel + Inertia). Cette app est mobile-first : **Android en priorité**, **iOS prévu** dès le départ (même codebase). + +## Prérequis + +| Outil | Android | iOS (plus tard) | +|-------|---------|-----------------| +| Flutter SDK 3.2+ | Oui | Oui (sur macOS) | +| Android Studio + SDK | Oui | — | +| Xcode | — | Oui (macOS uniquement) | +| Backend API | [../README.md](../README.md) | idem | + +## Installation (première fois) + +Le dépôt contient le code Dart (`lib/`) mais pas les dossiers natifs. Générez **Android + iOS uniquement** : + +### Windows (PowerShell) + +```powershell +cd mobile +.\scripts\bootstrap_platforms.ps1 +``` + +### macOS / Linux + +```bash +cd mobile +chmod +x scripts/bootstrap_platforms.sh +./scripts/bootstrap_platforms.sh +``` + +Équivalent manuel : + +```bash +flutter create . --org fr.laverie --project-name laverie_mobile --platforms=android,ios +flutter pub get +``` + +Ne pas ajouter `--platforms web` : le web Flutter est hors périmètre. + +## Lancement Android (priorité) + +```bash +# Émulateur Android (API par défaut : 10.0.2.2 = localhost hôte) +flutter run -d android + +# Appareil physique — remplacer par l'IP de votre PC +flutter run -d android --dart-define=API_BASE_URL=http://192.168.1.10:8000/api/v1 +``` + +### HTTP en développement + +L'émulateur Android autorise le trafic HTTP clair vers `10.0.2.2` via la config réseau de debug. En production, l'API doit être en **HTTPS**. + +## iOS (préparation) + +Le même projet inclut le dossier `ios/` pour une future build App Store. Nécessite **macOS + Xcode**. + +```bash +# Simulateur iOS (localhost) +flutter run -d ios + +# Appareil physique +flutter run -d ios --dart-define=API_BASE_URL=http://192.168.1.10:8000/api/v1 +``` + +Points déjà prévus côté Dart : + +- `flutter_secure_storage` avec options Keychain iOS +- URL API par défaut `127.0.0.1` sur iOS simulateur +- Détection plateforme dans `lib/core/platform/app_platform.dart` + +## Configuration API + +| Contexte | URL API | +|----------|---------| +| Android émulateur | `http://10.0.2.2:8000/api/v1` (défaut) | +| iOS simulateur | `http://127.0.0.1:8000/api/v1` (défaut) | +| Appareil physique | `--dart-define=API_BASE_URL=http://IP:8000/api/v1` | + +## Compte de démonstration + +| Email | Mot de passe | +|-------|--------------| +| marie.dupont@demo.local | password | + +## Architecture + +``` +lib/ +├── main.dart # Garde anti-web / anti-desktop +├── core/ +│ ├── platform/ # Android / iOS uniquement +│ ├── config/ # API URL, secure storage +│ ├── api/ +│ ├── auth/ +│ ├── router/ +│ └── theme/ +└── features/ + ├── auth/ + ├── home/ + ├── establishments/ + ├── wallet/ + ├── booking/ + ├── wash/ + └── profile/ +``` + +## Prochaines étapes (Android) + +1. Scan QR machine (`mobile_scanner`) → `POST /washes/start` +2. Rechargement wallet simulé +3. Notifications push (FCM Android, APNs iOS plus tard) +4. Tests `integration_test` sur émulateur Android diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..fbd24ec --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,6 @@ +include: package:flutter_lints/flutter.yaml + +linter: + rules: + prefer_const_constructors: true + prefer_const_declarations: true 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..58d3f82 --- /dev/null +++ b/android/app/build.gradle.kts @@ -0,0 +1,45 @@ +plugins { + id("com.android.application") + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id("dev.flutter.flutter-gradle-plugin") +} + +android { + namespace = "fr.laverie.laverie_mobile" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "fr.laverie.laverie_mobile" + // 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") + } + } +} + +kotlin { + compilerOptions { + jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17 + } +} + +flutter { + source = "../.." +} diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..3a94c91 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,4 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..e47ed2c --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/fr/laverie/laverie_mobile/MainActivity.kt b/android/app/src/main/kotlin/fr/laverie/laverie_mobile/MainActivity.kt new file mode 100644 index 0000000..77a072f --- /dev/null +++ b/android/app/src/main/kotlin/fr/laverie/laverie_mobile/MainActivity.kt @@ -0,0 +1,5 @@ +package fr.laverie.laverie_mobile + +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-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-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-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-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/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..e96108c --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,6 @@ +org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +# This newDsl flag was added by the Flutter template +android.newDsl=false +# This builtInKotlin flag was added by the Flutter template +android.builtInKotlin=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..2d428bf --- /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-9.1.0-all.zip diff --git a/android/settings.gradle.kts b/android/settings.gradle.kts new file mode 100644 index 0000000..c21f0c5 --- /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 "9.0.1" apply false + id("org.jetbrains.kotlin.android") version "2.3.20" apply false +} + +include(":app") 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..592ceee --- /dev/null +++ b/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig new file mode 100644 index 0000000..592ceee --- /dev/null +++ b/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 0000000..86860e7 --- /dev/null +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,644 @@ +// !$*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 */; }; + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; }; + 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 = ""; }; + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = FlutterGeneratedPluginSwiftPackage; path = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; 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 = ( + 78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 331C8082294A63A400263BE5 /* RunnerTests */ = { + isa = PBXGroup; + children = ( + 331C807B294A618700263BE5 /* RunnerTests.swift */, + ); + path = RunnerTests; + sourceTree = ""; + }; + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 78E0A7A72DC9AD7400C4905E /* FlutterGeneratedPluginSwiftPackage */, + 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; + packageProductDependencies = ( + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */, + ); + 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; + packageReferences = ( + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + ); + 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 = fr.laverie.laverieMobile; + 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 = fr.laverie.laverieMobile.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 = fr.laverie.laverieMobile.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 = fr.laverie.laverieMobile.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 = 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; + 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 = 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; + 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 = fr.laverie.laverieMobile; + 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 = fr.laverie.laverieMobile; + 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 */ + +/* Begin XCLocalSwiftPackageReference section */ + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = { + isa = XCLocalSwiftPackageReference; + relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage; + }; +/* End XCLocalSwiftPackageReference section */ + +/* Begin XCSwiftPackageProductDependency section */ + 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = { + isa = XCSwiftPackageProductDependency; + productName = FlutterGeneratedPluginSwiftPackage; + }; +/* End XCSwiftPackageProductDependency 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..c3fedb2 --- /dev/null +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..d36b1fa --- /dev/null +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "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" : "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" : "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" + } +} 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..dc9ada4 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..7353c41 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..797d452 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..6ed2d93 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..4cd7b00 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..fe73094 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..321773c 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..797d452 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..502f463 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..0ec3034 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-60x60@2x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 0000000..0ec3034 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..e9f5fea 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-76x76@1x.png b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 0000000..84ac32a 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..8953cba 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..0467bf1 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..b6c147e --- /dev/null +++ b/ios/Runner/Info.plist @@ -0,0 +1,70 @@ + + + + + CADisableMinimumFrameDurationOnPhone + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleDisplayName + Laverie Mobile + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + laverie_mobile + 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/lib/core/api/api_client.dart b/lib/core/api/api_client.dart new file mode 100644 index 0000000..6e5fd6e --- /dev/null +++ b/lib/core/api/api_client.dart @@ -0,0 +1,99 @@ +import 'package:dio/dio.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../config/app_config.dart'; +import '../auth/auth_provider.dart'; + +/// Client HTTP Dio configuré pour l'API Laverie. +class ApiClient { + ApiClient({ + required this.baseUrl, + this.getAccessToken, + this.onUnauthorized, + }) : _dio = Dio( + BaseOptions( + baseUrl: baseUrl, + connectTimeout: const Duration(seconds: 15), + receiveTimeout: const Duration(seconds: 30), + headers: { + 'Accept': 'application/json', + 'Content-Type': 'application/json', + }, + ), + ) { + _dio.interceptors.add( + InterceptorsWrapper( + onRequest: (options, handler) async { + final token = await getAccessToken?.call(); + if (token != null && token.isNotEmpty) { + options.headers['Authorization'] = 'Bearer $token'; + } + handler.next(options); + }, + onError: (error, handler) async { + if (error.response?.statusCode == 401) { + await onUnauthorized?.call(); + } + handler.next(error); + }, + ), + ); + } + + final String baseUrl; + final Future Function()? getAccessToken; + final Future Function()? onUnauthorized; + final Dio _dio; + + Dio get dio => _dio; + + Future> get( + String path, { + Map? queryParameters, + }) { + return _dio.get(path, queryParameters: queryParameters); + } + + Future> post( + String path, { + dynamic data, + Map? queryParameters, + }) { + return _dio.post(path, data: data, queryParameters: queryParameters); + } + + Future> patch( + String path, { + dynamic data, + Map? queryParameters, + }) { + return _dio.patch(path, data: data, queryParameters: queryParameters); + } + + Future> put( + String path, { + dynamic data, + Map? queryParameters, + }) { + return _dio.put(path, data: data, queryParameters: queryParameters); + } + + Future> delete( + String path, { + dynamic data, + Map? queryParameters, + }) { + return _dio.delete(path, data: data, queryParameters: queryParameters); + } +} + +/// Fournisseur Riverpod du client API (injecte le token depuis l'état auth). +final apiClientProvider = Provider((ref) { + final authNotifier = ref.read(authProvider.notifier); + + return ApiClient( + baseUrl: kApiBaseUrl, + getAccessToken: () async => ref.read(authProvider).accessToken, + onUnauthorized: () async => authNotifier.logout(), + ); +}); diff --git a/lib/core/api/api_endpoints.dart b/lib/core/api/api_endpoints.dart new file mode 100644 index 0000000..a8d9655 --- /dev/null +++ b/lib/core/api/api_endpoints.dart @@ -0,0 +1,32 @@ +/// Chemins des endpoints REST de l'API Laverie v1. +abstract final class ApiEndpoints { + // Authentification utilisateur + static const authRegister = '/auth/register'; + static const authLogin = '/auth/login'; + static const authRefresh = '/auth/refresh'; + static const authLogout = '/auth/logout'; + static const authMe = '/auth/me'; + + // Portefeuille + static const wallet = '/wallet'; + static const walletTransactions = '/wallet/transactions'; + static const walletTopUpInitiate = '/wallet/top-up/initiate'; + static const walletTopUpConfirm = '/wallet/top-up/confirm'; + + // Établissements & machines + static const establishments = '/establishments'; + static String establishment(String uuid) => '/establishments/$uuid'; + static String machine(String uuid) => '/machines/$uuid'; + static String machineAvailability(String uuid) => '/machines/$uuid/availability'; + static String machinePricing(String uuid) => '/machines/$uuid/pricing'; + + // Réservations + static const bookings = '/bookings'; + static String booking(String uuid) => '/bookings/$uuid'; + static String bookingCancel(String uuid) => '/bookings/$uuid/cancel'; + + // Lavages + static const washes = '/washes'; + static const washesStart = '/washes/start'; + static String wash(String uuid) => '/washes/$uuid'; +} diff --git a/lib/core/auth/auth_provider.dart b/lib/core/auth/auth_provider.dart new file mode 100644 index 0000000..c8b53dc --- /dev/null +++ b/lib/core/auth/auth_provider.dart @@ -0,0 +1,158 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../api/api_client.dart'; +import '../config/app_config.dart'; +import '../../features/auth/domain/auth_user.dart'; +import 'auth_repository.dart'; + +/// État d'authentification de l'application. +class AuthState { + const AuthState({ + this.user, + this.accessToken, + this.refreshToken, + this.isLoading = false, + this.error, + }); + + final AuthUser? user; + final String? accessToken; + final String? refreshToken; + final bool isLoading; + final String? error; + + bool get isAuthenticated => accessToken != null && accessToken!.isNotEmpty; + + AuthState copyWith({ + AuthUser? user, + String? accessToken, + String? refreshToken, + bool? isLoading, + String? error, + bool clearError = false, + bool clearUser = false, + }) { + return AuthState( + user: clearUser ? null : (user ?? this.user), + accessToken: accessToken ?? this.accessToken, + refreshToken: refreshToken ?? this.refreshToken, + isLoading: isLoading ?? this.isLoading, + error: clearError ? null : (error ?? this.error), + ); + } +} + +/// Gestionnaire d'état Riverpod pour l'authentification. +class AuthNotifier extends StateNotifier { + AuthNotifier(this._repository) : super(const AuthState()) { + _restoreSession(); + } + + final AuthRepository _repository; + + Future _restoreSession() async { + state = state.copyWith(isLoading: true, clearError: true); + + try { + final stored = await _repository.loadStoredTokens(); + if (stored == null) { + state = state.copyWith(isLoading: false); + return; + } + + state = state.copyWith( + accessToken: stored.accessToken, + refreshToken: stored.refreshToken, + ); + + final user = await _repository.fetchCurrentUser(); + state = state.copyWith(user: user, isLoading: false); + } catch (_) { + final refreshed = await _repository.refresh(); + if (refreshed != null) { + final user = await _repository.fetchCurrentUser(); + state = state.copyWith( + accessToken: refreshed.accessToken, + refreshToken: refreshed.refreshToken, + user: user, + isLoading: false, + ); + } else { + await _repository.clearStoredTokens(); + state = const AuthState(isLoading: false); + } + } + } + + Future login(String email, String password) async { + state = state.copyWith(isLoading: true, clearError: true); + + try { + final tokens = await _repository.login(email: email, password: password); + final user = tokens.user ?? await _repository.fetchCurrentUser(); + + state = state.copyWith( + accessToken: tokens.accessToken, + refreshToken: tokens.refreshToken, + user: user, + isLoading: false, + ); + return true; + } catch (e) { + state = state.copyWith( + isLoading: false, + error: 'Connexion impossible. Vérifiez vos identifiants.', + ); + return false; + } + } + + Future register({ + required String firstName, + required String lastName, + required String email, + required String password, + String? phone, + }) async { + state = state.copyWith(isLoading: true, clearError: true); + + try { + final tokens = await _repository.register( + firstName: firstName, + lastName: lastName, + email: email, + password: password, + phone: phone, + ); + final user = tokens.user ?? await _repository.fetchCurrentUser(); + + state = state.copyWith( + accessToken: tokens.accessToken, + refreshToken: tokens.refreshToken, + user: user, + isLoading: false, + ); + return true; + } catch (e) { + state = state.copyWith( + isLoading: false, + error: 'Inscription impossible. L\'email est peut-être déjà utilisé.', + ); + return false; + } + } + + Future logout() async { + await _repository.logout(); + state = const AuthState(); + } +} + +final authRepositoryProvider = Provider((ref) { + // Client dédié à l'auth pour éviter une dépendance circulaire avec apiClientProvider. + return AuthRepository(apiClient: ApiClient(baseUrl: kApiBaseUrl)); +}); + +final authProvider = StateNotifierProvider((ref) { + return AuthNotifier(ref.watch(authRepositoryProvider)); +}); diff --git a/lib/core/auth/auth_repository.dart b/lib/core/auth/auth_repository.dart new file mode 100644 index 0000000..74f332c --- /dev/null +++ b/lib/core/auth/auth_repository.dart @@ -0,0 +1,125 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +import '../api/api_client.dart'; +import '../api/api_endpoints.dart'; +import '../config/app_config.dart'; +import '../config/secure_storage_config.dart'; +import '../../features/auth/domain/auth_user.dart'; + +/// Dépôt d'authentification — login, inscription, refresh et logout. +class AuthRepository { + AuthRepository({ + required ApiClient apiClient, + FlutterSecureStorage? secureStorage, + }) : _apiClient = apiClient, + _secureStorage = secureStorage ?? laverieSecureStorage; + + final ApiClient _apiClient; + final FlutterSecureStorage _secureStorage; + + Future login({ + required String email, + required String password, + }) async { + final response = await _apiClient.post( + ApiEndpoints.authLogin, + data: { + 'email': email, + 'password': password, + }, + ); + + final tokens = AuthTokens.fromJson(response.data as Map); + await _persistTokens(tokens); + return tokens; + } + + Future register({ + required String firstName, + required String lastName, + required String email, + required String password, + String? phone, + }) async { + final response = await _apiClient.post( + ApiEndpoints.authRegister, + data: { + 'first_name': firstName, + 'last_name': lastName, + 'email': email, + 'password': password, + if (phone != null) 'phone': phone, + }, + ); + + final tokens = AuthTokens.fromJson(response.data as Map); + await _persistTokens(tokens); + return tokens; + } + + Future refresh() async { + final refreshToken = await _secureStorage.read(key: AuthStorageKeys.refreshToken); + if (refreshToken == null || refreshToken.isEmpty) { + return null; + } + + final response = await _apiClient.post( + ApiEndpoints.authRefresh, + data: {'refresh_token': refreshToken}, + ); + + final tokens = AuthTokens.fromJson(response.data as Map); + await _persistTokens(tokens); + return tokens; + } + + Future fetchCurrentUser() async { + final response = await _apiClient.get(ApiEndpoints.authMe); + final data = response.data; + + if (data is Map) { + if (data.containsKey('data')) { + return AuthUser.fromJson(data['data'] as Map); + } + return AuthUser.fromJson(data); + } + + return null; + } + + Future logout() async { + try { + await _apiClient.post(ApiEndpoints.authLogout); + } catch (_) { + // Déconnexion locale même si l'API est injoignable. + } + await clearStoredTokens(); + } + + Future loadStoredTokens() async { + final accessToken = await _secureStorage.read(key: AuthStorageKeys.accessToken); + final refreshToken = await _secureStorage.read(key: AuthStorageKeys.refreshToken); + + if (accessToken == null || refreshToken == null) { + return null; + } + + return AuthTokens(accessToken: accessToken, refreshToken: refreshToken); + } + + Future clearStoredTokens() async { + await _secureStorage.delete(key: AuthStorageKeys.accessToken); + await _secureStorage.delete(key: AuthStorageKeys.refreshToken); + } + + Future _persistTokens(AuthTokens tokens) async { + await _secureStorage.write( + key: AuthStorageKeys.accessToken, + value: tokens.accessToken, + ); + await _secureStorage.write( + key: AuthStorageKeys.refreshToken, + value: tokens.refreshToken, + ); + } +} diff --git a/lib/core/config/app_config.dart b/lib/core/config/app_config.dart new file mode 100644 index 0000000..c6da9b7 --- /dev/null +++ b/lib/core/config/app_config.dart @@ -0,0 +1,40 @@ +import 'dart:io' show Platform; + +import 'package:flutter/foundation.dart'; + +/// Surcharge explicite via `--dart-define=API_BASE_URL=...` +const String _envApiBaseUrl = String.fromEnvironment('API_BASE_URL'); + +/// URL de base de l'API Laverie. +/// +/// Priorité : +/// 1. `API_BASE_URL` passé en `--dart-define` +/// 2. Valeur par défaut selon la plateforme : +/// - Android émulateur : `10.0.2.2` (localhost de l'hôte) +/// - iOS simulateur : `127.0.0.1` +/// 3. Appareil physique : toujours passer `--dart-define=API_BASE_URL=http://IP:8000/api/v1` +String get kApiBaseUrl { + if (_envApiBaseUrl.isNotEmpty) { + return _envApiBaseUrl; + } + + if (kIsWeb) { + throw UnsupportedError('Le web Flutter n\'est pas supporté.'); + } + + if (Platform.isAndroid) { + return 'http://10.0.2.2:8000/api/v1'; + } + + if (Platform.isIOS) { + return 'http://127.0.0.1:8000/api/v1'; + } + + throw UnsupportedError('Plateforme non supportée.'); +} + +/// Clés de stockage sécurisé pour les jetons d'authentification. +abstract final class AuthStorageKeys { + static const accessToken = 'laverie_access_token'; + static const refreshToken = 'laverie_refresh_token'; +} diff --git a/lib/core/config/secure_storage_config.dart b/lib/core/config/secure_storage_config.dart new file mode 100644 index 0000000..b46ef1f --- /dev/null +++ b/lib/core/config/secure_storage_config.dart @@ -0,0 +1,14 @@ +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +/// Configuration du stockage sécurisé adaptée Android / iOS. +/// +/// Android : SharedPreferences chiffrées (Keystore). +/// iOS : Keychain avec accessibilité au premier déverrouillage. +const FlutterSecureStorage laverieSecureStorage = FlutterSecureStorage( + aOptions: AndroidOptions( + encryptedSharedPreferences: true, + ), + iOptions: IOSOptions( + accessibility: KeychainAccessibility.first_unlock, + ), +); diff --git a/lib/core/platform/app_platform.dart b/lib/core/platform/app_platform.dart new file mode 100644 index 0000000..88728cc --- /dev/null +++ b/lib/core/platform/app_platform.dart @@ -0,0 +1,39 @@ +import 'dart:io' show Platform; + +import 'package:flutter/foundation.dart'; + +/// Plateformes supportées par l'application (mobile natif uniquement, pas de web). +enum AppPlatform { + android, + ios, +} + +/// Indique si la plateforme courante est supportée (Android ou iOS). +bool get isMobilePlatformSupported { + if (kIsWeb) { + return false; + } + return Platform.isAndroid || Platform.isIOS; +} + +/// Plateforme courante. Lance une exception si web ou desktop. +AppPlatform get currentAppPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'Laverie Mobile ne cible pas le web. Utilisez Android ou iOS.', + ); + } + if (Platform.isAndroid) { + return AppPlatform.android; + } + if (Platform.isIOS) { + return AppPlatform.ios; + } + throw UnsupportedError( + 'Plateforme non supportée. Cible : Android (prioritaire) et iOS.', + ); +} + +bool get isAndroid => !kIsWeb && Platform.isAndroid; + +bool get isIos => !kIsWeb && Platform.isIOS; diff --git a/lib/core/router/app_router.dart b/lib/core/router/app_router.dart new file mode 100644 index 0000000..0f62cd7 --- /dev/null +++ b/lib/core/router/app_router.dart @@ -0,0 +1,96 @@ +import 'package:flutter/material.dart'; +import 'package:go_router/go_router.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../auth/auth_provider.dart'; +import '../../features/auth/presentation/login_screen.dart'; +import '../../features/auth/presentation/register_screen.dart'; +import '../../features/home/presentation/home_screen.dart'; +import '../../features/establishments/presentation/establishment_detail_screen.dart'; +import '../../features/wallet/presentation/wallet_screen.dart'; +import '../../features/booking/presentation/bookings_screen.dart'; +import '../../features/wash/presentation/wash_screen.dart'; +import '../../features/profile/presentation/profile_screen.dart'; + +/// Routes nommées de l'application. +abstract final class AppRoutes { + static const login = '/login'; + static const register = '/register'; + static const home = '/'; + static const wallet = '/wallet'; + static const bookings = '/bookings'; + static const washes = '/washes'; + static const profile = '/profile'; + static const establishment = '/establishments/:uuid'; +} + +/// Configuration GoRouter avec redirection selon l'état d'authentification. +final appRouterProvider = Provider((ref) { + final authState = ref.watch(authProvider); + + return GoRouter( + initialLocation: AppRoutes.home, + refreshListenable: GoRouterRefreshStream(ref), + redirect: (context, state) { + final isAuthenticated = authState.isAuthenticated; + final isAuthRoute = state.matchedLocation == AppRoutes.login || + state.matchedLocation == AppRoutes.register; + + if (!isAuthenticated && !isAuthRoute) { + return AppRoutes.login; + } + + if (isAuthenticated && isAuthRoute) { + return AppRoutes.home; + } + + return null; + }, + routes: [ + GoRoute( + path: AppRoutes.login, + builder: (context, state) => const LoginScreen(), + ), + GoRoute( + path: AppRoutes.register, + builder: (context, state) => const RegisterScreen(), + ), + GoRoute( + path: AppRoutes.home, + builder: (context, state) => const HomeScreen(), + ), + GoRoute( + path: AppRoutes.establishment, + builder: (context, state) { + final uuid = state.pathParameters['uuid']!; + return EstablishmentDetailScreen(establishmentUuid: uuid); + }, + ), + GoRoute( + path: AppRoutes.wallet, + builder: (context, state) => const WalletScreen(), + ), + GoRoute( + path: AppRoutes.bookings, + builder: (context, state) => const BookingsScreen(), + ), + GoRoute( + path: AppRoutes.washes, + builder: (context, state) => const WashScreen(), + ), + GoRoute( + path: AppRoutes.profile, + builder: (context, state) => const ProfileScreen(), + ), + ], + ); +}); + +/// Écoute les changements Riverpod pour rafraîchir les redirections GoRouter. +class GoRouterRefreshStream extends ChangeNotifier { + GoRouterRefreshStream(this._ref) { + _ref.listen(authProvider, (_, __) => notifyListeners()); + } + + final Ref _ref; +} diff --git a/lib/core/theme/app_theme.dart b/lib/core/theme/app_theme.dart new file mode 100644 index 0000000..58ff41a --- /dev/null +++ b/lib/core/theme/app_theme.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; + +/// Thème visuel de l'application Laverie. +class AppTheme { + AppTheme._(); + + static const Color _primary = Color(0xFF1565C0); + static const Color _secondary = Color(0xFF26A69A); + + static ThemeData get light { + final colorScheme = ColorScheme.fromSeed( + seedColor: _primary, + secondary: _secondary, + brightness: Brightness.light, + ); + + return ThemeData( + useMaterial3: true, + colorScheme: colorScheme, + appBarTheme: AppBarTheme( + centerTitle: true, + backgroundColor: colorScheme.primary, + foregroundColor: colorScheme.onPrimary, + elevation: 0, + ), + cardTheme: CardThemeData( + elevation: 1, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + inputDecorationTheme: InputDecorationTheme( + border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)), + filled: true, + ), + elevatedButtonTheme: ElevatedButtonThemeData( + style: ElevatedButton.styleFrom( + minimumSize: const Size.fromHeight(48), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + ), + floatingActionButtonTheme: FloatingActionButtonThemeData( + backgroundColor: colorScheme.secondary, + foregroundColor: colorScheme.onSecondary, + ), + ); + } +} diff --git a/lib/features/auth/domain/auth_user.dart b/lib/features/auth/domain/auth_user.dart new file mode 100644 index 0000000..39c5f5a --- /dev/null +++ b/lib/features/auth/domain/auth_user.dart @@ -0,0 +1,53 @@ +/// Modèle utilisateur authentifié. +class AuthUser { + const AuthUser({ + required this.uuid, + required this.firstName, + required this.lastName, + required this.email, + this.phone, + this.locale = 'fr', + }); + + final String uuid; + final String firstName; + final String lastName; + final String email; + final String? phone; + final String locale; + + String get fullName => '$firstName $lastName'.trim(); + + factory AuthUser.fromJson(Map json) { + return AuthUser( + uuid: json['uuid'] as String, + firstName: json['first_name'] as String? ?? '', + lastName: json['last_name'] as String? ?? '', + email: json['email'] as String, + phone: json['phone'] as String?, + locale: json['locale'] as String? ?? 'fr', + ); + } +} + +/// Réponse d'authentification (login / register / refresh). +class AuthTokens { + const AuthTokens({ + required this.accessToken, + required this.refreshToken, + this.user, + }); + + final String accessToken; + final String refreshToken; + final AuthUser? user; + + factory AuthTokens.fromJson(Map json) { + final userJson = json['user'] as Map?; + return AuthTokens( + accessToken: json['access_token'] as String? ?? json['token'] as String, + refreshToken: json['refresh_token'] as String, + user: userJson != null ? AuthUser.fromJson(userJson) : null, + ); + } +} diff --git a/lib/features/auth/presentation/login_screen.dart b/lib/features/auth/presentation/login_screen.dart new file mode 100644 index 0000000..c5f0805 --- /dev/null +++ b/lib/features/auth/presentation/login_screen.dart @@ -0,0 +1,131 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../core/auth/auth_provider.dart'; +import '../../../core/router/app_router.dart'; + +/// Écran de connexion utilisateur. +class LoginScreen extends ConsumerStatefulWidget { + const LoginScreen({super.key}); + + @override + ConsumerState createState() => _LoginScreenState(); +} + +class _LoginScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _emailController = TextEditingController(text: 'marie.dupont@demo.local'); + final _passwordController = TextEditingController(text: 'password'); + + @override + void dispose() { + _emailController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!_formKey.currentState!.validate()) return; + + final success = await ref.read(authProvider.notifier).login( + _emailController.text.trim(), + _passwordController.text, + ); + + if (success && mounted) { + context.go(AppRoutes.home); + } + } + + @override + Widget build(BuildContext context) { + final authState = ref.watch(authProvider); + + return Scaffold( + body: SafeArea( + child: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.all(24), + child: Form( + key: _formKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Icon(Icons.local_laundry_service, size: 72, color: Theme.of(context).colorScheme.primary), + const SizedBox(height: 16), + Text( + 'Laverie Connectée', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.headlineMedium, + ), + const SizedBox(height: 8), + Text( + 'Connectez-vous pour réserver et laver', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyMedium, + ), + const SizedBox(height: 32), + TextFormField( + controller: _emailController, + keyboardType: TextInputType.emailAddress, + decoration: const InputDecoration( + labelText: 'Email', + prefixIcon: Icon(Icons.email_outlined), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Email requis'; + } + return null; + }, + ), + const SizedBox(height: 16), + TextFormField( + controller: _passwordController, + obscureText: true, + decoration: const InputDecoration( + labelText: 'Mot de passe', + prefixIcon: Icon(Icons.lock_outline), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Mot de passe requis'; + } + return null; + }, + ), + if (authState.error != null) ...[ + const SizedBox(height: 12), + Text( + authState.error!, + style: TextStyle(color: Theme.of(context).colorScheme.error), + textAlign: TextAlign.center, + ), + ], + const SizedBox(height: 24), + ElevatedButton( + onPressed: authState.isLoading ? null : _submit, + child: authState.isLoading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Text('Se connecter'), + ), + const SizedBox(height: 12), + TextButton( + onPressed: () => context.push(AppRoutes.register), + child: const Text('Créer un compte'), + ), + ], + ), + ), + ), + ), + ), + ); + } +} diff --git a/lib/features/auth/presentation/register_screen.dart b/lib/features/auth/presentation/register_screen.dart new file mode 100644 index 0000000..c711f17 --- /dev/null +++ b/lib/features/auth/presentation/register_screen.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/auth/auth_provider.dart'; +import '../../../core/router/app_router.dart'; + +/// Écran d'inscription utilisateur. +class RegisterScreen extends ConsumerStatefulWidget { + const RegisterScreen({super.key}); + + @override + ConsumerState createState() => _RegisterScreenState(); +} + +class _RegisterScreenState extends ConsumerState { + final _formKey = GlobalKey(); + final _firstNameController = TextEditingController(); + final _lastNameController = TextEditingController(); + final _emailController = TextEditingController(); + final _phoneController = TextEditingController(); + final _passwordController = TextEditingController(); + + @override + void dispose() { + _firstNameController.dispose(); + _lastNameController.dispose(); + _emailController.dispose(); + _phoneController.dispose(); + _passwordController.dispose(); + super.dispose(); + } + + Future _submit() async { + if (!_formKey.currentState!.validate()) return; + + final success = await ref.read(authProvider.notifier).register( + firstName: _firstNameController.text.trim(), + lastName: _lastNameController.text.trim(), + email: _emailController.text.trim(), + password: _passwordController.text, + phone: _phoneController.text.trim().isEmpty + ? null + : _phoneController.text.trim(), + ); + + if (success && mounted) { + context.go(AppRoutes.home); + } + } + + @override + Widget build(BuildContext context) { + final authState = ref.watch(authProvider); + + return Scaffold( + appBar: AppBar(title: const Text('Inscription')), + body: SafeArea( + child: SingleChildScrollView( + padding: const EdgeInsets.all(24), + child: Form( + key: _formKey, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + TextFormField( + controller: _firstNameController, + decoration: const InputDecoration(labelText: 'Prénom'), + validator: (v) => v == null || v.isEmpty ? 'Prénom requis' : null, + ), + const SizedBox(height: 12), + TextFormField( + controller: _lastNameController, + decoration: const InputDecoration(labelText: 'Nom'), + validator: (v) => v == null || v.isEmpty ? 'Nom requis' : null, + ), + const SizedBox(height: 12), + TextFormField( + controller: _emailController, + keyboardType: TextInputType.emailAddress, + decoration: const InputDecoration(labelText: 'Email'), + validator: (v) => v == null || v.isEmpty ? 'Email requis' : null, + ), + const SizedBox(height: 12), + TextFormField( + controller: _phoneController, + keyboardType: TextInputType.phone, + decoration: const InputDecoration(labelText: 'Téléphone (optionnel)'), + ), + const SizedBox(height: 12), + TextFormField( + controller: _passwordController, + obscureText: true, + decoration: const InputDecoration(labelText: 'Mot de passe'), + validator: (v) { + if (v == null || v.length < 8) { + return 'Minimum 8 caractères'; + } + return null; + }, + ), + if (authState.error != null) ...[ + const SizedBox(height: 12), + Text( + authState.error!, + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + ], + const SizedBox(height: 24), + ElevatedButton( + onPressed: authState.isLoading ? null : _submit, + child: authState.isLoading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator(strokeWidth: 2), + ) + : const Text('S\'inscrire'), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/features/booking/domain/booking.dart b/lib/features/booking/domain/booking.dart new file mode 100644 index 0000000..ce2b7cd --- /dev/null +++ b/lib/features/booking/domain/booking.dart @@ -0,0 +1,38 @@ +/// Modèle réservation de créneau machine. +class Booking { + const Booking({ + required this.uuid, + required this.machineUuid, + required this.machineName, + required this.slotStart, + required this.slotEnd, + required this.status, + this.bookingFee = 0, + }); + + final String uuid; + final String machineUuid; + final String machineName; + final DateTime? slotStart; + final DateTime? slotEnd; + final String status; + final double bookingFee; + + factory Booking.fromJson(Map json) { + final machine = json['machine'] as Map?; + + return Booking( + uuid: json['uuid'] as String, + machineUuid: machine?['uuid'] as String? ?? json['machine_uuid'] as String? ?? '', + machineName: machine?['name'] as String? ?? 'Machine', + slotStart: json['slot_start'] != null + ? DateTime.tryParse(json['slot_start'] as String) + : null, + slotEnd: json['slot_end'] != null + ? DateTime.tryParse(json['slot_end'] as String) + : null, + status: json['status'] as String? ?? 'pending', + bookingFee: (json['booking_fee'] as num?)?.toDouble() ?? 0, + ); + } +} diff --git a/lib/features/booking/presentation/bookings_screen.dart b/lib/features/booking/presentation/bookings_screen.dart new file mode 100644 index 0000000..3c796c0 --- /dev/null +++ b/lib/features/booking/presentation/bookings_screen.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; + +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../domain/booking.dart'; + +/// Fournisseur des réservations de l'utilisateur connecté. +final bookingsProvider = FutureProvider>((ref) async { + final response = await ref.watch(apiClientProvider).get(ApiEndpoints.bookings); + final data = response.data; + + List list; + if (data is List) { + list = data; + } else if (data is Map && data['data'] is List) { + list = data['data'] as List; + } else { + list = []; + } + + return list + .map((json) => Booking.fromJson(json as Map)) + .toList(); +}); + +/// Écran listant les réservations de l'utilisateur. +class BookingsScreen extends ConsumerWidget { + const BookingsScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final bookingsAsync = ref.watch(bookingsProvider); + + return Scaffold( + appBar: AppBar(title: const Text('Mes réservations')), + body: bookingsAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, _) => Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Erreur : $error'), + const SizedBox(height: 12), + ElevatedButton( + onPressed: () => ref.invalidate(bookingsProvider), + child: const Text('Réessayer'), + ), + ], + ), + ), + data: (bookings) { + if (bookings.isEmpty) { + return const Center( + child: Text('Aucune réservation.\nRéservez un créneau depuis une laverie.'), + ); + } + + return RefreshIndicator( + onRefresh: () async => ref.invalidate(bookingsProvider), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: bookings.length, + separatorBuilder: (_, __) => const SizedBox(height: 8), + itemBuilder: (context, index) { + final booking = bookings[index]; + return Card( + child: ListTile( + leading: const Icon(Icons.event), + title: Text(booking.machineName), + subtitle: Text( + booking.slotStart != null + ? DateFormat('dd/MM/yyyy HH:mm').format(booking.slotStart!) + : 'Créneau à confirmer', + ), + trailing: Chip(label: Text(booking.status)), + ), + ); + }, + ), + ); + }, + ), + ); + } +} diff --git a/lib/features/establishments/data/establishment_repository.dart b/lib/features/establishments/data/establishment_repository.dart new file mode 100644 index 0000000..682c14f --- /dev/null +++ b/lib/features/establishments/data/establishment_repository.dart @@ -0,0 +1,58 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../domain/establishment.dart'; + +/// Dépôt de données pour les établissements et machines. +class EstablishmentRepository { + EstablishmentRepository(this._apiClient); + + final ApiClient _apiClient; + + Future> fetchEstablishments() async { + final response = await _apiClient.get(ApiEndpoints.establishments); + final data = _extractList(response.data); + + return data + .map((json) => Establishment.fromJson(json as Map)) + .toList(); + } + + Future fetchEstablishment(String uuid) async { + final response = await _apiClient.get(ApiEndpoints.establishment(uuid)); + final json = _extractObject(response.data); + return Establishment.fromJson(json); + } + + List _extractList(dynamic data) { + if (data is List) return data; + if (data is Map && data['data'] is List) { + return data['data'] as List; + } + return []; + } + + Map _extractObject(dynamic data) { + if (data is Map) { + if (data['data'] is Map) { + return data['data'] as Map; + } + return data; + } + throw StateError('Réponse API inattendue'); + } +} + +final establishmentRepositoryProvider = Provider((ref) { + return EstablishmentRepository(ref.watch(apiClientProvider)); +}); + +final establishmentsProvider = FutureProvider>((ref) async { + return ref.watch(establishmentRepositoryProvider).fetchEstablishments(); +}); + +final establishmentDetailProvider = + FutureProvider.family((ref, uuid) async { + return ref.watch(establishmentRepositoryProvider).fetchEstablishment(uuid); +}); diff --git a/lib/features/establishments/domain/establishment.dart b/lib/features/establishments/domain/establishment.dart new file mode 100644 index 0000000..da0db53 --- /dev/null +++ b/lib/features/establishments/domain/establishment.dart @@ -0,0 +1,110 @@ +/// Modèle établissement (laverie). +class Establishment { + const Establishment({ + required this.uuid, + required this.name, + required this.address, + this.city, + this.zipCode, + this.latitude, + this.longitude, + this.isActive = true, + this.machines = const [], + }); + + final String uuid; + final String name; + final String address; + final String? city; + final String? zipCode; + final double? latitude; + final double? longitude; + final bool isActive; + final List machines; + + String get fullAddress { + final parts = [address, zipCode, city].where((p) => p != null && p.isNotEmpty); + return parts.join(', '); + } + + factory Establishment.fromJson(Map json) { + final machinesJson = json['machines'] as List? ?? []; + + return Establishment( + uuid: json['uuid'] as String, + name: json['name'] as String, + address: json['address'] as String? ?? '', + city: json['city'] as String?, + zipCode: json['zip_code'] as String?, + latitude: (json['latitude'] as num?)?.toDouble(), + longitude: (json['longitude'] as num?)?.toDouble(), + isActive: json['is_active'] as bool? ?? true, + machines: machinesJson + .map((m) => Machine.fromJson(m as Map)) + .toList(), + ); + } +} + +/// Modèle machine (lave-linge / sèche-linge). +class Machine { + const Machine({ + required this.uuid, + required this.name, + required this.type, + required this.status, + this.qrCode, + }); + + final String uuid; + final String name; + final String type; + final String status; + final String? qrCode; + + bool get isAvailable => status == 'available'; + + String get typeLabel { + switch (type) { + case 'washer_small': + return 'Lave-linge petit'; + case 'washer_large': + return 'Lave-linge grand'; + case 'dryer_small': + return 'Sèche-linge petit'; + case 'dryer_large': + return 'Sèche-linge grand'; + default: + return type; + } + } + + String get statusLabel { + switch (status) { + case 'available': + return 'Disponible'; + case 'reserved': + return 'Réservée'; + case 'running': + return 'En cours'; + case 'maintenance': + return 'Maintenance'; + case 'offline': + return 'Hors ligne'; + case 'error': + return 'Erreur'; + default: + return status; + } + } + + factory Machine.fromJson(Map json) { + return Machine( + uuid: json['uuid'] as String, + name: json['name'] as String, + type: json['type'] as String, + status: json['status'] as String, + qrCode: json['qr_code'] as String?, + ); + } +} diff --git a/lib/features/establishments/presentation/establishment_detail_screen.dart b/lib/features/establishments/presentation/establishment_detail_screen.dart new file mode 100644 index 0000000..2cbcd83 --- /dev/null +++ b/lib/features/establishments/presentation/establishment_detail_screen.dart @@ -0,0 +1,113 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../establishments/data/establishment_repository.dart'; +import '../../establishments/domain/establishment.dart'; + +/// Écran de détail d'un établissement avec liste des machines. +class EstablishmentDetailScreen extends ConsumerWidget { + const EstablishmentDetailScreen({ + super.key, + required this.establishmentUuid, + }); + + final String establishmentUuid; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final establishmentAsync = + ref.watch(establishmentDetailProvider(establishmentUuid)); + + return Scaffold( + appBar: AppBar(title: const Text('Détail laverie')), + body: establishmentAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, _) => Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Erreur : $error'), + const SizedBox(height: 12), + ElevatedButton( + onPressed: () => + ref.invalidate(establishmentDetailProvider(establishmentUuid)), + child: const Text('Réessayer'), + ), + ], + ), + ), + data: (establishment) => _EstablishmentBody(establishment: establishment), + ), + ); + } +} + +class _EstablishmentBody extends StatelessWidget { + const _EstablishmentBody({required this.establishment}); + + final Establishment establishment; + + @override + Widget build(BuildContext context) { + return ListView( + padding: const EdgeInsets.all(16), + children: [ + Text( + establishment.name, + style: Theme.of(context).textTheme.headlineSmall, + ), + const SizedBox(height: 4), + Text(establishment.fullAddress), + const SizedBox(height: 24), + Text( + 'Machines (${establishment.machines.length})', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + if (establishment.machines.isEmpty) + const Text('Aucune machine disponible') + else + ...establishment.machines.map((machine) => _MachineTile(machine: machine)), + ], + ); + } +} + +class _MachineTile extends StatelessWidget { + const _MachineTile({required this.machine}); + + final Machine machine; + + Color _statusColor(BuildContext context) { + switch (machine.status) { + case 'available': + return Colors.green; + case 'running': + return Colors.blue; + case 'reserved': + return Colors.orange; + case 'maintenance': + case 'offline': + return Colors.red; + default: + return Colors.grey; + } + } + + @override + Widget build(BuildContext context) { + return Card( + child: ListTile( + leading: Icon( + machine.type.startsWith('washer') ? Icons.water_drop : Icons.air, + color: _statusColor(context), + ), + title: Text(machine.name), + subtitle: Text('${machine.typeLabel} — ${machine.statusLabel}'), + trailing: machine.isAvailable + ? const Chip(label: Text('Libre')) + : null, + ), + ); + } +} diff --git a/lib/features/home/presentation/home_screen.dart b/lib/features/home/presentation/home_screen.dart new file mode 100644 index 0000000..2b6c9d4 --- /dev/null +++ b/lib/features/home/presentation/home_screen.dart @@ -0,0 +1,106 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../core/router/app_router.dart'; +import '../../establishments/data/establishment_repository.dart'; + +/// Écran d'accueil — liste des laveries à proximité. +class HomeScreen extends ConsumerWidget { + const HomeScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final establishmentsAsync = ref.watch(establishmentsProvider); + + return Scaffold( + appBar: AppBar( + title: const Text('Laveries'), + actions: [ + IconButton( + icon: const Icon(Icons.account_balance_wallet_outlined), + onPressed: () => context.push(AppRoutes.wallet), + ), + IconButton( + icon: const Icon(Icons.person_outline), + onPressed: () => context.push(AppRoutes.profile), + ), + ], + ), + body: establishmentsAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, _) => Center( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.cloud_off, size: 48), + const SizedBox(height: 12), + Text( + 'Impossible de charger les laveries.\nVérifiez que l\'API est démarrée.', + textAlign: TextAlign.center, + style: Theme.of(context).textTheme.bodyLarge, + ), + const SizedBox(height: 16), + ElevatedButton( + onPressed: () => ref.invalidate(establishmentsProvider), + child: const Text('Réessayer'), + ), + ], + ), + ), + ), + data: (establishments) { + if (establishments.isEmpty) { + return const Center(child: Text('Aucune laverie disponible')); + } + + return RefreshIndicator( + onRefresh: () async => ref.invalidate(establishmentsProvider), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: establishments.length, + separatorBuilder: (_, __) => const SizedBox(height: 8), + itemBuilder: (context, index) { + final establishment = establishments[index]; + return Card( + child: ListTile( + leading: CircleAvatar( + child: Text(establishment.name.substring(0, 1)), + ), + title: Text(establishment.name), + subtitle: Text(establishment.fullAddress), + trailing: const Icon(Icons.chevron_right), + onTap: () => context.push('/establishments/${establishment.uuid}'), + ), + ); + }, + ), + ); + }, + ), + bottomNavigationBar: NavigationBar( + selectedIndex: 0, + onDestinationSelected: (index) { + switch (index) { + case 0: + context.go(AppRoutes.home); + case 1: + context.push(AppRoutes.bookings); + case 2: + context.push(AppRoutes.washes); + case 3: + context.push(AppRoutes.wallet); + } + }, + destinations: const [ + NavigationDestination(icon: Icon(Icons.store), label: 'Laveries'), + NavigationDestination(icon: Icon(Icons.event), label: 'Réservations'), + NavigationDestination(icon: Icon(Icons.local_laundry_service), label: 'Lavages'), + NavigationDestination(icon: Icon(Icons.wallet), label: 'Wallet'), + ], + ), + ); + } +} diff --git a/lib/features/profile/presentation/profile_screen.dart b/lib/features/profile/presentation/profile_screen.dart new file mode 100644 index 0000000..9b8f41e --- /dev/null +++ b/lib/features/profile/presentation/profile_screen.dart @@ -0,0 +1,82 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:go_router/go_router.dart'; + +import '../../../core/auth/auth_provider.dart'; +import '../../../core/router/app_router.dart'; + +/// Écran profil utilisateur et déconnexion. +class ProfileScreen extends ConsumerWidget { + const ProfileScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final authState = ref.watch(authProvider); + final user = authState.user; + + return Scaffold( + appBar: AppBar(title: const Text('Mon profil')), + body: ListView( + padding: const EdgeInsets.all(16), + children: [ + Card( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + children: [ + CircleAvatar( + radius: 40, + child: Text( + user != null && user.firstName.isNotEmpty + ? user.firstName.substring(0, 1).toUpperCase() + : '?', + style: const TextStyle(fontSize: 32), + ), + ), + const SizedBox(height: 16), + Text( + user?.fullName ?? 'Utilisateur', + style: Theme.of(context).textTheme.titleLarge, + ), + if (user?.email != null) ...[ + const SizedBox(height: 4), + Text(user!.email), + ], + ], + ), + ), + ), + const SizedBox(height: 16), + ListTile( + leading: const Icon(Icons.language), + title: const Text('Langue'), + subtitle: Text(user?.locale ?? 'fr'), + ), + ListTile( + leading: const Icon(Icons.notifications_outlined), + title: const Text('Notifications'), + onTap: () { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Préférences — à implémenter')), + ); + }, + ), + const Divider(), + ListTile( + leading: Icon(Icons.logout, color: Theme.of(context).colorScheme.error), + title: Text( + 'Se déconnecter', + style: TextStyle(color: Theme.of(context).colorScheme.error), + ), + onTap: () async { + await ref.read(authProvider.notifier).logout(); + if (context.mounted) { + context.go(AppRoutes.login); + } + }, + ), + ], + ), + ); + } +} diff --git a/lib/features/wallet/data/wallet_repository.dart b/lib/features/wallet/data/wallet_repository.dart new file mode 100644 index 0000000..58d29d8 --- /dev/null +++ b/lib/features/wallet/data/wallet_repository.dart @@ -0,0 +1,58 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; + +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../domain/wallet.dart'; + +/// Dépôt de données pour le portefeuille électronique. +class WalletRepository { + WalletRepository(this._apiClient); + + final ApiClient _apiClient; + + Future fetchWallet() async { + final response = await _apiClient.get(ApiEndpoints.wallet); + final json = _extractObject(response.data); + return Wallet.fromJson(json); + } + + Future> fetchTransactions() async { + final response = await _apiClient.get(ApiEndpoints.walletTransactions); + final list = _extractList(response.data); + + return list + .map((json) => WalletTransaction.fromJson(json as Map)) + .toList(); + } + + List _extractList(dynamic data) { + if (data is List) return data; + if (data is Map && data['data'] is List) { + return data['data'] as List; + } + return []; + } + + Map _extractObject(dynamic data) { + if (data is Map) { + if (data['data'] is Map) { + return data['data'] as Map; + } + return data; + } + throw StateError('Réponse API inattendue'); + } +} + +final walletRepositoryProvider = Provider((ref) { + return WalletRepository(ref.watch(apiClientProvider)); +}); + +final walletProvider = FutureProvider((ref) async { + return ref.watch(walletRepositoryProvider).fetchWallet(); +}); + +final walletTransactionsProvider = + FutureProvider>((ref) async { + return ref.watch(walletRepositoryProvider).fetchTransactions(); +}); diff --git a/lib/features/wallet/domain/wallet.dart b/lib/features/wallet/domain/wallet.dart new file mode 100644 index 0000000..1eaa580 --- /dev/null +++ b/lib/features/wallet/domain/wallet.dart @@ -0,0 +1,49 @@ +/// Modèle portefeuille électronique. +class Wallet { + const Wallet({ + required this.currency, + required this.currentBalance, + this.status = 'active', + }); + + final String currency; + final double currentBalance; + final String status; + + factory Wallet.fromJson(Map json) { + return Wallet( + currency: json['currency'] as String? ?? 'EUR', + currentBalance: (json['current_balance'] as num?)?.toDouble() ?? 0, + status: json['status'] as String? ?? 'active', + ); + } +} + +/// Mouvement sur le portefeuille. +class WalletTransaction { + const WalletTransaction({ + required this.uuid, + required this.type, + required this.amount, + required this.balanceAfter, + required this.createdAt, + }); + + final String uuid; + final String type; + final double amount; + final double balanceAfter; + final DateTime? createdAt; + + factory WalletTransaction.fromJson(Map json) { + return WalletTransaction( + uuid: json['uuid'] as String, + type: json['type'] as String, + amount: (json['amount'] as num?)?.toDouble() ?? 0, + balanceAfter: (json['balance_after'] as num?)?.toDouble() ?? 0, + createdAt: json['created_at'] != null + ? DateTime.tryParse(json['created_at'] as String) + : null, + ); + } +} diff --git a/lib/features/wallet/presentation/wallet_screen.dart b/lib/features/wallet/presentation/wallet_screen.dart new file mode 100644 index 0000000..ed8c754 --- /dev/null +++ b/lib/features/wallet/presentation/wallet_screen.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; + +import '../data/wallet_repository.dart'; + +/// Écran du portefeuille électronique — solde et historique. +class WalletScreen extends ConsumerWidget { + const WalletScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final walletAsync = ref.watch(walletProvider); + final transactionsAsync = ref.watch(walletTransactionsProvider); + final currencyFormat = NumberFormat.currency(locale: 'fr_FR', symbol: '€'); + + return Scaffold( + appBar: AppBar(title: const Text('Mon portefeuille')), + body: RefreshIndicator( + onRefresh: () async { + ref.invalidate(walletProvider); + ref.invalidate(walletTransactionsProvider); + }, + child: ListView( + padding: const EdgeInsets.all(16), + children: [ + walletAsync.when( + loading: () => const Card( + child: Padding( + padding: EdgeInsets.all(24), + child: Center(child: CircularProgressIndicator()), + ), + ), + error: (error, _) => Card( + child: Padding( + padding: const EdgeInsets.all(16), + child: Text('Erreur solde : $error'), + ), + ), + data: (wallet) => Card( + child: Padding( + padding: const EdgeInsets.all(24), + child: Column( + children: [ + Text( + 'Solde disponible', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + Text( + currencyFormat.format(wallet.currentBalance), + style: Theme.of(context).textTheme.displaySmall?.copyWith( + color: Theme.of(context).colorScheme.primary, + fontWeight: FontWeight.bold, + ), + ), + ], + ), + ), + ), + ), + const SizedBox(height: 24), + Text( + 'Historique', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + transactionsAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, _) => Text('Erreur historique : $error'), + data: (transactions) { + if (transactions.isEmpty) { + return const Text('Aucune transaction pour le moment'); + } + + return Column( + children: transactions.map((tx) { + final isCredit = tx.type == 'credit' || tx.type == 'refund'; + return Card( + child: ListTile( + leading: Icon( + isCredit ? Icons.add_circle_outline : Icons.remove_circle_outline, + color: isCredit ? Colors.green : Colors.red, + ), + title: Text(tx.type), + subtitle: tx.createdAt != null + ? Text(DateFormat('dd/MM/yyyy HH:mm').format(tx.createdAt!)) + : null, + trailing: Text( + '${isCredit ? '+' : '-'}${currencyFormat.format(tx.amount)}', + style: TextStyle( + fontWeight: FontWeight.bold, + color: isCredit ? Colors.green : Colors.red, + ), + ), + ), + ); + }).toList(), + ); + }, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Rechargement — à connecter à l\'API')), + ); + }, + icon: const Icon(Icons.add), + label: const Text('Recharger'), + ), + ); + } +} diff --git a/lib/features/wash/domain/wash.dart b/lib/features/wash/domain/wash.dart new file mode 100644 index 0000000..46e4de4 --- /dev/null +++ b/lib/features/wash/domain/wash.dart @@ -0,0 +1,41 @@ +/// Modèle lavage (cycle en cours ou terminé). +class Wash { + const Wash({ + required this.uuid, + required this.machineUuid, + required this.machineName, + required this.status, + required this.cost, + this.startedAt, + this.endedAt, + this.durationMinutes, + }); + + final String uuid; + final String machineUuid; + final String machineName; + final String status; + final double cost; + final DateTime? startedAt; + final DateTime? endedAt; + final int? durationMinutes; + + factory Wash.fromJson(Map json) { + final machine = json['machine'] as Map?; + + return Wash( + uuid: json['uuid'] as String, + machineUuid: machine?['uuid'] as String? ?? json['machine_uuid'] as String? ?? '', + machineName: machine?['name'] as String? ?? 'Machine', + status: json['status'] as String? ?? 'pending_start', + cost: (json['cost'] as num?)?.toDouble() ?? 0, + startedAt: json['started_at'] != null + ? DateTime.tryParse(json['started_at'] as String) + : null, + endedAt: json['ended_at'] != null + ? DateTime.tryParse(json['ended_at'] as String) + : null, + durationMinutes: json['duration_minutes'] as int?, + ); + } +} diff --git a/lib/features/wash/presentation/wash_screen.dart b/lib/features/wash/presentation/wash_screen.dart new file mode 100644 index 0000000..7a6c645 --- /dev/null +++ b/lib/features/wash/presentation/wash_screen.dart @@ -0,0 +1,104 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:intl/intl.dart'; + +import '../../../core/api/api_client.dart'; +import '../../../core/api/api_endpoints.dart'; +import '../domain/wash.dart'; + +/// Fournisseur de l'historique des lavages. +final washesProvider = FutureProvider>((ref) async { + final response = await ref.watch(apiClientProvider).get(ApiEndpoints.washes); + final data = response.data; + + List list; + if (data is List) { + list = data; + } else if (data is Map && data['data'] is List) { + list = data['data'] as List; + } else { + list = []; + } + + return list.map((json) => Wash.fromJson(json as Map)).toList(); +}); + +/// Écran historique et démarrage de lavage. +class WashScreen extends ConsumerWidget { + const WashScreen({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final washesAsync = ref.watch(washesProvider); + + return Scaffold( + appBar: AppBar(title: const Text('Mes lavages')), + body: washesAsync.when( + loading: () => const Center(child: CircularProgressIndicator()), + error: (error, _) => Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('Erreur : $error'), + const SizedBox(height: 12), + ElevatedButton( + onPressed: () => ref.invalidate(washesProvider), + child: const Text('Réessayer'), + ), + ], + ), + ), + data: (washes) { + if (washes.isEmpty) { + return const Center( + child: Text( + 'Aucun lavage enregistré.\nScannez un QR code pour démarrer un cycle.', + textAlign: TextAlign.center, + ), + ); + } + + final currencyFormat = NumberFormat.currency(locale: 'fr_FR', symbol: '€'); + + return RefreshIndicator( + onRefresh: () async => ref.invalidate(washesProvider), + child: ListView.separated( + padding: const EdgeInsets.all(16), + itemCount: washes.length, + separatorBuilder: (_, __) => const SizedBox(height: 8), + itemBuilder: (context, index) { + final wash = washes[index]; + return Card( + child: ListTile( + leading: const Icon(Icons.local_laundry_service), + title: Text(wash.machineName), + subtitle: wash.startedAt != null + ? Text(DateFormat('dd/MM/yyyy HH:mm').format(wash.startedAt!)) + : null, + trailing: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Text(currencyFormat.format(wash.cost)), + Text(wash.status, style: Theme.of(context).textTheme.bodySmall), + ], + ), + ), + ); + }, + ), + ); + }, + ), + floatingActionButton: FloatingActionButton.extended( + onPressed: () { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('Scan QR — à connecter à l\'API /washes/start')), + ); + }, + icon: const Icon(Icons.qr_code_scanner), + label: const Text('Scanner'), + ), + ); + } +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..2061303 --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_localizations/flutter_localizations.dart'; + +import 'core/platform/app_platform.dart'; +import 'core/router/app_router.dart'; +import 'core/theme/app_theme.dart'; + +void main() { + WidgetsFlutterBinding.ensureInitialized(); + + if (!isMobilePlatformSupported) { + throw UnsupportedError( + 'Laverie Mobile cible Android et iOS uniquement (pas de web Flutter).', + ); + } + + runApp(const ProviderScope(child: LaverieApp())); +} + +/// Point d'entrée de l'application mobile Laverie Connectée. +class LaverieApp extends ConsumerWidget { + const LaverieApp({super.key}); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final router = ref.watch(appRouterProvider); + + return MaterialApp.router( + title: 'Laverie Connectée', + debugShowCheckedModeBanner: false, + theme: AppTheme.light, + locale: const Locale('fr', 'FR'), + supportedLocales: const [Locale('fr', 'FR')], + localizationsDelegates: const [ + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + routerConfig: router, + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..9acbb37 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,551 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + 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" + characters: + dependency: transitive + description: + name: characters + sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b + url: "https://pub.dev" + source: hosted + version: "1.4.1" + 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: bf394f466ba9205f1812a0433b392d6af280f155f56651eda7c18cc32ed493b8 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + 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" + 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" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.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: "9a62a50b50b769a737bc0a8ff381f333529df3ab746b2f6b02e83760231455ba" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + 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" + 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: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + 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: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349" + url: "https://pub.dev" + source: hosted + version: "1.18.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" + 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: a7f4874f987173da295a61c181b8ee71dab59b332a486b391babf26a1b884825 + url: "https://pub.dev" + source: hosted + version: "2.1.6" + 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: "58c2005f147315b11e9b4a7bc889cd5203e250cba8e3f012dae259b4972b5c16" + url: "https://pub.dev" + source: hosted + version: "2.2.2" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "484838772624c3a4b94f1e44a3e19897fee738f2d5c4ce448443b0417f7c9dda" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + 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" + 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" + 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" + 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" + 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: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e" + url: "https://pub.dev" + source: hosted + version: "0.7.11" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + 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" + yaml: + dependency: transitive + description: + name: yaml + sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce + url: "https://pub.dev" + source: hosted + version: "3.1.3" +sdks: + dart: ">=3.10.3 <4.0.0" + flutter: ">=3.38.4" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..9146b3c --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,30 @@ +name: laverie_mobile +description: > + Application mobile native Laverie Connectée (Android + iOS). + Pas de cible web Flutter — Android en priorité, iOS préparé. +publish_to: 'none' +version: 1.0.0+1 + +environment: + sdk: '>=3.2.0 <4.0.0' + +dependencies: + flutter: + sdk: flutter + flutter_localizations: + sdk: flutter + cupertino_icons: ^1.0.8 + flutter_riverpod: ^2.6.1 + go_router: ^14.8.1 + dio: ^5.8.0+1 + flutter_secure_storage: ^9.2.4 + intl: ^0.20.2 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^5.0.0 + +flutter: + uses-material-design: true + # Plateformes : android + ios uniquement (générées via scripts/bootstrap_platforms.*) diff --git a/scripts/bootstrap_platforms.ps1 b/scripts/bootstrap_platforms.ps1 new file mode 100644 index 0000000..e79f085 --- /dev/null +++ b/scripts/bootstrap_platforms.ps1 @@ -0,0 +1,36 @@ +# Génère les dossiers plateforme Android + iOS uniquement (sans web). +# À exécuter une fois après clone, depuis le dossier mobile/. + +$ErrorActionPreference = "Stop" + +if (-not (Get-Command flutter -ErrorAction SilentlyContinue)) { + Write-Error "Flutter n'est pas dans le PATH. Installez-le : https://docs.flutter.dev/get-started/install/windows" +} + +Write-Host "Génération des plateformes Android et iOS (sans web)..." -ForegroundColor Cyan + +flutter create . ` + --org fr.laverie ` + --project-name laverie_mobile ` + --platforms android,ios + +flutter pub get + +# Autoriser HTTP clair en debug (API locale sans HTTPS) +$debugManifest = "android/app/src/debug/AndroidManifest.xml" +if (Test-Path $debugManifest) { + @" + + + + +"@ | Set-Content -Path $debugManifest -Encoding UTF8 + Write-Host "Android debug : cleartext HTTP activé ($debugManifest)" -ForegroundColor DarkGray +} + +Write-Host "" +Write-Host "Terminé. Lancez sur Android :" -ForegroundColor Green +Write-Host " flutter run -d android" +Write-Host "" +Write-Host "Sur appareil physique, précisez l'IP du backend :" -ForegroundColor Yellow +Write-Host " flutter run -d android --dart-define=API_BASE_URL=http://192.168.x.x:8000/api/v1" diff --git a/scripts/bootstrap_platforms.sh b/scripts/bootstrap_platforms.sh new file mode 100644 index 0000000..eac0230 --- /dev/null +++ b/scripts/bootstrap_platforms.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Génère les dossiers plateforme Android + iOS uniquement (sans web). +set -euo pipefail + +cd "$(dirname "$0")/.." + +if ! command -v flutter &>/dev/null; then + echo "Flutter introuvable. https://docs.flutter.dev/get-started/install" + exit 1 +fi + +echo "Génération des plateformes Android et iOS (sans web)..." + +flutter create . \ + --org fr.laverie \ + --project-name laverie_mobile \ + --platforms android,ios + +flutter pub get + +# Autoriser HTTP clair en debug (API locale) +DEBUG_MANIFEST="android/app/src/debug/AndroidManifest.xml" +if [ -f "$DEBUG_MANIFEST" ]; then + cat > "$DEBUG_MANIFEST" <<'EOF' + + + + +EOF + echo "Android debug : cleartext HTTP activé" +fi + +echo "" +echo "Android : flutter run -d android" +echo "iOS (macOS) : flutter run -d ios" diff --git a/test/widget_test.dart b/test/widget_test.dart new file mode 100644 index 0000000..f9495fe --- /dev/null +++ b/test/widget_test.dart @@ -0,0 +1,30 @@ +// 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/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:laverie_mobile/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(const MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +}