Première grosse version fonctionnel

This commit is contained in:
2026-04-22 23:30:31 +02:00
commit ccbe5ad801
329 changed files with 29518 additions and 0 deletions
+45
View File
@@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/
/coverage/
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json
# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
+45
View File
@@ -0,0 +1,45 @@
# 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: "db50e20168db8fee486b9abf32fc912de3bc5b6a"
channel: "stable"
project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: android
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: ios
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: linux
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: macos
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: web
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
- platform: windows
create_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
base_revision: db50e20168db8fee486b9abf32fc912de3bc5b6a
# 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'
+84
View File
@@ -0,0 +1,84 @@
# CESIZen - Application Mobile (Flutter)
CESIZen est une application de gestion de la santé mentale développée avec Flutter. Elle permet aux utilisateurs de suivre leur état émotionnel, de réaliser des diagnostics de stress et de pratiquer des exercices de relaxation.
## 🚀 Fonctionnalités
- **Authentification Sécurisée** : Connexion et inscription via une API Laravel (JWT).
- **Espace Santé Personnel** : Modification du profil (Nom, Email, Mot de passe).
- **Diagnostic de Stress** : Basé sur l'échelle de **Holmes et Rahe** (données dynamiques via API).
- **Tracker d'Émotions** : Journal de bord complet (CRUD) pour suivre son humeur.
- **Cohérence Cardiaque** : Exercice de respiration guidé (5s inspiration / 5s expiration).
- **Catalogue Détente** : Activités de relaxation (Méditation, Musique) filtrables par catégorie.
---
## 🛠️ Installation et Lancement
### 1. Prérequis
- [Flutter SDK](https://docs.flutter.dev/get-started/install) (dernière version stable recommandée).
- [Android Studio](https://developer.android.com/studio) ou [VS Code](https://code.visualstudio.com/).
- Un émulateur Android ou un appareil physique avec le débogage USB activé.
### 2. Récupération du projet
```bash
git clone <url-du-depot>
cd CESIZen/mobile
```
### 3. Installation des dépendances
```bash
flutter pub get
```
---
## 🌐 Configuration de l'API
L'application communique avec un backend Laravel.
### URL de l'API
La configuration se trouve dans `lib/core/network/dio_client.dart`.
- **URL actuelle** : `https://apicesizen.sam-coffre.duckdns.org/api`
### Compatibilité et Sécurité (SSL Bypass)
Pour faciliter le développement sur des serveurs avec des certificats auto-signés ou en cours de configuration, le client `Dio` est configuré pour **ignorer les erreurs de certificat SSL**.
Dans `lib/core/network/dio_client.dart` :
```dart
// Le code inclut un SecurityContext qui accepte tous les certificats
(dio.httpClientAdapter as IOHttpClientAdapter).createHttpClient = () {
final client = HttpClient();
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
return client;
};
```
**Note importante :** Sur Android, assurez-vous que `android:usesCleartextTraffic="true"` est bien présent dans le `AndroidManifest.xml` si vous repassez en HTTP simple.
---
## 🏃 Lancer l'application
Pour lancer l'application en mode debug :
```bash
flutter run
```
Pour générer un APK de test :
```bash
flutter build apk --debug
```
## 📂 Structure du Projet
- `lib/core/` : Configuration réseau (Dio) et thèmes.
- `lib/features/auth/` : Gestion de l'authentification et du profil.
- `lib/features/diagnostics/` : Logique du questionnaire Holmes & Rahe.
- `lib/features/tracker/` : Journal des émotions (CRUD).
- `lib/features/exercises/` : Exercice de cohérence cardiaque.
- `lib/features/relaxation/` : Catalogue d'activités de détente.
---
© 2024 CESIZen - Projet CDA
+28
View File
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.
# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
+14
View File
@@ -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
+47
View File
@@ -0,0 +1,47 @@
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}
android {
namespace = "com.cesizen.app"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
}
defaultConfig {
applicationId = "com.cesizen.app"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}
dependencies {
implementation("com.google.android.gms:play-services-wearable:18.0.0")
}
flutter {
source = "../.."
}
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
@@ -0,0 +1,55 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<application
android:label="CESIZen"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:usesCleartextTraffic="true">
<activity
android:name="com.cesizen.app.MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.wearable.capabilities"
android:resource="@xml/wearable_app_values" />
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<package android:name="com.google.android.wearable.app" />
<package android:name="com.cesizen.app" />
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
@@ -0,0 +1,108 @@
package com.cesizen.app
import android.util.Log
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.MethodChannel
import com.google.android.gms.wearable.Wearable
import com.google.android.gms.wearable.PutDataMapRequest
import com.google.android.gms.wearable.CapabilityClient
import com.google.android.gms.tasks.Tasks
import org.json.JSONObject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
class MainActivity : FlutterActivity() {
private val CHANNEL = "com.cesizen/wearable"
private val TAG = "CESIZen_Mobile_Native"
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL).setMethodCallHandler { call, result ->
when (call.method) {
"sendAuthStatus" -> {
val status = call.argument<String>("status")
val userName = call.argument<String>("userName")
updateWearDataLayer(status, userName)
result.success(true)
}
"syncMood" -> {
val mood = call.argument<String>("mood")
updateMoodDataLayer(mood)
result.success(true)
}
"isWatchNearby" -> {
CoroutineScope(Dispatchers.IO).launch {
try {
val capabilityInfo = Tasks.await(
Wearable.getCapabilityClient(this@MainActivity)
.getCapability("cesizen_wear_app", CapabilityClient.FILTER_ALL)
)
val isNearby = capabilityInfo.nodes.isNotEmpty()
runOnUiThread { result.success(isNearby) }
} catch (e: Exception) {
runOnUiThread { result.success(false) }
}
}
}
else -> {
result.notImplemented()
}
}
}
// Écouter les messages de la montre
Wearable.getMessageClient(this).addListener { messageEvent ->
Log.d(TAG, "Message received from watch: ${messageEvent.path}")
if (messageEvent.path == "/wearable_communication") {
try {
val dataString = String(messageEvent.data)
Log.d(TAG, "Payload: $dataString")
val json = JSONObject(dataString)
val command = json.optString("command")
runOnUiThread {
val messenger = flutterEngine.dartExecutor.binaryMessenger
when (command) {
"get_sync_data" -> {
Log.d(TAG, "Command: get_sync_data -> calling requestStatusUpdate")
MethodChannel(messenger, CHANNEL).invokeMethod("requestStatusUpdate", null)
}
"save_mood" -> {
val mood = json.optString("mood")
Log.d(TAG, "Command: save_mood ($mood) -> calling saveMoodFromWear")
MethodChannel(messenger, CHANNEL).invokeMethod("saveMoodFromWear", mapOf("mood" to mood))
updateMoodDataLayer(mood)
}
}
}
} catch (e: Exception) {
Log.e(TAG, "Error processing message", e)
}
}
}
}
private fun updateWearDataLayer(status: String?, userName: String?) {
val request = PutDataMapRequest.create("/auth_status")
request.dataMap.putString("status", status ?: "unauthenticated")
request.dataMap.putString("userName", userName ?: "")
request.dataMap.putLong("timestamp", System.currentTimeMillis())
val putDataRequest = request.asPutDataRequest().setUrgent()
Wearable.getDataClient(this).putDataItem(putDataRequest)
}
private fun updateMoodDataLayer(mood: String?) {
val request = PutDataMapRequest.create("/daily_mood")
val today = java.text.SimpleDateFormat("yyyy-MM-dd", java.util.Locale.getDefault()).format(java.util.Date())
request.dataMap.putString("mood", mood ?: "")
request.dataMap.putString("date", today)
request.dataMap.putLong("timestamp", System.currentTimeMillis())
val putDataRequest = request.asPutDataRequest().setUrgent()
Wearable.getDataClient(this).putDataItem(putDataRequest)
}
}
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<capability name="cesizen_handheld_app" />
</resources>
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
+24
View File
@@ -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<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
+2
View File
@@ -0,0 +1,2 @@
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-all.zip
+26
View File
@@ -0,0 +1,26 @@
pluginManagement {
val flutterSdkPath =
run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.11.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.20" apply false
}
include(":app")
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

+34
View File
@@ -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
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
</dict>
</plist>
+1
View File
@@ -0,0 +1 @@
#include "Generated.xcconfig"
+1
View File
@@ -0,0 +1 @@
#include "Generated.xcconfig"
+620
View File
@@ -0,0 +1,620 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 331C807B294A618700263BE5 /* RunnerTests.swift */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
331C8085294A63A400263BE5 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
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 = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7884E8672EC3CC0400C636F2 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
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 = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
331C8082294A63A400263BE5 /* RunnerTests */ = {
isa = PBXGroup;
children = (
331C807B294A618700263BE5 /* RunnerTests.swift */,
);
path = RunnerTests;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
331C8081294A63A400263BE5 /* RunnerTests.xctest */,
);
name = Products;
sourceTree = "<group>";
};
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 = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
331C8080294A63A400263BE5 /* RunnerTests */ = {
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
);
buildRules = (
);
dependencies = (
331C8086294A63A400263BE5 /* PBXTargetDependency */,
);
name = RunnerTests;
productName = RunnerTests;
productReference = 331C8081294A63A400263BE5 /* RunnerTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
331C8080294A63A400263BE5 = {
CreatedOnToolsVersion = 14.0;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 9.3";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
331C8080294A63A400263BE5 /* RunnerTests */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
331C807F294A63A400263BE5 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
331C807D294A63A400263BE5 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
331C808B294A63AB00263BE5 /* RunnerTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
7884E8682EC3CC0700C636F2 /* SceneDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
331C8086294A63A400263BE5 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 331C8085294A63A400263BE5 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* 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 = com.example.mobile;
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 = com.example.mobile.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 = com.example.mobile.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 = com.example.mobile.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 = com.example.mobile;
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 = com.example.mobile;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */ = {
isa = XCConfigurationList;
buildConfigurations = (
331C8088294A63A400263BE5 /* Debug */,
331C8089294A63A400263BE5 /* Release */,
331C808A294A63A400263BE5 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "331C8080294A63A400263BE5"
BuildableName = "RunnerTests.xctest"
BlueprintName = "RunnerTests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
customLLDBInitFile = "$(SRCROOT)/Flutter/ephemeral/flutter_lldbinit"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>
+16
View File
@@ -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)
}
}
@@ -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"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -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"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 B

@@ -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.
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
+70
View File
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>Mobile</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>mobile</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneClassName</key>
<string>UIWindowScene</string>
<key>UISceneConfigurationName</key>
<string>flutter</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
<key>UISceneStoryboardFile</key>
<string>Main</string>
</dict>
</array>
</dict>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
@@ -0,0 +1 @@
#import "GeneratedPluginRegistrant.h"
+6
View File
@@ -0,0 +1,6 @@
import Flutter
import UIKit
class SceneDelegate: FlutterSceneDelegate {
}
+12
View File
@@ -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.
}
}
+44
View File
@@ -0,0 +1,44 @@
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:dio/io.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
class DioClient {
final Dio _dio = Dio();
final FlutterSecureStorage _storage = const FlutterSecureStorage();
DioClient() {
// On enlève le slash final ici
_dio.options.baseUrl = "https://apicesizen.sam-coffre.duckdns.org/api";
_dio.options.connectTimeout = const Duration(seconds: 10);
_dio.options.receiveTimeout = const Duration(seconds: 10);
_dio.options.headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
};
// Bypass SSL pour éviter l'erreur "unknown" sur certains certificats DuckDNS/Let's Encrypt
_dio.httpClientAdapter = IOHttpClientAdapter(
createHttpClient: () {
final client = HttpClient();
client.badCertificateCallback = (X509Certificate cert, String host, int port) => true;
return client;
},
);
_dio.interceptors.add(InterceptorsWrapper(
onRequest: (options, handler) async {
String? token = await _storage.read(key: 'token');
if (token != null) {
options.headers['Authorization'] = 'Bearer $token';
}
return handler.next(options);
},
onError: (DioException e, handler) {
return handler.next(e);
},
));
}
Dio get dio => _dio;
}
+27
View File
@@ -0,0 +1,27 @@
class User {
final int id;
final String name;
final String email;
User({
required this.id,
required this.name,
required this.email,
});
factory User.fromJson(Map<String, dynamic> json) {
return User(
id: json['id'],
name: json['name'],
email: json['email'],
);
}
Map<String, dynamic> toJson() {
return {
'id': id,
'name': name,
'email': email,
};
}
}
@@ -0,0 +1,127 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import '../models/user.dart';
import '../services/auth_service.dart';
class AuthProvider with ChangeNotifier {
final AuthService _authService = AuthService();
static const _platform = MethodChannel('com.cesizen/wearable');
User? _user;
bool _isLoading = false;
String? _errorMessage;
AuthProvider() {
// Écouter les demandes de mise à jour venant de la couche native (montre -> téléphone)
_platform.setMethodCallHandler((call) async {
if (call.method == "requestStatusUpdate") {
_syncWithWear();
}
});
// Tenter de restaurer la session au lancement
_checkInitialAuth();
}
Future<void> _checkInitialAuth() async {
_isLoading = true;
notifyListeners();
final result = await _authService.getProfile();
if (result['status'] == 'success') {
_user = result['user'];
_syncWithWear();
}
_isLoading = false;
notifyListeners();
}
User? get user => _user;
bool get isLoading => _isLoading;
String? get errorMessage => _errorMessage;
bool get isAuthenticated => _user != null;
void _syncWithWear() {
try {
_platform.invokeMethod('sendAuthStatus', {
'status': isAuthenticated ? 'authenticated' : 'unauthenticated',
'userName': _user?.name ?? '',
});
} catch (e) {
// Échec silencieux si pas d'appareil Wear OS à proximité
debugPrint("Wear OS sync failed: $e");
}
}
Future<bool> login(String email, String password) async {
_isLoading = true;
_errorMessage = null;
notifyListeners();
final result = await _authService.login(email, password);
_isLoading = false;
if (result['status'] == 'success') {
_user = result['user'];
_syncWithWear();
notifyListeners();
return true;
} else {
_errorMessage = result['message'];
notifyListeners();
return false;
}
}
Future<bool> register(String name, String email, String password, String passwordConfirmation) async {
_isLoading = true;
_errorMessage = null;
notifyListeners();
final result = await _authService.register(name, email, password, passwordConfirmation);
_isLoading = false;
if (result['status'] == 'success') {
_user = result['user'];
_syncWithWear();
notifyListeners();
return true;
} else {
if (result['errors'] is Map) {
_errorMessage = (result['errors'] as Map).values.first[0];
} else {
_errorMessage = result['errors'].toString();
}
notifyListeners();
return false;
}
}
Future<void> logout() async {
await _authService.logout();
_user = null;
_syncWithWear();
notifyListeners();
}
Future<bool> updateProfile(String name, String email, {String? password}) async {
_isLoading = true;
_errorMessage = null;
notifyListeners();
final result = await _authService.updateProfile(name, email, password: password);
_isLoading = false;
if (result['status'] == 'success') {
_user = result['user'];
_syncWithWear();
notifyListeners();
return true;
} else {
_errorMessage = result['message'];
notifyListeners();
return false;
}
}
}
@@ -0,0 +1,124 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
import 'register_screen.dart';
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State<LoginScreen> createState() => _LoginScreenState();
}
class _LoginScreenState extends State<LoginScreen> {
final _formKey = GlobalKey<FormState>();
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
@override
void dispose() {
_emailController.dispose();
_passwordController.dispose();
super.dispose();
}
void _login() async {
if (_formKey.currentState!.validate()) {
final authProvider = Provider.of<AuthProvider>(context, listen: false);
final success = await authProvider.login(
_emailController.text,
_passwordController.text,
);
if (success) {
// Rediriger vers l'accueil ou le dashboard
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Connexion réussie')),
);
Navigator.of(context).pop(); // Retourne à l'écran précédent (HomeScreen)
}
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(authProvider.errorMessage ?? 'Échec de la connexion')),
);
}
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Connexion CESIZen')),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Bienvenue sur CESIZen',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
const SizedBox(height: 32),
TextFormField(
controller: _emailController,
decoration: const InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.email),
),
keyboardType: TextInputType.emailAddress,
validator: (value) {
if (value == null || value.isEmpty) return 'Veuillez entrer votre email';
if (!value.contains('@')) return 'Email invalide';
return null;
},
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
decoration: const InputDecoration(
labelText: 'Mot de passe',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.lock),
),
obscureText: true,
validator: (value) {
if (value == null || value.isEmpty) return 'Veuillez entrer votre mot de passe';
return null;
},
),
const SizedBox(height: 24),
Consumer<AuthProvider>(
builder: (context, auth, child) {
return auth.isLoading
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: _login,
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
),
child: const Text('Se connecter'),
);
},
),
TextButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => const RegisterScreen()),
);
},
child: const Text("Pas encore de compte ? S'inscrire"),
),
],
),
),
),
);
}
}
@@ -0,0 +1,267 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
import '../../tracker/providers/emotion_provider.dart';
import 'package:intl/intl.dart';
class ProfileScreen extends StatefulWidget {
const ProfileScreen({super.key});
@override
State<ProfileScreen> createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
final _formKey = GlobalKey<FormState>();
late TextEditingController _nameController;
late TextEditingController _emailController;
late TextEditingController _passwordController;
late String _currentEmail;
bool _isEditing = false;
@override
void initState() {
super.initState();
final user = Provider.of<AuthProvider>(context, listen: false).user;
_currentEmail = user?.email ?? '';
_nameController = TextEditingController(text: user?.name);
_emailController = TextEditingController(text: _currentEmail);
_passwordController = TextEditingController();
_emailController.addListener(() {
if (mounted) setState(() {});
});
// Charger les émotions pour le journal
WidgetsBinding.instance.addPostFrameCallback((_) {
Provider.of<EmotionProvider>(context, listen: false).loadEmotions();
});
}
@override
void dispose() {
_nameController.dispose();
_emailController.dispose();
_passwordController.dispose();
super.dispose();
}
void _submitUpdate() async {
if (_formKey.currentState!.validate()) {
final authProvider = Provider.of<AuthProvider>(context, listen: false);
final String newName = _nameController.text.trim();
final String newEmail = _emailController.text.trim();
final String? newPassword = _passwordController.text.isNotEmpty ? _passwordController.text : null;
final success = await authProvider.updateProfile(
newName,
newEmail,
password: newPassword,
);
if (mounted) {
if (success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Profil mis à jour avec succès')),
);
setState(() {
_isEditing = false;
_currentEmail = newEmail;
_passwordController.clear();
});
} else {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(authProvider.errorMessage ?? 'Erreur lors de la mise à jour')),
);
}
}
}
}
@override
Widget build(BuildContext context) {
final authProvider = Provider.of<AuthProvider>(context);
final emotionProvider = Provider.of<EmotionProvider>(context);
final user = authProvider.user;
final bool emailChanged = _emailController.text.trim() != _currentEmail.trim();
return Scaffold(
appBar: AppBar(
title: const Text('Mon Espace Santé'),
backgroundColor: Colors.white,
elevation: 0,
actions: [
IconButton(
icon: Icon(_isEditing ? Icons.close : Icons.edit),
onPressed: () {
setState(() {
_isEditing = !_isEditing;
if (!_isEditing) {
_nameController.text = user?.name ?? '';
_emailController.text = user?.email ?? '';
_passwordController.clear();
}
});
},
)
],
),
body: SingleChildScrollView(
child: Column(
children: [
// Section Profil
Padding(
padding: const EdgeInsets.all(24.0),
child: Form(
key: _formKey,
child: Column(
children: [
const CircleAvatar(
radius: 50,
backgroundColor: Color(0xFF000080),
child: Icon(Icons.person, size: 50, color: Colors.white),
),
const SizedBox(height: 20),
TextFormField(
controller: _nameController,
enabled: _isEditing,
decoration: const InputDecoration(
labelText: 'Nom',
prefixIcon: Icon(Icons.person_outline),
border: OutlineInputBorder(),
),
validator: (value) => (value == null || value.trim().isEmpty) ? 'Veuillez entrer un nom' : null,
),
const SizedBox(height: 15),
TextFormField(
controller: _emailController,
enabled: _isEditing,
decoration: const InputDecoration(
labelText: 'Email',
prefixIcon: Icon(Icons.email_outlined),
border: OutlineInputBorder(),
),
validator: (value) {
final email = value?.trim() ?? '';
if (email.isEmpty) return 'Veuillez entrer un email';
if (!email.contains('@')) return 'Email invalide';
return null;
},
),
if (_isEditing) ...[
const SizedBox(height: 15),
TextFormField(
controller: _passwordController,
obscureText: true,
decoration: InputDecoration(
labelText: emailChanged ? 'Mot de passe requis' : 'Nouveau mot de passe',
prefixIcon: const Icon(Icons.lock_outline),
border: const OutlineInputBorder(),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: authProvider.isLoading ? null : _submitUpdate,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF000080),
foregroundColor: Colors.white,
minimumSize: const Size.fromHeight(50),
),
child: const Text('ENREGISTRER'),
),
],
],
),
),
),
// Section Journal Émotionnel (Le "Journal Santé")
Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 16),
color: Colors.grey.shade50,
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Journal Émotionnel',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold, color: Color(0xFF000080)),
),
Text('Historique de vos saisies (Mobile & Montre)', style: TextStyle(color: Colors.grey, fontSize: 12)),
],
),
),
if (emotionProvider.isLoading)
const Padding(
padding: EdgeInsets.all(20.0),
child: CircularProgressIndicator(),
)
else if (emotionProvider.entries.isEmpty)
const Padding(
padding: EdgeInsets.all(40.0),
child: Column(
children: [
Icon(Icons.history, size: 48, color: Colors.grey),
SizedBox(height: 10),
Text('Aucun historique pour le moment.', style: TextStyle(color: Colors.grey)),
],
),
)
else
ListView.separated(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: emotionProvider.entries.length,
separatorBuilder: (context, index) => const Divider(height: 1),
itemBuilder: (context, index) {
final entry = emotionProvider.entries[index];
final dateStr = DateFormat('dd/MM/yyyy HH:mm').format(entry.createdAt);
return ListTile(
leading: _getMoodEmoji(entry.emotion),
title: Text(entry.emotion, style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text(entry.note ?? 'Saisie rapide'),
trailing: Text(dateStr, style: const TextStyle(fontSize: 11, color: Colors.grey)),
);
},
),
const SizedBox(height: 100), // Espace pour le scroll
],
),
),
);
}
Widget _getMoodEmoji(String mood) {
String emoji = "😐";
Color color = Colors.grey;
switch (mood) {
case 'Très bien':
emoji = "😊";
color = const Color(0xFF4CAF50);
break;
case 'Bien':
emoji = "🙂";
color = const Color(0xFF8BC34A);
break;
case 'Neutre':
emoji = "😐";
color = const Color(0xFFFFC107);
break;
case 'Pas top':
emoji = "🙁";
color = const Color(0xFFFF9800);
break;
case 'Stressé':
emoji = "😫";
color = const Color(0xFFF44336);
break;
}
return CircleAvatar(
backgroundColor: color.withOpacity(0.1),
child: Text(emoji, style: const TextStyle(fontSize: 20)),
);
}
}
@@ -0,0 +1,132 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/auth_provider.dart';
class RegisterScreen extends StatefulWidget {
const RegisterScreen({super.key});
@override
State<RegisterScreen> createState() => _RegisterScreenState();
}
class _RegisterScreenState extends State<RegisterScreen> {
final _formKey = GlobalKey<FormState>();
final _nameController = TextEditingController();
final _emailController = TextEditingController();
final _passwordController = TextEditingController();
final _confirmPasswordController = TextEditingController();
@override
void dispose() {
_nameController.dispose();
_emailController.dispose();
_passwordController.dispose();
_confirmPasswordController.dispose();
super.dispose();
}
void _register() async {
if (_formKey.currentState!.validate()) {
final authProvider = Provider.of<AuthProvider>(context, listen: false);
final success = await authProvider.register(
_nameController.text,
_emailController.text,
_passwordController.text,
_confirmPasswordController.text,
);
if (success) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Compte créé avec succès !')),
);
// On vide la pile et on retourne au menu principal (HomeScreen)
Navigator.of(context).popUntil((route) => route.isFirst);
}
} else {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(authProvider.errorMessage ?? 'Échec de l\'inscription')),
);
}
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Inscription CESIZen')),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Form(
key: _formKey,
child: Column(
children: [
const SizedBox(height: 20),
TextFormField(
controller: _nameController,
decoration: const InputDecoration(
labelText: 'Nom complet',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.person),
),
validator: (value) => value == null || value.isEmpty ? 'Entrez votre nom' : null,
),
const SizedBox(height: 16),
TextFormField(
controller: _emailController,
decoration: const InputDecoration(
labelText: 'Email',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.email),
),
keyboardType: TextInputType.emailAddress,
validator: (value) => value == null || !value.contains('@') ? 'Email invalide' : null,
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
decoration: const InputDecoration(
labelText: 'Mot de passe',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.lock),
),
obscureText: true,
validator: (value) => value == null || value.length < 8 ? '8 caractères minimum' : null,
),
const SizedBox(height: 16),
TextFormField(
controller: _confirmPasswordController,
decoration: const InputDecoration(
labelText: 'Confirmer le mot de passe',
border: OutlineInputBorder(),
prefixIcon: Icon(Icons.lock_outline),
),
obscureText: true,
validator: (value) {
if (value != _passwordController.text) return 'Les mots de passe ne correspondent pas';
return null;
},
),
const SizedBox(height: 24),
Consumer<AuthProvider>(
builder: (context, auth, child) {
return auth.isLoading
? const CircularProgressIndicator()
: ElevatedButton(
onPressed: _register,
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
),
child: const Text('S\'inscrire'),
);
},
),
],
),
),
),
);
}
}
@@ -0,0 +1,130 @@
import 'package:dio/dio.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import '../../../core/network/dio_client.dart';
import '../models/user.dart';
class AuthService {
final Dio _dio = DioClient().dio;
final FlutterSecureStorage _storage = const FlutterSecureStorage();
Future<Map<String, dynamic>> login(String email, String password) async {
try {
final response = await _dio.post('/login', data: {
'email': email,
'password': password,
});
if (response.statusCode == 200) {
String token = response.data['token'];
await _storage.write(key: 'token', value: token);
return {
'status': 'success',
'user': User.fromJson(response.data['user']),
};
}
return {'status': 'error', 'message': 'Erreur inconnue'};
} on DioException catch (e) {
return {
'status': 'error',
'message': e.response?.data['message'] ?? 'Erreur de connexion'
};
}
}
Future<Map<String, dynamic>> register(String name, String email, String password, String passwordConfirmation) async {
try {
final response = await _dio.post('/register', data: {
'name': name,
'email': email,
'password': password,
'password_confirmation': passwordConfirmation,
});
if (response.statusCode == 201) {
String token = response.data['token'];
await _storage.write(key: 'token', value: token);
return {
'status': 'success',
'user': User.fromJson(response.data['user']),
};
}
return {'status': 'error', 'message': 'Erreur inconnue'};
} on DioException catch (e) {
return {
'status': 'error',
'errors': e.response?.data['errors'] ?? 'Erreur lors de l\'inscription'
};
}
}
Future<Map<String, dynamic>> updateProfile(String name, String email, {String? password}) async {
try {
String? token = await getToken();
final Map<String, dynamic> data = {
'name': name,
'email': email,
};
if (password != null && password.isNotEmpty) {
data['current_password'] = password;
data['password'] = password;
data['password_confirmation'] = password;
}
final response = await _dio.post(
'/update-profile',
data: data,
options: Options(
headers: {
'Authorization': 'Bearer $token',
'Accept': 'application/json',
'Content-Type': 'application/json',
},
),
);
if (response.statusCode == 200) {
return {
'status': 'success',
'user': User.fromJson(response.data['user']),
};
}
return {'status': 'error', 'message': 'Erreur lors de la mise à jour'};
} on DioException catch (e) {
return {
'status': 'error',
'message': e.response?.data['message'] ?? 'Erreur lors de la modification du profil'
};
}
}
Future<Map<String, dynamic>> getProfile() async {
try {
String? token = await getToken();
if (token == null) return {'status': 'error', 'message': 'No token'};
final response = await _dio.get('/profile', options: Options(
headers: {'Authorization': 'Bearer $token'}
));
if (response.statusCode == 200) {
return {
'status': 'success',
'user': User.fromJson(response.data),
};
}
return {'status': 'error', 'message': 'Session expirée'};
} catch (e) {
return {'status': 'error', 'message': e.toString()};
}
}
Future<void> logout() async {
await _storage.delete(key: 'token');
}
Future<String?> getToken() async {
return await _storage.read(key: 'token');
}
}
@@ -0,0 +1,13 @@
class Question {
final String text;
final List<Option> options;
Question({required this.text, required this.options});
}
class Option {
final String text;
final int points;
Option({required this.text, required this.points});
}
@@ -0,0 +1,65 @@
import 'package:flutter/material.dart';
import '../models/question.dart';
import '../services/diagnostic_service.dart';
class DiagnosticProvider with ChangeNotifier {
final DiagnosticService _service = DiagnosticService();
List<Question> _questions = [];
int _currentQuestionIndex = 0;
int _totalScore = 0;
bool _isFinished = false;
bool _isLoading = true;
List<Question> get questions => _questions;
int get currentQuestionIndex => _currentQuestionIndex;
int get totalScore => _totalScore;
bool get isFinished => _isFinished;
bool get isLoading => _isLoading;
DiagnosticProvider() {
loadQuestions();
}
Future<void> loadQuestions() async {
_isLoading = true;
notifyListeners();
_questions = await _service.fetchStressEvents();
_isLoading = false;
notifyListeners();
}
void answerQuestion(int points) {
_totalScore += points;
if (_currentQuestionIndex < _questions.length - 1) {
_currentQuestionIndex++;
} else {
_isFinished = true;
}
notifyListeners();
}
void reset() {
_currentQuestionIndex = 0;
_totalScore = 0;
_isFinished = false;
notifyListeners();
}
String get stressLevel {
if (_totalScore < 150) return "Risque Faible";
if (_totalScore < 300) return "Risque Modéré (50%)";
return "Risque Élevé (80%)";
}
String get advice {
if (_totalScore < 150) {
return "Votre niveau de changement de vie est gérable. Continuez à maintenir votre équilibre actuel.";
}
if (_totalScore < 300) {
return "Vous avez vécu beaucoup de changements. Il y a un risque modéré que cela affecte votre santé. Prenez du temps pour vous reposer.";
}
return "Attention : Votre score est très élevé. L'accumulation de stress lié à ces changements majeurs pourrait sérieusement impacter votre santé. Il est recommandé de consulter un professionnel.";
}
}
@@ -0,0 +1,122 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/diagnostic_provider.dart';
class DiagnosticScreen extends StatelessWidget {
const DiagnosticScreen({super.key});
@override
Widget build(BuildContext context) {
return ChangeNotifierProvider(
create: (_) => DiagnosticProvider(),
child: const _DiagnosticView(),
);
}
}
class _DiagnosticView extends StatelessWidget {
const _DiagnosticView();
@override
Widget build(BuildContext context) {
final provider = Provider.of<DiagnosticProvider>(context);
if (provider.isLoading) {
return const Scaffold(
body: Center(child: CircularProgressIndicator()),
);
}
if (provider.questions.isEmpty) {
return Scaffold(
appBar: AppBar(title: const Text('Diagnostic')),
body: const Center(child: Text('Aucun événement trouvé.')),
);
}
final question = provider.questions[provider.currentQuestionIndex];
if (provider.isFinished) {
return Scaffold(
appBar: AppBar(title: const Text('Résultat du Diagnostic')),
body: Center(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Votre niveau de stress est :', style: TextStyle(fontSize: 18)),
const SizedBox(height: 10),
Text(
provider.stressLevel,
style: TextStyle(
fontSize: 32,
fontWeight: FontWeight.bold,
color: _getColorForLevel(provider.stressLevel),
),
),
const SizedBox(height: 20),
Text(
provider.advice,
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 16, fontStyle: FontStyle.italic),
),
const SizedBox(height: 40),
ElevatedButton(
onPressed: () => Navigator.pop(context),
child: const Text('Retour à l\'accueil'),
),
],
),
),
),
);
}
return Scaffold(
appBar: AppBar(
title: Text('Question ${provider.currentQuestionIndex + 1}/${provider.questions.length}'),
),
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
LinearProgressIndicator(
value: (provider.currentQuestionIndex + 1) / provider.questions.length,
backgroundColor: Colors.grey.shade200,
),
const SizedBox(height: 40),
Text(
question.text,
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
textAlign: TextAlign.center,
),
const SizedBox(height: 40),
...question.options.map((option) => Padding(
padding: const EdgeInsets.only(bottom: 12.0),
child: ElevatedButton(
onPressed: () => provider.answerQuestion(option.points),
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 15),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
),
child: Text(option.text),
),
)),
],
),
),
);
}
Color _getColorForLevel(String level) {
switch (level) {
case "Faible": return Colors.green;
case "Modéré": return Colors.orange;
case "Élevé": return Colors.red;
case "Très élevé": return Colors.red.shade900;
default: return Colors.black;
}
}
}
@@ -0,0 +1,30 @@
import 'package:dio/dio.dart';
import '../../../core/network/dio_client.dart';
import '../models/question.dart';
class DiagnosticService {
final Dio _dio = DioClient().dio;
Future<List<Question>> fetchStressEvents() async {
try {
final response = await _dio.get('/stress-events');
if (response.statusCode == 200) {
List<dynamic> data = response.data;
return data.map((item) {
return Question(
text: "Avez-vous vécu : ${item['event_name']} ?",
options: [
Option(text: "Oui", points: int.parse(item['points'].toString())),
Option(text: "Non", points: 0),
],
);
}).toList();
}
return [];
} catch (e) {
print("Erreur lors de la récupération des événements : $e");
return [];
}
}
}
@@ -0,0 +1,307 @@
import 'dart:async';
import 'package:flutter/material.dart';
class BreathingMode {
final String name;
final String description;
final int inhale;
final int hold;
final int exhale;
final Color color;
BreathingMode({
required this.name,
required this.description,
required this.inhale,
required this.hold,
required this.exhale,
required this.color,
});
}
class BreathingScreen extends StatefulWidget {
const BreathingScreen({super.key});
@override
State<BreathingScreen> createState() => _BreathingScreenState();
}
class _BreathingScreenState extends State<BreathingScreen> with TickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
final List<BreathingMode> _modes = [
BreathingMode(
name: "7-4-8",
description: "Sommeil & Détente profonde",
inhale: 7,
hold: 4,
exhale: 8,
color: Colors.indigo,
),
BreathingMode(
name: "5-5",
description: "Cohérence Cardiaque classique",
inhale: 5,
hold: 0,
exhale: 5,
color: Colors.teal,
),
BreathingMode(
name: "4-6",
description: "Réduction rapide du stress",
inhale: 4,
hold: 0,
exhale: 6,
color: Colors.orange,
),
];
late BreathingMode _selectedMode;
bool _isStarted = false;
String _actionText = "Prêt ?";
int _secondsRemaining = 0;
Timer? _timer;
int _phaseSecondsRemaining = 0;
@override
void initState() {
super.initState();
_selectedMode = _modes[1]; // 5-5 par défaut
_setupController();
}
void _setupController() {
_controller = AnimationController(vsync: this);
_animation = Tween<double>(begin: 0.6, end: 1.0).animate(
CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
);
}
Future<void> _runExercise() async {
while (_isStarted && _secondsRemaining > 0) {
// Phase 1 : Inspiration
if (!_isStarted) break;
setState(() => _actionText = "Inspirez");
_controller.duration = Duration(seconds: _selectedMode.inhale);
_controller.forward();
await _waitForPhase(_selectedMode.inhale);
// Phase 2 : Apnée (Hold)
if (!_isStarted) break;
if (_selectedMode.hold > 0) {
setState(() => _actionText = "Bloquez");
await _waitForPhase(_selectedMode.hold);
}
// Phase 3 : Expiration
if (!_isStarted) break;
setState(() => _actionText = "Expirez");
_controller.duration = Duration(seconds: _selectedMode.exhale);
_controller.reverse();
await _waitForPhase(_selectedMode.exhale);
}
if (_isStarted) _stopExercise();
}
Future<void> _waitForPhase(int seconds) async {
_phaseSecondsRemaining = seconds;
for (int i = 0; i < seconds; i++) {
if (!_isStarted) return;
await Future.delayed(const Duration(seconds: 1));
if (mounted) setState(() => _phaseSecondsRemaining--);
}
}
void _startExercise() {
setState(() {
_isStarted = true;
_secondsRemaining = 300; // 5 minutes
});
_timer = Timer.periodic(const Duration(seconds: 1), (timer) {
if (_secondsRemaining > 0) {
setState(() => _secondsRemaining--);
} else {
_stopExercise();
}
});
_runExercise();
}
void _stopExercise() {
_timer?.cancel();
_controller.stop();
_controller.reset();
setState(() {
_isStarted = false;
_actionText = "Prêt ?";
});
}
@override
void dispose() {
_timer?.cancel();
_controller.dispose();
super.dispose();
}
String _formatTime(int seconds) {
int mins = seconds ~/ 60;
int secs = seconds % 60;
return "$mins:${secs.toString().padLeft(2, '0')}";
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: const Text('Respiration Guidée', style: TextStyle(fontWeight: FontWeight.bold)),
elevation: 0,
backgroundColor: Colors.white,
),
body: Container(
width: double.infinity,
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
children: [
if (!_isStarted) ...[
const SizedBox(height: 20),
const Text(
"Choisissez votre exercice",
style: TextStyle(fontSize: 18, color: Colors.grey),
),
const SizedBox(height: 20),
..._modes.map((mode) => _buildModeCard(mode)).toList(),
] else ...[
const SizedBox(height: 40),
Text(
_formatTime(_secondsRemaining),
style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold, letterSpacing: 2),
),
const Spacer(),
_buildAnimatedCircle(),
const SizedBox(height: 20),
if (_phaseSecondsRemaining > 0)
Text(
"$_phaseSecondsRemaining",
style: TextStyle(fontSize: 40, fontWeight: FontWeight.w300, color: _selectedMode.color),
),
const Spacer(),
ElevatedButton(
onPressed: _stopExercise,
style: ElevatedButton.styleFrom(
backgroundColor: Colors.red.shade50,
foregroundColor: Colors.red,
elevation: 0,
padding: const EdgeInsets.symmetric(horizontal: 50, vertical: 15),
),
child: const Text("ARRÊTER LA SESSION", style: TextStyle(fontWeight: FontWeight.bold)),
),
const SizedBox(height: 40),
]
],
),
),
);
}
Widget _buildModeCard(BreathingMode mode) {
final isSelected = _selectedMode == mode;
return GestureDetector(
onTap: () => setState(() => _selectedMode = mode),
child: Container(
margin: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: isSelected ? mode.color.withOpacity(0.05) : Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: isSelected ? mode.color : Colors.grey.shade200,
width: isSelected ? 2 : 1,
),
),
child: Row(
children: [
Container(
padding: const EdgeInsets.all(12),
decoration: BoxDecoration(
color: mode.color.withOpacity(0.1),
shape: BoxShape.circle,
),
child: Icon(Icons.air, color: mode.color),
),
const SizedBox(width: 20),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(mode.name, style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold)),
Text(mode.description, style: TextStyle(color: Colors.grey.shade600, fontSize: 13)),
],
),
),
if (isSelected)
ElevatedButton(
onPressed: _startExercise,
style: ElevatedButton.styleFrom(
backgroundColor: mode.color,
foregroundColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
),
child: const Text("GO"),
),
],
),
),
);
}
Widget _buildAnimatedCircle() {
return ScaleTransition(
scale: _animation,
child: Container(
width: 250,
height: 250,
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [
_selectedMode.color.withOpacity(0.2),
_selectedMode.color.withOpacity(0.05),
],
),
border: Border.all(color: _selectedMode.color.withOpacity(0.3), width: 8),
),
child: Stack(
alignment: Alignment.center,
children: [
// Logo de méditation en fond
Opacity(
opacity: 0.1,
child: Image.asset(
'assets/images/CesiZen logo.png',
width: 150,
),
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
_actionText,
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: _selectedMode.color,
),
),
],
),
],
),
),
);
}
}
@@ -0,0 +1,28 @@
class Activity {
final int id;
final String title;
final String description;
final String category; // 'Méditation', 'Musique', 'Respiration', etc.
final String? imageUrl;
final String? videoUrl;
Activity({
required this.id,
required this.title,
required this.description,
required this.category,
this.imageUrl,
this.videoUrl,
});
factory Activity.fromJson(Map<String, dynamic> json) {
return Activity(
id: json['id'],
title: json['title'] ?? '',
description: json['description'] ?? '',
category: json['category'] ?? 'Détente',
imageUrl: json['image_url'],
videoUrl: json['video_url'],
);
}
}
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import '../models/activity.dart';
import '../services/relaxation_service.dart';
class RelaxationProvider with ChangeNotifier {
final RelaxationService _service = RelaxationService();
List<Activity> _activities = [];
bool _isLoading = false;
String _selectedCategory = 'Toutes';
List<Activity> get activities {
if (_selectedCategory == 'Toutes') return _activities;
return _activities.where((a) => a.category == _selectedCategory).toList();
}
bool get isLoading => _isLoading;
String get selectedCategory => _selectedCategory;
Future<void> loadActivities() async {
_isLoading = true;
notifyListeners();
_activities = await _service.fetchActivities();
_isLoading = false;
notifyListeners();
}
void setCategory(String category) {
_selectedCategory = category;
notifyListeners();
}
}
@@ -0,0 +1,131 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/relaxation_provider.dart';
class RelaxationScreen extends StatefulWidget {
const RelaxationScreen({super.key});
@override
State<RelaxationScreen> createState() => _RelaxationScreenState();
}
class _RelaxationScreenState extends State<RelaxationScreen> {
@override
void initState() {
super.initState();
Future.microtask(() =>
Provider.of<RelaxationProvider>(context, listen: false).loadActivities());
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<RelaxationProvider>(context);
final categories = ['Toutes', 'Méditation', 'Musique', 'Lecture', 'Sport'];
return Scaffold(
appBar: AppBar(
title: const Text('Espace Détente'),
elevation: 0,
),
body: Column(
children: [
// Barre de catégories
Container(
height: 60,
padding: const EdgeInsets.symmetric(vertical: 10),
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: categories.length,
padding: const EdgeInsets.symmetric(horizontal: 16),
itemBuilder: (context, index) {
final cat = categories[index];
final isSelected = provider.selectedCategory == cat;
return Padding(
padding: const EdgeInsets.only(right: 10),
child: FilterChip(
label: Text(cat),
selected: isSelected,
onSelected: (_) => provider.setCategory(cat),
selectedColor: const Color(0xFF000080).withOpacity(0.2),
checkmarkColor: const Color(0xFF000080),
),
);
},
),
),
// Liste des activités
Expanded(
child: provider.isLoading
? const Center(child: CircularProgressIndicator())
: provider.activities.isEmpty
? const Center(child: Text('Aucune activité trouvée.'))
: ListView.builder(
itemCount: provider.activities.length,
padding: const EdgeInsets.all(16),
itemBuilder: (context, index) {
final activity = provider.activities[index];
return Card(
margin: const EdgeInsets.only(bottom: 16),
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (activity.imageUrl != null)
Image.network(
activity.imageUrl!,
height: 150,
width: double.infinity,
fit: BoxFit.cover,
errorBuilder: (_, __, ___) => Container(
height: 150,
color: Colors.grey.shade200,
child: const Icon(Icons.image_not_supported),
),
),
Padding(
padding: const EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
activity.category,
style: TextStyle(
color: Colors.orange.shade700,
fontWeight: FontWeight.bold,
fontSize: 12,
),
),
if (activity.videoUrl != null)
const Icon(Icons.play_circle_fill, color: Color(0xFF000080)),
],
),
const SizedBox(height: 8),
Text(
activity.title,
style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
),
const SizedBox(height: 8),
Text(
activity.description,
style: const TextStyle(color: Colors.grey),
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
],
),
),
],
),
);
},
),
),
],
),
);
}
}
@@ -0,0 +1,21 @@
import 'package:dio/dio.dart';
import '../../../core/network/dio_client.dart';
import '../models/activity.dart';
class RelaxationService {
final Dio _dio = DioClient().dio;
Future<List<Activity>> fetchActivities() async {
try {
final response = await _dio.get('/activities');
if (response.statusCode == 200) {
List<dynamic> data = response.data;
return data.map((item) => Activity.fromJson(item)).toList();
}
return [];
} catch (e) {
print("Erreur fetchActivities: $e");
return [];
}
}
}
@@ -0,0 +1,29 @@
class EmotionEntry {
final int? id;
final String emotion; // ex: 'Heureux', 'Triste', 'Stressé'
final String? note;
final DateTime createdAt;
EmotionEntry({
this.id,
required this.emotion,
this.note,
required this.createdAt,
});
factory EmotionEntry.fromJson(Map<String, dynamic> json) {
return EmotionEntry(
id: json['id'],
emotion: json['emotion_name'] ?? json['emotion'] ?? '',
note: json['note'],
createdAt: DateTime.parse(json['created_at']),
);
}
Map<String, dynamic> toJson() {
return {
'emotion_name': emotion,
'note': note,
};
}
}
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import '../models/emotion_entry.dart';
import '../services/emotion_service.dart';
class EmotionProvider with ChangeNotifier {
final EmotionService _service = EmotionService();
List<EmotionEntry> _entries = [];
bool _isLoading = false;
List<EmotionEntry> get entries => _entries;
bool get isLoading => _isLoading;
Future<void> loadEmotions() async {
_isLoading = true;
notifyListeners();
_entries = await _service.fetchEmotions();
// Trier par date décroissante (plus récent en haut)
_entries.sort((a, b) => b.createdAt.compareTo(a.createdAt));
_isLoading = false;
notifyListeners();
}
Future<bool> addEmotion(String emotion, String note) async {
final success = await _service.addEmotion(emotion, note);
if (success) {
await loadEmotions();
}
return success;
}
Future<bool> deleteEmotion(int id) async {
final success = await _service.deleteEmotion(id);
if (success) {
_entries.removeWhere((entry) => entry.id == id);
notifyListeners();
}
return success;
}
}
@@ -0,0 +1,168 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../providers/emotion_provider.dart';
import 'package:intl/intl.dart';
class TrackerScreen extends StatefulWidget {
const TrackerScreen({super.key});
@override
State<TrackerScreen> createState() => _TrackerScreenState();
}
class _TrackerScreenState extends State<TrackerScreen> {
@override
void initState() {
super.initState();
Future.microtask(() =>
Provider.of<EmotionProvider>(context, listen: false).loadEmotions());
}
void _showAddEmotionDialog() {
String selectedEmotion = 'Bien';
final noteController = TextEditingController();
final emotions = ['Très bien', 'Bien', 'Neutre', 'Pas top', 'Stressé'];
showDialog(
context: context,
builder: (context) => StatefulBuilder(
builder: (context, setDialogState) => AlertDialog(
title: const Text('Comment vous sentez-vous ?'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
DropdownButton<String>(
value: selectedEmotion,
isExpanded: true,
items: emotions.map((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
onChanged: (newValue) {
setDialogState(() => selectedEmotion = newValue!);
},
),
const SizedBox(height: 20),
TextField(
controller: noteController,
decoration: const InputDecoration(
labelText: 'Note (optionnel)',
border: OutlineInputBorder(),
),
maxLines: 3,
),
],
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text('ANNULER'),
),
ElevatedButton(
onPressed: () async {
final success = await Provider.of<EmotionProvider>(context, listen: false)
.addEmotion(selectedEmotion, noteController.text);
if (mounted) {
Navigator.pop(context);
if (!success) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Erreur lors de l\'ajout')),
);
}
}
},
child: const Text('ENREGISTRER'),
),
],
),
),
);
}
@override
Widget build(BuildContext context) {
final provider = Provider.of<EmotionProvider>(context);
return Scaffold(
appBar: AppBar(title: const Text('Journal des Émotions')),
body: provider.isLoading
? const Center(child: CircularProgressIndicator())
: provider.entries.isEmpty
? const Center(child: Text('Aucune entrée pour le moment.'))
: ListView.builder(
itemCount: provider.entries.length,
padding: const EdgeInsets.all(16),
itemBuilder: (context, index) {
final entry = provider.entries[index];
return Card(
margin: const EdgeInsets.only(bottom: 12),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)),
child: ListTile(
leading: _getEmotionIcon(entry.emotion),
title: Text(
entry.emotion,
style: const TextStyle(fontWeight: FontWeight.bold),
),
subtitle: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (entry.note != null && entry.note!.isNotEmpty)
Text(entry.note!),
Text(
DateFormat('dd/MM/yyyy HH:mm').format(entry.createdAt),
style: const TextStyle(fontSize: 12, color: Colors.grey),
),
],
),
trailing: IconButton(
icon: const Icon(Icons.delete_outline, color: Colors.red),
onPressed: () => provider.deleteEmotion(entry.id!),
),
),
);
},
),
floatingActionButton: FloatingActionButton(
onPressed: _showAddEmotionDialog,
backgroundColor: const Color(0xFF000080),
child: const Icon(Icons.add, color: Colors.white),
),
);
}
Widget _getEmotionIcon(String emotion) {
IconData icon;
Color color;
switch (emotion) {
case 'Très bien':
icon = Icons.sentiment_very_satisfied;
color = const Color(0xFF4CAF50);
break;
case 'Bien':
icon = Icons.sentiment_satisfied;
color = const Color(0xFF8BC34A);
break;
case 'Neutre':
icon = Icons.sentiment_neutral;
color = const Color(0xFFFFC107);
break;
case 'Pas top':
icon = Icons.sentiment_dissatisfied;
color = const Color(0xFFFF9800);
break;
case 'Stressé':
icon = Icons.sentiment_very_dissatisfied;
color = const Color(0xFFF44336);
break;
default:
icon = Icons.sentiment_neutral;
color = Colors.grey;
}
return CircleAvatar(
backgroundColor: color.withOpacity(0.1),
child: Icon(icon, color: color),
);
}
}
@@ -0,0 +1,69 @@
import 'package:dio/dio.dart';
import '../../../core/network/dio_client.dart';
import '../../auth/services/auth_service.dart';
import '../models/emotion_entry.dart';
class EmotionService {
final Dio _dio = DioClient().dio;
final AuthService _authService = AuthService();
Future<List<EmotionEntry>> fetchEmotions() async {
try {
String? token = await _authService.getToken();
final response = await _dio.get(
'/emotions',
options: Options(headers: {
'Authorization': 'Bearer $token',
'Accept': 'application/json',
}),
);
if (response.statusCode == 200) {
List<dynamic> data = response.data;
return data.map((item) => EmotionEntry.fromJson(item)).toList();
}
return [];
} catch (e) {
print("Erreur fetchEmotions: $e");
return [];
}
}
Future<bool> addEmotion(String emotion, String note) async {
try {
String? token = await _authService.getToken();
final response = await _dio.post(
'/emotions',
data: {
'emotion_name': emotion,
'note': note,
},
options: Options(headers: {
'Authorization': 'Bearer $token',
'Accept': 'application/json',
}),
);
return response.statusCode == 201 || response.statusCode == 200;
} catch (e) {
print("Erreur addEmotion: $e");
return false;
}
}
Future<bool> deleteEmotion(int id) async {
try {
String? token = await _authService.getToken();
final response = await _dio.delete(
'/emotions/$id',
options: Options(headers: {
'Authorization': 'Bearer $token',
'Accept': 'application/json',
}),
);
return response.statusCode == 200 || response.statusCode == 204;
} catch (e) {
print("Erreur deleteEmotion: $e");
return false;
}
}
}
@@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import '../tracker/providers/emotion_provider.dart';
class WearSyncService {
static const _platform = MethodChannel('com.cesizen/wearable');
static void initialize(BuildContext context) {
_platform.setMethodCallHandler((call) async {
switch (call.method) {
case "requestStatusUpdate":
// On peut forcer un rafraîchissement des données ici si besoin
break;
case "saveMoodFromWear":
final String mood = call.arguments['mood'];
print("DEBUG FLUTTER: Message saveMoodFromWear reçu pour '$mood'");
if (mood.isNotEmpty) {
// UTILISATION DU PROVIDER : C'est la clé pour que le token soit inclus
try {
final emotionProvider = Provider.of<EmotionProvider>(context, listen: false);
await emotionProvider.addEmotion(mood, "Enregistré depuis la montre");
print("DEBUG: Humeur '$mood' envoyée à l'API via Provider");
} catch (e) {
print("DEBUG ERROR: Impossible d'accéder au Provider: $e");
}
}
break;
}
});
}
static Future<void> syncMoodToWatch(String mood) async {
await _platform.invokeMethod('syncMood', {'mood': mood});
}
static Future<void> checkAndPromptWearSync(BuildContext context, String? userName) async {
if (await Permission.bluetoothConnect.request().isGranted) {
final bool? isWatchNearby = await _platform.invokeMethod('isWatchNearby');
if (isWatchNearby == true && context.mounted) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text("Montre connectée détectée"),
content: const Text(
"Souhaitez-vous lier CESIZen à votre montre pour suivre votre état émotionnel au poignet ?"
),
actions: [
TextButton(
onPressed: () => Navigator.pop(context),
child: const Text("PLUS TARD", style: TextStyle(color: Colors.grey)),
),
ElevatedButton(
onPressed: () async {
Navigator.pop(context);
await _platform.invokeMethod('sendAuthStatus', {
'status': userName != null ? 'authenticated' : 'unauthenticated',
'userName': userName ?? '',
});
},
style: ElevatedButton.styleFrom(backgroundColor: const Color(0xFF000091)),
child: const Text("ACTIVER LA LIAISON", style: TextStyle(color: Colors.white)),
),
],
);
},
);
}
}
}
}
+375
View File
@@ -0,0 +1,375 @@
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'features/auth/providers/auth_provider.dart';
import 'features/diagnostics/providers/diagnostic_provider.dart';
import 'features/tracker/providers/emotion_provider.dart';
import 'features/relaxation/providers/relaxation_provider.dart';
import 'features/auth/screens/login_screen.dart';
import 'features/auth/screens/profile_screen.dart';
import 'features/diagnostics/screens/diagnostic_screen.dart';
import 'features/exercises/screens/breathing_screen.dart';
import 'features/tracker/screens/tracker_screen.dart';
import 'features/relaxation/screens/relaxation_screen.dart';
import 'features/wear/wear_sync_service.dart';
void main() {
runApp(
MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => AuthProvider()),
ChangeNotifierProvider(create: (_) => DiagnosticProvider()),
ChangeNotifierProvider(create: (_) => EmotionProvider()),
ChangeNotifierProvider(create: (_) => RelaxationProvider()),
],
child: const MyApp(),
),
);
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'CESIZen',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF000080)),
useMaterial3: true,
scaffoldBackgroundColor: Colors.white,
),
home: const HomeScreen(),
);
}
}
class HomeScreen extends StatefulWidget {
const HomeScreen({super.key});
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
final ScrollController _scrollController = ScrollController();
bool _isFabExpanded = true;
@override
void initState() {
super.initState();
_scrollController.addListener(_onScroll);
WidgetsBinding.instance.addPostFrameCallback((_) {
WearSyncService.initialize(context);
});
}
@override
void dispose() {
_scrollController.removeListener(_onScroll);
_scrollController.dispose();
super.dispose();
}
void _onScroll() {
if (_scrollController.position.userScrollDirection == ScrollDirection.reverse) {
if (_isFabExpanded) {
setState(() => _isFabExpanded = false);
}
} else if (_scrollController.position.userScrollDirection == ScrollDirection.forward) {
if (!_isFabExpanded) {
setState(() => _isFabExpanded = true);
}
}
}
@override
Widget build(BuildContext context) {
final authProvider = Provider.of<AuthProvider>(context);
if (authProvider.isLoading && authProvider.user == null) {
return const Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircularProgressIndicator(color: Color(0xFF000080)),
SizedBox(height: 20),
Text("Synchronisation en cours...", style: TextStyle(color: Color(0xFF000080), fontWeight: FontWeight.bold)),
],
),
),
);
}
final bool isLoggedIn = authProvider.isAuthenticated;
final String userName = isLoggedIn ? (authProvider.user?.name ?? 'Utilisateur') : 'Visiteur';
if (isLoggedIn) {
WearSyncService.checkAndPromptWearSync(context, authProvider.user?.name);
}
return Scaffold(
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// HEADER FIXE (Logos + Bonjour + Message)
Padding(
padding: const EdgeInsets.fromLTRB(24, 20, 24, 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Image.asset('assets/images/ministere.png', height: 60),
Image.asset('assets/images/CesiZen.png', height: 40),
],
),
const SizedBox(height: 30),
const Text('Bonjour,', style: TextStyle(fontSize: 18, color: Colors.grey)),
Text(
userName,
style: const TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
),
Container(
margin: const EdgeInsets.only(top: 8, bottom: 20),
width: 40,
height: 4,
decoration: BoxDecoration(
color: Colors.orange.shade300,
borderRadius: BorderRadius.circular(2),
),
),
Container(
width: double.infinity,
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.05),
blurRadius: 10,
offset: const Offset(0, 4),
),
],
border: Border.all(color: Colors.grey.shade100),
),
child: const Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Prenez soin de vous',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF000080)),
),
SizedBox(height: 8),
Text(
'Retrouvez vos outils de suivi et de détente.',
style: TextStyle(color: Colors.grey),
),
],
),
),
],
),
),
// ZONE SCROLLABLE (UNIQUEMENT LES BOUTONS)
Expanded(
child: GridView.count(
controller: _scrollController,
padding: const EdgeInsets.fromLTRB(24, 0, 24, 100),
crossAxisCount: 2,
crossAxisSpacing: 20,
mainAxisSpacing: 20,
children: [
_buildMenuCard(
context,
'Tracker',
Icons.access_time,
Colors.teal.shade300,
isLocked: !isLoggedIn,
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) => const TrackerScreen()));
},
),
_buildMenuCard(
context,
'Diagnostics',
Icons.analytics_outlined,
Colors.orange.shade200,
isLocked: !isLoggedIn,
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) => const DiagnosticScreen()));
},
),
_buildMenuCard(
context,
'Respiration',
Icons.explore_outlined,
Colors.indigo.shade300,
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) => const BreathingScreen()));
},
),
_buildMenuCard(
context,
'Détente',
Icons.play_arrow_outlined,
Colors.red.shade300,
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) => const RelaxationScreen()));
},
),
_buildMenuCard(
context,
'Informations',
Icons.info_outline,
Colors.lightBlue.shade300,
onTap: () {},
),
_buildMenuCard(
context,
'Favoris',
Icons.favorite_border,
Colors.pink.shade200,
isLocked: !isLoggedIn,
onTap: () {},
),
],
),
),
],
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: Padding(
padding: const EdgeInsets.only(bottom: 20.0),
child: InkWell(
onTap: () {
if (isLoggedIn) {
Navigator.push(context, MaterialPageRoute(builder: (_) => const ProfileScreen()));
} else {
Navigator.push(context, MaterialPageRoute(builder: (_) => const LoginScreen()));
}
},
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
decoration: BoxDecoration(
color: const Color(0xFF000080),
borderRadius: BorderRadius.circular(_isFabExpanded ? 15 : 30),
boxShadow: [
BoxShadow(
color: const Color(0xFF000080).withOpacity(0.3),
blurRadius: 10,
offset: const Offset(0, 5),
),
],
),
child: AnimatedSize(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
const Icon(Icons.lock, color: Colors.white, size: 20),
ClipRect(
child: AnimatedOpacity(
opacity: _isFabExpanded ? 1.0 : 0.0,
duration: const Duration(milliseconds: 200),
child: AnimatedSize(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
child: _isFabExpanded
? const Row(
mainAxisSize: MainAxisSize.min,
children: [
SizedBox(width: 10),
Text(
'Espace Santé',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
],
)
: const SizedBox.shrink(),
),
),
),
],
),
),
),
),
),
);
}
Widget _buildMenuCard(BuildContext context, String title, IconData icon, Color iconColor, {VoidCallback? onTap, bool isLocked = false}) {
return InkWell(
onTap: isLocked
? () {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('Connectez-vous pour accéder à cette fonctionnalité'),
backgroundColor: Color(0xFF000080),
),
);
}
: onTap,
borderRadius: BorderRadius.circular(20),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Colors.grey.shade200),
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.02),
blurRadius: 5,
offset: const Offset(0, 2),
),
],
),
child: Stack(
children: [
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
icon,
size: 36,
color: isLocked ? Colors.grey.shade300 : iconColor
),
const SizedBox(height: 8),
Text(
title,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 14,
color: isLocked ? Colors.grey : Colors.black87,
),
),
],
),
),
if (isLocked)
const Positioned(
top: 10,
right: 10,
child: Icon(Icons.lock_outline, size: 18, color: Colors.grey),
),
],
),
),
);
}
}
+1
View File
@@ -0,0 +1 @@
flutter/ephemeral
+128
View File
@@ -0,0 +1,128 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "mobile")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.mobile")
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
cmake_policy(SET CMP0063 NEW)
# Load bundled libraries from the lib/ directory relative to the binary.
set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
# Root filesystem for cross-building.
if(FLUTTER_TARGET_PLATFORM_SYSROOT)
set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
endif()
# Define build configuration options.
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Debug" CACHE
STRING "Flutter build mode" FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Profile" "Release")
endif()
# Compilation settings that should be applied to most targets.
#
# Be cautious about adding new options here, as plugins use this function by
# default. In most cases, you should add new options to specific targets instead
# of modifying this function.
function(APPLY_STANDARD_SETTINGS TARGET)
target_compile_features(${TARGET} PUBLIC cxx_std_14)
target_compile_options(${TARGET} PRIVATE -Wall -Werror)
target_compile_options(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:-O3>")
target_compile_definitions(${TARGET} PRIVATE "$<$<NOT:$<CONFIG:Debug>>:NDEBUG>")
endfunction()
# Flutter library and tool build rules.
set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
add_subdirectory(${FLUTTER_MANAGED_DIR})
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
# Application build; see runner/CMakeLists.txt.
add_subdirectory("runner")
# Run the Flutter tool portions of the build. This must not be removed.
add_dependencies(${BINARY_NAME} flutter_assemble)
# Only the install-generated bundle's copy of the executable will launch
# correctly, since the resources must in the right relative locations. To avoid
# people trying to run the unbundled copy, put it in a subdirectory instead of
# the default top-level location.
set_target_properties(${BINARY_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
)
# Generated plugin build rules, which manage building the plugins and adding
# them to the application.
include(flutter/generated_plugins.cmake)
# === Installation ===
# By default, "installing" just makes a relocatable bundle in the build
# directory.
set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
endif()
# Start with a clean build bundle directory every time.
install(CODE "
file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
" COMPONENT Runtime)
set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
COMPONENT Runtime)
install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
COMPONENT Runtime)
install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES})
install(FILES "${bundled_library}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endforeach(bundled_library)
# Copy the native assets provided by the build.dart from all packages.
set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/linux/")
install(DIRECTORY "${NATIVE_ASSETS_DIR}"
DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
# Fully re-copy the assets directory on each build to avoid having stale files
# from a previous install.
set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
install(CODE "
file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
" COMPONENT Runtime)
install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
# Install the AOT library on non-Debug builds only.
if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
COMPONENT Runtime)
endif()
+88
View File
@@ -0,0 +1,88 @@
# This file controls Flutter-level build steps. It should not be edited.
cmake_minimum_required(VERSION 3.10)
set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
# Configuration provided via flutter tool.
include(${EPHEMERAL_DIR}/generated_config.cmake)
# TODO: Move the rest of this into files in ephemeral. See
# https://github.com/flutter/flutter/issues/57146.
# Serves the same purpose as list(TRANSFORM ... PREPEND ...),
# which isn't available in 3.10.
function(list_prepend LIST_NAME PREFIX)
set(NEW_LIST "")
foreach(element ${${LIST_NAME}})
list(APPEND NEW_LIST "${PREFIX}${element}")
endforeach(element)
set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
endfunction()
# === Flutter Library ===
# System-level dependencies.
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
# Published to parent scope for install step.
set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
list(APPEND FLUTTER_LIBRARY_HEADERS
"fl_basic_message_channel.h"
"fl_binary_codec.h"
"fl_binary_messenger.h"
"fl_dart_project.h"
"fl_engine.h"
"fl_json_message_codec.h"
"fl_json_method_codec.h"
"fl_message_codec.h"
"fl_method_call.h"
"fl_method_channel.h"
"fl_method_codec.h"
"fl_method_response.h"
"fl_plugin_registrar.h"
"fl_plugin_registry.h"
"fl_standard_message_codec.h"
"fl_standard_method_codec.h"
"fl_string_codec.h"
"fl_value.h"
"fl_view.h"
"flutter_linux.h"
)
list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
add_library(flutter INTERFACE)
target_include_directories(flutter INTERFACE
"${EPHEMERAL_DIR}"
)
target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
target_link_libraries(flutter INTERFACE
PkgConfig::GTK
PkgConfig::GLIB
PkgConfig::GIO
)
add_dependencies(flutter flutter_assemble)
# === Flutter tool backend ===
# _phony_ is a non-existent file to force this command to run every time,
# since currently there's no way to get a full input/output list from the
# flutter tool.
add_custom_command(
OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
${CMAKE_CURRENT_BINARY_DIR}/_phony_
COMMAND ${CMAKE_COMMAND} -E env
${FLUTTER_TOOL_ENVIRONMENT}
"${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
VERBATIM
)
add_custom_target(flutter_assemble DEPENDS
"${FLUTTER_LIBRARY}"
${FLUTTER_LIBRARY_HEADERS}
)
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#include "generated_plugin_registrant.h"
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin");
flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar);
}
@@ -0,0 +1,15 @@
//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GENERATED_PLUGIN_REGISTRANT_
#define GENERATED_PLUGIN_REGISTRANT_
#include <flutter_linux/flutter_linux.h>
// Registers Flutter plugins.
void fl_register_plugins(FlPluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
@@ -0,0 +1,25 @@
#
# Generated file, do not edit.
#
list(APPEND FLUTTER_PLUGIN_LIST
flutter_secure_storage_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST
jni
)
set(PLUGIN_BUNDLED_LIBRARIES)
foreach(plugin ${FLUTTER_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
endforeach(plugin)
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
endforeach(ffi_plugin)
+26
View File
@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.13)
project(runner LANGUAGES CXX)
# Define the application target. To change its name, change BINARY_NAME in the
# top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
# work.
#
# Any new source files that you add to the application should be added here.
add_executable(${BINARY_NAME}
"main.cc"
"my_application.cc"
"${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
)
# Apply the standard set of build settings. This can be removed for applications
# that need different build settings.
apply_standard_settings(${BINARY_NAME})
# Add preprocessor definitions for the application ID.
add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
# Add dependency libraries. Add any application-specific dependencies here.
target_link_libraries(${BINARY_NAME} PRIVATE flutter)
target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
+6
View File
@@ -0,0 +1,6 @@
#include "my_application.h"
int main(int argc, char** argv) {
g_autoptr(MyApplication) app = my_application_new();
return g_application_run(G_APPLICATION(app), argc, argv);
}
+148
View File
@@ -0,0 +1,148 @@
#include "my_application.h"
#include <flutter_linux/flutter_linux.h>
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
#include "flutter/generated_plugin_registrant.h"
struct _MyApplication {
GtkApplication parent_instance;
char** dart_entrypoint_arguments;
};
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
// Called when first Flutter frame received.
static void first_frame_cb(MyApplication* self, FlView* view) {
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
}
// Implements GApplication::activate.
static void my_application_activate(GApplication* application) {
MyApplication* self = MY_APPLICATION(application);
GtkWindow* window =
GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
// Use a header bar when running in GNOME as this is the common style used
// by applications and is the setup most users will be using (e.g. Ubuntu
// desktop).
// If running on X and not using GNOME then just use a traditional title bar
// in case the window manager does more exotic layout, e.g. tiling.
// If running on Wayland assume the header bar will work (may need changing
// if future cases occur).
gboolean use_header_bar = TRUE;
#ifdef GDK_WINDOWING_X11
GdkScreen* screen = gtk_window_get_screen(window);
if (GDK_IS_X11_SCREEN(screen)) {
const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
use_header_bar = FALSE;
}
}
#endif
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "mobile");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "mobile");
}
gtk_window_set_default_size(window, 1280, 720);
g_autoptr(FlDartProject) project = fl_dart_project_new();
fl_dart_project_set_dart_entrypoint_arguments(
project, self->dart_entrypoint_arguments);
FlView* view = fl_view_new(project);
GdkRGBA background_color;
// Background defaults to black, override it here if necessary, e.g. #00000000
// for transparent.
gdk_rgba_parse(&background_color, "#000000");
fl_view_set_background_color(view, &background_color);
gtk_widget_show(GTK_WIDGET(view));
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
// Show the window when Flutter renders.
// Requires the view to be realized so we can start rendering.
g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb),
self);
gtk_widget_realize(GTK_WIDGET(view));
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
gtk_widget_grab_focus(GTK_WIDGET(view));
}
// Implements GApplication::local_command_line.
static gboolean my_application_local_command_line(GApplication* application,
gchar*** arguments,
int* exit_status) {
MyApplication* self = MY_APPLICATION(application);
// Strip out the first argument as it is the binary name.
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
g_autoptr(GError) error = nullptr;
if (!g_application_register(application, nullptr, &error)) {
g_warning("Failed to register: %s", error->message);
*exit_status = 1;
return TRUE;
}
g_application_activate(application);
*exit_status = 0;
return TRUE;
}
// Implements GApplication::startup.
static void my_application_startup(GApplication* application) {
// MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application startup.
G_APPLICATION_CLASS(my_application_parent_class)->startup(application);
}
// Implements GApplication::shutdown.
static void my_application_shutdown(GApplication* application) {
// MyApplication* self = MY_APPLICATION(object);
// Perform any actions required at application shutdown.
G_APPLICATION_CLASS(my_application_parent_class)->shutdown(application);
}
// Implements GObject::dispose.
static void my_application_dispose(GObject* object) {
MyApplication* self = MY_APPLICATION(object);
g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
}
static void my_application_class_init(MyApplicationClass* klass) {
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
G_APPLICATION_CLASS(klass)->local_command_line =
my_application_local_command_line;
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
}
static void my_application_init(MyApplication* self) {}
MyApplication* my_application_new() {
// Set the program name to the application ID, which helps various systems
// like GTK and desktop environments map this running application to its
// corresponding .desktop file. This ensures better integration by allowing
// the application to be recognized beyond its binary name.
g_set_prgname(APPLICATION_ID);
return MY_APPLICATION(g_object_new(my_application_get_type(),
"application-id", APPLICATION_ID, "flags",
G_APPLICATION_NON_UNIQUE, nullptr));
}

Some files were not shown because too many files have changed in this diff Show More