initial commit

This commit is contained in:
bastien
2026-06-28 12:29:06 +02:00
parent 79d5b012a9
commit 20f383dd62
93 changed files with 4269 additions and 1 deletions
+40
View File
@@ -0,0 +1,40 @@
import 'dart:io' show Platform;
import 'package:flutter/foundation.dart';
/// Surcharge explicite via `--dart-define=API_BASE_URL=...`
const String _envApiBaseUrl = String.fromEnvironment('API_BASE_URL');
/// URL de base de l'API Laverie.
///
/// Priorité :
/// 1. `API_BASE_URL` passé en `--dart-define`
/// 2. Valeur par défaut selon la plateforme :
/// - Android émulateur : `10.0.2.2` (localhost de l'hôte)
/// - iOS simulateur : `127.0.0.1`
/// 3. Appareil physique : toujours passer `--dart-define=API_BASE_URL=http://IP:8000/api/v1`
String get kApiBaseUrl {
if (_envApiBaseUrl.isNotEmpty) {
return _envApiBaseUrl;
}
if (kIsWeb) {
throw UnsupportedError('Le web Flutter n\'est pas supporté.');
}
if (Platform.isAndroid) {
return 'http://10.0.2.2:8000/api/v1';
}
if (Platform.isIOS) {
return 'http://127.0.0.1:8000/api/v1';
}
throw UnsupportedError('Plateforme non supportée.');
}
/// Clés de stockage sécurisé pour les jetons d'authentification.
abstract final class AuthStorageKeys {
static const accessToken = 'laverie_access_token';
static const refreshToken = 'laverie_refresh_token';
}
@@ -0,0 +1,14 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
/// Configuration du stockage sécurisé adaptée Android / iOS.
///
/// Android : SharedPreferences chiffrées (Keystore).
/// iOS : Keychain avec accessibilité au premier déverrouillage.
const FlutterSecureStorage laverieSecureStorage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
),
iOptions: IOSOptions(
accessibility: KeychainAccessibility.first_unlock,
),
);