feat(features): refontes onboarding/organizations/profile/reports/settings/solidarity
- onboarding : datasource souscription, models formule/status, bloc complet - organizations : bloc orgs + switcher + types bloc, models, pages edit/create - profile : bloc complet avec change password, delete account, preferences - reports : bloc avec DashboardReports + ScheduleReports + GenerateReport - settings : language, privacy, feedback pages - solidarity : bloc complet demandes d'aide (CRUD, approuver, rejeter)
This commit is contained in:
@@ -81,6 +81,110 @@ class SystemConfigRepositoryImpl implements ISystemConfigRepository {
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> optimizeDatabase() async {
|
||||
final response = await _apiClient.post('$_base/database/optimize');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> forceGlobalLogout() async {
|
||||
final response = await _apiClient.post('$_base/auth/logout-all');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> cleanupSessions() async {
|
||||
final response = await _apiClient.post('$_base/sessions/cleanup');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> cleanOldLogs() async {
|
||||
final response = await _apiClient.post('$_base/logs/cleanup');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> purgeExpiredData() async {
|
||||
final response = await _apiClient.post('$_base/data/purge');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> analyzePerformance() async {
|
||||
final response = await _apiClient.post('$_base/performance/analyze');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> createBackup() async {
|
||||
final response = await _apiClient.post('$_base/backup/create');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> scheduleMaintenance({String? scheduledAt, String? reason}) async {
|
||||
final queryParams = <String, String>{};
|
||||
if (scheduledAt != null) queryParams['scheduledAt'] = scheduledAt;
|
||||
if (reason != null) queryParams['reason'] = reason;
|
||||
final response = await _apiClient.post(
|
||||
'$_base/maintenance/schedule',
|
||||
queryParameters: queryParams.isNotEmpty ? queryParams : null,
|
||||
);
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> emergencyMaintenance() async {
|
||||
final response = await _apiClient.post('$_base/maintenance/emergency');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> checkUpdates() async {
|
||||
final response = await _apiClient.get('$_base/updates/check');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> exportLogs() async {
|
||||
final response = await _apiClient.get('$_base/logs/export');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> generateUsageReport() async {
|
||||
final response = await _apiClient.get('$_base/reports/usage');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> generateAuditReport() async {
|
||||
final response = await _apiClient.get('$_base/audit/report');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Map<String, dynamic>> exportGDPRData() async {
|
||||
final response = await _apiClient.post('$_base/gdpr/export');
|
||||
if (response.statusCode == 200) return response.data as Map<String, dynamic>;
|
||||
throw Exception('Erreur ${response.statusCode}');
|
||||
}
|
||||
|
||||
@override
|
||||
Future<SystemConfigModel> resetConfig() async {
|
||||
try {
|
||||
|
||||
@@ -30,4 +30,38 @@ abstract class ISystemConfigRepository {
|
||||
|
||||
/// Réinitialise la configuration aux valeurs par défaut
|
||||
Future<SystemConfigModel> resetConfig();
|
||||
|
||||
// ── Base de données ────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> optimizeDatabase();
|
||||
|
||||
// ── Sécurité / sessions ───────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> forceGlobalLogout();
|
||||
Future<Map<String, dynamic>> cleanupSessions();
|
||||
|
||||
// ── Logs ──────────────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> cleanOldLogs();
|
||||
Future<Map<String, dynamic>> exportLogs();
|
||||
|
||||
// ── Données ───────────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> purgeExpiredData();
|
||||
|
||||
// ── Performance ───────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> analyzePerformance();
|
||||
|
||||
// ── Sauvegarde ────────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> createBackup();
|
||||
|
||||
// ── Maintenance ───────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> scheduleMaintenance({String? scheduledAt, String? reason});
|
||||
Future<Map<String, dynamic>> emergencyMaintenance();
|
||||
|
||||
// ── Mises à jour ──────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> checkUpdates();
|
||||
|
||||
// ── Rapports ──────────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> generateUsageReport();
|
||||
Future<Map<String, dynamic>> generateAuditReport();
|
||||
|
||||
// ── RGPD ──────────────────────────────────────────────────────────────────
|
||||
Future<Map<String, dynamic>> exportGDPRData();
|
||||
}
|
||||
|
||||
@@ -38,6 +38,20 @@ class SystemSettingsBloc extends Bloc<SystemSettingsEvent, SystemSettingsState>
|
||||
on<TestDatabaseConnection>(_onTestDatabaseConnection);
|
||||
on<TestEmailConfiguration>(_onTestEmailConfiguration);
|
||||
on<ResetSystemConfig>(_onResetSystemConfig);
|
||||
on<OptimizeDatabase>(_onOptimizeDatabase);
|
||||
on<ForceGlobalLogout>(_onForceGlobalLogout);
|
||||
on<CleanupSessions>(_onCleanupSessions);
|
||||
on<CleanOldLogs>(_onCleanOldLogs);
|
||||
on<PurgeExpiredData>(_onPurgeExpiredData);
|
||||
on<AnalyzePerformance>(_onAnalyzePerformance);
|
||||
on<CreateBackup>(_onCreateBackup);
|
||||
on<ScheduleMaintenance>(_onScheduleMaintenance);
|
||||
on<EmergencyMaintenance>(_onEmergencyMaintenance);
|
||||
on<CheckUpdates>(_onCheckUpdates);
|
||||
on<ExportLogs>(_onExportLogs);
|
||||
on<GenerateUsageReport>(_onGenerateUsageReport);
|
||||
on<GenerateAuditReport>(_onGenerateAuditReport);
|
||||
on<ExportGDPRData>(_onExportGDPRData);
|
||||
}
|
||||
|
||||
Future<void> _onLoadSystemConfig(
|
||||
@@ -165,4 +179,159 @@ class SystemSettingsBloc extends Bloc<SystemSettingsEvent, SystemSettingsState>
|
||||
emit(SystemSettingsError('Erreur de réinitialisation: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onOptimizeDatabase(OptimizeDatabase event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.optimizeDatabase();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Base de données optimisée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onForceGlobalLogout(ForceGlobalLogout event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.forceGlobalLogout();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Déconnexion globale déclenchée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onCleanupSessions(CleanupSessions event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.cleanupSessions();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Sessions nettoyées'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onCleanOldLogs(CleanOldLogs event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.cleanOldLogs();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Logs nettoyés'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onPurgeExpiredData(PurgeExpiredData event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.purgeExpiredData();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Données purgées'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onAnalyzePerformance(AnalyzePerformance event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.analyzePerformance();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Analyse terminée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onCreateBackup(CreateBackup event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.createBackup();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Sauvegarde créée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onScheduleMaintenance(ScheduleMaintenance event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.scheduleMaintenance(scheduledAt: event.scheduledAt, reason: event.reason);
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Maintenance planifiée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onEmergencyMaintenance(EmergencyMaintenance event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.emergencyMaintenance();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Maintenance d\'urgence activée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onCheckUpdates(CheckUpdates event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.checkUpdates();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Vérification terminée'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onExportLogs(ExportLogs event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.exportLogs();
|
||||
final count = result['count'] as int? ?? 0;
|
||||
emit(SystemSettingsSuccess('$count log(s) exporté(s)'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onGenerateUsageReport(GenerateUsageReport event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.generateUsageReport();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Rapport généré'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onGenerateAuditReport(GenerateAuditReport event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.generateAuditReport();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Rapport d\'audit généré'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _onExportGDPRData(ExportGDPRData event, Emitter<SystemSettingsState> emit) async {
|
||||
emit(SystemSettingsLoading());
|
||||
try {
|
||||
final result = await _repository.exportGDPRData();
|
||||
emit(SystemSettingsSuccess(result['message'] as String? ?? 'Export RGPD initié'));
|
||||
} catch (e) {
|
||||
if (e is DioException && e.type == DioExceptionType.cancel) return;
|
||||
emit(SystemSettingsError('Erreur: ${e.toString()}'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,25 +10,63 @@ abstract class SystemSettingsEvent extends Equatable {
|
||||
List<Object?> get props => [];
|
||||
}
|
||||
|
||||
// ── Chargement ─────────────────────────────────────────────────────────────
|
||||
class LoadSystemConfig extends SystemSettingsEvent {}
|
||||
class LoadCacheStats extends SystemSettingsEvent {}
|
||||
class LoadSystemMetrics extends SystemSettingsEvent {}
|
||||
|
||||
// ── Configuration ──────────────────────────────────────────────────────────
|
||||
class UpdateSystemConfig extends SystemSettingsEvent {
|
||||
final Map<String, dynamic> config;
|
||||
|
||||
const UpdateSystemConfig(this.config);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [config];
|
||||
}
|
||||
|
||||
class LoadCacheStats extends SystemSettingsEvent {}
|
||||
|
||||
class LoadSystemMetrics extends SystemSettingsEvent {}
|
||||
|
||||
class ClearCache extends SystemSettingsEvent {}
|
||||
class ResetSystemConfig extends SystemSettingsEvent {}
|
||||
|
||||
// ── Tests ───────────────────────────────────────────────────────────────────
|
||||
class TestDatabaseConnection extends SystemSettingsEvent {}
|
||||
|
||||
class TestEmailConfiguration extends SystemSettingsEvent {}
|
||||
|
||||
class ResetSystemConfig extends SystemSettingsEvent {}
|
||||
// ── Cache ────────────────────────────────────────────────────────────────────
|
||||
class ClearCache extends SystemSettingsEvent {}
|
||||
|
||||
// ── Base de données ──────────────────────────────────────────────────────────
|
||||
class OptimizeDatabase extends SystemSettingsEvent {}
|
||||
|
||||
// ── Sécurité ─────────────────────────────────────────────────────────────────
|
||||
class ForceGlobalLogout extends SystemSettingsEvent {}
|
||||
class CleanupSessions extends SystemSettingsEvent {}
|
||||
class ExportGDPRData extends SystemSettingsEvent {}
|
||||
|
||||
// ── Logs ─────────────────────────────────────────────────────────────────────
|
||||
class CleanOldLogs extends SystemSettingsEvent {}
|
||||
class ExportLogs extends SystemSettingsEvent {}
|
||||
|
||||
// ── Données ──────────────────────────────────────────────────────────────────
|
||||
class PurgeExpiredData extends SystemSettingsEvent {}
|
||||
|
||||
// ── Performance ──────────────────────────────────────────────────────────────
|
||||
class AnalyzePerformance extends SystemSettingsEvent {}
|
||||
|
||||
// ── Sauvegarde ────────────────────────────────────────────────────────────────
|
||||
class CreateBackup extends SystemSettingsEvent {}
|
||||
|
||||
// ── Maintenance ───────────────────────────────────────────────────────────────
|
||||
class ScheduleMaintenance extends SystemSettingsEvent {
|
||||
final String? scheduledAt;
|
||||
final String? reason;
|
||||
const ScheduleMaintenance({this.scheduledAt, this.reason});
|
||||
@override
|
||||
List<Object?> get props => [scheduledAt, reason];
|
||||
}
|
||||
|
||||
class EmergencyMaintenance extends SystemSettingsEvent {}
|
||||
|
||||
// ── Mises à jour ──────────────────────────────────────────────────────────────
|
||||
class CheckUpdates extends SystemSettingsEvent {}
|
||||
|
||||
// ── Rapports ──────────────────────────────────────────────────────────────────
|
||||
class GenerateAuditReport extends SystemSettingsEvent {}
|
||||
class GenerateUsageReport extends SystemSettingsEvent {}
|
||||
|
||||
@@ -1,12 +1,30 @@
|
||||
/// Page dédiée à l'envoi de commentaires / feedback
|
||||
/// Permet de soumettre des suggestions, signaler des bugs, ou proposer des idées
|
||||
library feedback_page;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../../../../core/di/injection.dart';
|
||||
import '../../../../core/network/api_client.dart';
|
||||
import '../../../../core/utils/logger.dart';
|
||||
import '../../../../shared/design_system/components/uf_app_bar.dart';
|
||||
import '../../../../shared/design_system/unionflow_design_system.dart';
|
||||
import '../../../../shared/widgets/core_card.dart';
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Données statiques
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
const _kCategories = [
|
||||
_FeedbackCategory('suggestion', 'Suggestion', Icons.lightbulb_outline, AppColors.primary),
|
||||
_FeedbackCategory('bug', 'Bug / Problème', Icons.bug_report_outlined, AppColors.error),
|
||||
_FeedbackCategory('amelioration', 'Amélioration', Icons.trending_up, AppColors.success),
|
||||
_FeedbackCategory('autre', 'Autre', Icons.help_outline, AppColors.primaryDark),
|
||||
];
|
||||
|
||||
const _kMaxLength = 1000;
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Page
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
class FeedbackPage extends StatefulWidget {
|
||||
const FeedbackPage({super.key});
|
||||
@@ -19,13 +37,15 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
final _messageController = TextEditingController();
|
||||
String _selectedCategory = 'suggestion';
|
||||
bool _isSending = false;
|
||||
int _charCount = 0;
|
||||
|
||||
static const _categories = [
|
||||
_FeedbackCategory('suggestion', 'Suggestion', Icons.lightbulb, AppColors.primaryGreen),
|
||||
_FeedbackCategory('bug', 'Bug / Problème', Icons.bug_report, AppColors.error),
|
||||
_FeedbackCategory('amelioration', 'Amélioration', Icons.trending_up, AppColors.success),
|
||||
_FeedbackCategory('autre', 'Autre', Icons.help_outline, AppColors.brandGreen),
|
||||
];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_messageController.addListener(
|
||||
() => setState(() => _charCount = _messageController.text.length),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -39,16 +59,14 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
_showSnackBar('Veuillez saisir un message.', isError: true);
|
||||
return;
|
||||
}
|
||||
|
||||
setState(() => _isSending = true);
|
||||
|
||||
try {
|
||||
await GetIt.I<Dio>().post(
|
||||
final cat = _kCategories.firstWhere((c) => c.id == _selectedCategory);
|
||||
await getIt<ApiClient>().post(
|
||||
'/api/feedback',
|
||||
data: {
|
||||
'subject': 'Feedback mobile [$_selectedCategory]',
|
||||
'subject': '[${cat.label}] Feedback mobile',
|
||||
'message': message,
|
||||
'categorie': _selectedCategory,
|
||||
},
|
||||
);
|
||||
if (mounted) {
|
||||
@@ -57,9 +75,7 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
}
|
||||
} catch (e, st) {
|
||||
AppLogger.error('FeedbackPage: envoi feedback échoué', error: e, stackTrace: st);
|
||||
if (mounted) {
|
||||
_showSnackBar('Envoi échoué. Réessayez plus tard.', isError: true);
|
||||
}
|
||||
if (mounted) _showSnackBar('Envoi échoué. Réessayez plus tard.', isError: true);
|
||||
} finally {
|
||||
if (mounted) setState(() => _isSending = false);
|
||||
}
|
||||
@@ -79,129 +95,56 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
_buildCategorySection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildMessageSection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildSubmitButton(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
appBar: UFAppBar(
|
||||
title: 'Commentaires',
|
||||
moduleGradient: ModuleColors.supportGradient,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeader() {
|
||||
return Container(
|
||||
margin: const EdgeInsets.symmetric(horizontal: SpacingTokens.sm, vertical: SpacingTokens.xs),
|
||||
padding: const EdgeInsets.all(SpacingTokens.md),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.xl),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: SafeArea(
|
||||
bottom: false,
|
||||
child: Row(
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
icon: const Icon(Icons.arrow_back, color: Colors.white),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Icon(Icons.feedback, color: Colors.white, size: 20),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Commentaires',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Aidez-nous à améliorer UnionFlow',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.white70,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
_buildCategorySection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildMessageSection(),
|
||||
const SizedBox(height: 12),
|
||||
_buildSubmitButton(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ── Section catégories ────────────────────────────────────────────────────
|
||||
|
||||
Widget _buildCategorySection() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
return CoreCard(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.category, color: textSecondary, size: 20),
|
||||
Icon(Icons.category_outlined, color: scheme.onSurfaceVariant, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Type de retour',
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
'TYPE DE RETOUR',
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 1.1,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 12),
|
||||
Wrap(
|
||||
spacing: 10,
|
||||
runSpacing: 10,
|
||||
children: _categories.map((cat) => _buildCategoryChip(cat)).toList(),
|
||||
spacing: 8,
|
||||
runSpacing: 8,
|
||||
children: _kCategories.map(_buildCategoryChip).toList(),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -209,34 +152,37 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
}
|
||||
|
||||
Widget _buildCategoryChip(_FeedbackCategory cat) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final isSelected = _selectedCategory == cat.id;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return InkWell(
|
||||
onTap: () => setState(() => _selectedCategory = cat.id),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 180),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? cat.color.withOpacity(0.12)
|
||||
: (isDark ? AppColors.darkBackground : Colors.grey[50]),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
color: isSelected ? cat.color.withOpacity(0.1) : scheme.surface,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(
|
||||
color: isSelected ? cat.color.withOpacity(0.5) : (isDark ? AppColors.darkBorder : Colors.grey[200]!),
|
||||
color: isSelected ? cat.color.withOpacity(0.5) : scheme.outlineVariant,
|
||||
width: isSelected ? 1.5 : 1,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(cat.icon, size: 18, color: isSelected ? cat.color : textSecondary),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
cat.icon,
|
||||
size: 15,
|
||||
color: isSelected ? cat.color : scheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
cat.label,
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
style: AppTypography.actionText.copyWith(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? cat.color : textSecondary,
|
||||
color: isSelected ? cat.color : scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -245,59 +191,70 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// ── Section message ────────────────────────────────────────────────────────
|
||||
|
||||
Widget _buildMessageSection() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withOpacity(0.05),
|
||||
blurRadius: 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
final scheme = Theme.of(context).colorScheme;
|
||||
final isNearLimit = _charCount > _kMaxLength * 0.85;
|
||||
return CoreCard(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.edit_note, color: textSecondary, size: 20),
|
||||
Icon(Icons.edit_note_outlined, color: scheme.onSurfaceVariant, size: 16),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'Votre message',
|
||||
style: AppTypography.headerSmall.copyWith(fontWeight: FontWeight.w600, color: textPrimary),
|
||||
'VOTRE MESSAGE',
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
letterSpacing: 1.1,
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
Text(
|
||||
'$_charCount / $_kMaxLength',
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
fontSize: 10,
|
||||
color: isNearLimit ? AppColors.error : scheme.onSurfaceVariant,
|
||||
fontWeight: isNearLimit ? FontWeight.bold : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 12),
|
||||
TextField(
|
||||
controller: _messageController,
|
||||
maxLines: 6,
|
||||
style: AppTypography.bodyTextSmall.copyWith(color: textPrimary),
|
||||
maxLines: 7,
|
||||
maxLength: _kMaxLength,
|
||||
buildCounter: (_, {required currentLength, required isFocused, maxLength}) =>
|
||||
const SizedBox.shrink(),
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
color: scheme.onSurface,
|
||||
fontSize: 13,
|
||||
),
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Décrivez votre suggestion, problème ou idée...',
|
||||
hintStyle: AppTypography.subtitleSmall.copyWith(color: textSecondary),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: isDark ? AppColors.darkBorder : Colors.grey[300]!),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: BorderSide(color: isDark ? AppColors.darkBorder : Colors.grey[300]!),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
borderSide: const BorderSide(color: AppColors.primaryGreen, width: 1.5),
|
||||
hintStyle: AppTypography.subtitleSmall.copyWith(
|
||||
color: scheme.onSurfaceVariant,
|
||||
),
|
||||
filled: true,
|
||||
fillColor: isDark ? AppColors.darkBackground : Colors.grey[50],
|
||||
alignLabelWithHint: true,
|
||||
fillColor: scheme.surfaceContainerHighest.withOpacity(0.4),
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: scheme.outlineVariant),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: scheme.outlineVariant),
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderSide: BorderSide(color: ModuleColors.support, width: 1.5),
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(12),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -305,6 +262,8 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
);
|
||||
}
|
||||
|
||||
// ── Bouton envoi ──────────────────────────────────────────────────────────
|
||||
|
||||
Widget _buildSubmitButton() {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
@@ -312,32 +271,34 @@ class _FeedbackPageState extends State<FeedbackPage> {
|
||||
onPressed: _isSending ? null : _submitFeedback,
|
||||
icon: _isSending
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2, color: Colors.white),
|
||||
)
|
||||
: const Icon(Icons.send, color: Colors.white),
|
||||
: const Icon(Icons.send_rounded, color: Colors.white, size: 16),
|
||||
label: Text(
|
||||
_isSending ? 'Envoi en cours...' : 'Envoyer le commentaire',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
style: AppTypography.actionText.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: AppColors.primaryGreen,
|
||||
backgroundColor: ModuleColors.support,
|
||||
disabledBackgroundColor: ModuleColors.support.withOpacity(0.5),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
// Modèle de catégorie
|
||||
// ─────────────────────────────────────────────────────────────────────────────
|
||||
|
||||
class _FeedbackCategory {
|
||||
final String id;
|
||||
final String label;
|
||||
|
||||
@@ -54,24 +54,27 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
_buildLanguageList(),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
_buildLanguageList(),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -81,15 +84,15 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
margin: const EdgeInsets.all(SpacingTokens.lg),
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
gradient: LinearGradient(
|
||||
colors: ModuleColors.parametresGradient,
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.xl),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
color: ModuleColors.parametres.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
@@ -142,12 +145,12 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
|
||||
Widget _buildLanguageList() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondary;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
color: isDark ? AppColors.surfaceDark : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
@@ -173,8 +176,8 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
Widget _buildLanguageTile(_LanguageOption lang) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final isSelected = _selectedLanguage == lang.name;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondary;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: InkWell(
|
||||
@@ -184,12 +187,12 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? AppColors.primaryGreen.withOpacity(0.08)
|
||||
: (isDark ? AppColors.darkBackground : Colors.grey[50]),
|
||||
? AppColors.primary.withOpacity(0.08)
|
||||
: (isDark ? AppColors.backgroundSubtleDark : AppColors.backgroundSubtle),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: isSelected
|
||||
? Border.all(color: AppColors.primaryGreen.withOpacity(0.4), width: 1.5)
|
||||
: Border.all(color: isDark ? AppColors.darkBorder : Colors.grey[200]!),
|
||||
? Border.all(color: AppColors.primary.withOpacity(0.4), width: 1.5)
|
||||
: Border.all(color: isDark ? AppColors.surfaceVariantDark : AppColors.surfaceVariant),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -203,7 +206,7 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
lang.name,
|
||||
style: AppTypography.bodyTextSmall.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? AppColors.primaryGreen : textPrimary,
|
||||
color: isSelected ? AppColors.primary : textPrimary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
@@ -214,7 +217,7 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
),
|
||||
),
|
||||
if (isSelected)
|
||||
const Icon(Icons.check_circle, color: AppColors.primaryGreen, size: 22),
|
||||
const Icon(Icons.check_circle, color: AppColors.primary, size: 22),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -224,12 +227,12 @@ class _LanguageSettingsPageState extends State<LanguageSettingsPage> {
|
||||
|
||||
Widget _buildInfoSection() {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondary;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
color: isDark ? AppColors.surfaceDark : Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
|
||||
@@ -62,26 +62,29 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
body: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
_buildVisibilitySection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildDataSection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildDangerSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
body: SafeArea(
|
||||
top: false,
|
||||
child: Column(
|
||||
children: [
|
||||
_buildHeader(),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
_buildVisibilitySection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildDataSection(),
|
||||
const SizedBox(height: 8),
|
||||
_buildDangerSection(),
|
||||
const SizedBox(height: 80),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -91,15 +94,15 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
margin: const EdgeInsets.all(SpacingTokens.lg),
|
||||
padding: const EdgeInsets.all(SpacingTokens.xxl),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
colors: [AppColors.brandGreen, AppColors.primaryGreen],
|
||||
gradient: LinearGradient(
|
||||
colors: ModuleColors.parametresGradient,
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(SpacingTokens.xl),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColors.primaryGreen.withOpacity(0.3),
|
||||
color: ModuleColors.parametres.withOpacity(0.3),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 8),
|
||||
),
|
||||
@@ -222,13 +225,13 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.05),
|
||||
color: AppColors.error.withOpacity(0.05),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: Colors.red.withOpacity(0.2)),
|
||||
border: Border.all(color: AppColors.error.withOpacity(0.2)),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.delete_forever, color: Colors.red, size: 20),
|
||||
const Icon(Icons.delete_forever, color: AppColors.error, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -239,7 +242,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.red,
|
||||
color: AppColors.error,
|
||||
),
|
||||
),
|
||||
Builder(
|
||||
@@ -248,7 +251,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
return Text(
|
||||
'Supprimer définitivement toutes vos données',
|
||||
style: AppTypography.subtitleSmall.copyWith(
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight,
|
||||
color: isDark ? AppColors.textSecondaryDark : AppColors.textSecondary,
|
||||
),
|
||||
);
|
||||
},
|
||||
@@ -256,7 +259,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
],
|
||||
),
|
||||
),
|
||||
const Icon(Icons.arrow_forward_ios, color: Colors.red, size: 16),
|
||||
const Icon(Icons.arrow_forward_ios, color: AppColors.error, size: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -271,7 +274,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Row(
|
||||
children: [
|
||||
Icon(Icons.warning, color: Colors.red),
|
||||
Icon(Icons.warning, color: AppColors.error),
|
||||
SizedBox(width: 8),
|
||||
Text('Supprimer le compte'),
|
||||
],
|
||||
@@ -293,8 +296,8 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
await launchUrl(uri, mode: LaunchMode.externalApplication);
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
child: const Text('Contacter l\'administrateur', style: TextStyle(color: Colors.white)),
|
||||
style: ElevatedButton.styleFrom(backgroundColor: AppColors.error),
|
||||
child: const Text('Contacter l\'administrateur', style: TextStyle(color: AppColors.onPrimary)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -303,12 +306,12 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
|
||||
Widget _buildSection(String title, String subtitle, IconData icon, List<Widget> children) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondary;
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkSurface : Colors.white,
|
||||
color: isDark ? AppColors.surfaceDark : AppColors.surface,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Column(
|
||||
@@ -352,17 +355,17 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
ValueChanged<bool> onChanged,
|
||||
) {
|
||||
final isDark = Theme.of(context).brightness == Brightness.dark;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimaryLight;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondaryLight;
|
||||
final textPrimary = isDark ? AppColors.textPrimaryDark : AppColors.textPrimary;
|
||||
final textSecondary = isDark ? AppColors.textSecondaryDark : AppColors.textSecondary;
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
decoration: BoxDecoration(
|
||||
color: isDark ? AppColors.darkBackground : Colors.grey[50],
|
||||
color: isDark ? AppColors.backgroundSubtleDark : AppColors.backgroundSubtle,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const Icon(Icons.toggle_on, color: AppColors.primaryGreen, size: 20),
|
||||
const Icon(Icons.toggle_on, color: AppColors.primary, size: 20),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -382,7 +385,7 @@ class _PrivacySettingsPageState extends State<PrivacySettingsPage> {
|
||||
Switch(
|
||||
value: value,
|
||||
onChanged: onChanged,
|
||||
activeTrackColor: AppColors.primaryGreen,
|
||||
activeTrackColor: AppColors.primary,
|
||||
thumbColor: WidgetStateProperty.resolveWith((states) =>
|
||||
states.contains(WidgetState.selected) ? Colors.white : null),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user