Statistiques — refonte complète, aucun changement backend statistics_screen.dart réécrit (+1832) : barres horizontales monochromes à la place des barres verticales tronquées et des deux anneaux, barre de filtres unique avec les volumes par canal, règle mono-canal, 4 KPI portant chacun leur variation, bandeau « à retenir », courbe en aire avec bandes de week-end. La période précédente s'obtient en rappelant le même endpoint. statistics_report.dart : export PDF généré côté client (paquet pdf Dart), il partage les valeurs calculées de l'écran — un chiffre ne peut pas diverger entre l'écran et le document envoyé à la commune. Deux puces du sommaire promettaient des données inexistantes (parcours terminés, questions au guide IA), retirées. ⚠️ Jamais ouvert dans un navigateur. Cases de test : test-plan.md §8bis / §8ter. Guide IA Screens/GuideIa/guide_ia_screen.dart — onglet Configuration. Menu conditionné à isAssistant, le même drapeau que la garde d'AiController. L'onglet « Ce que demandent vos visiteurs » n'est pas dans ce commit : le schéma backend est prêt, l'UI non. Onboarding self-service Screens/Auth/ (mot de passe oublié, définition du mot de passe), Screens/Billing/subscription_screen.dart, ai_quota_hint.dart. ⚠️ Aucun parcours joué de bout en bout — test-plan.md §18. Parcours guidés progression_mode.dart : 9 booléens sur 3 niveaux remplacés par 3 questions. Popups GuidedPath / GuidedStep / QuizQuestion mises à jour en conséquence. Client API (manager_api_new) — édité À LA MAIN, ne pas relancer la génération onboarding_api.dart, authentication_api.dart (+80), instance_dto (champs Guide*), guided_step / quiz_question_guided_step (flags morts retirés). Le // @dart=2.18 manquant dans onboarding_api.dart cassait les 3 apps Flutter d'un coup — corrigé ici. i18n : ~180 clés par langue (FR/EN/NL) + fichiers générés. Tests : progression_mode_test, statistics_report_test (le second a attrapé deux plantages qui seraient sortis au premier clic). flutter build web ✅. flutter analyze : 68 erreurs, toutes dans les fichiers modèle orphelins de manager_api_new — dette connue, pas une régression, ces fichiers ne sont pas dans le graphe de compilation.
152 lines
5.8 KiB
Dart
152 lines
5.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:manager_app/Components/common_loader.dart';
|
|
import 'package:manager_app/Components/message_notification.dart';
|
|
import 'package:manager_app/Components/rounded_button.dart';
|
|
import 'package:manager_app/Components/rounded_input_field.dart';
|
|
import 'package:manager_app/client.dart';
|
|
import 'package:manager_app/constants.dart';
|
|
import 'package:manager_app/l10n/app_localizations.dart';
|
|
|
|
class ForgotPasswordScreen extends StatefulWidget {
|
|
ForgotPasswordScreen({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
_ForgotPasswordScreenState createState() => _ForgotPasswordScreenState();
|
|
}
|
|
|
|
class _ForgotPasswordScreenState extends State<ForgotPasswordScreen> {
|
|
final String host = "http://localhost:5000";
|
|
String email = "";
|
|
bool isLoading = false;
|
|
bool isSent = false;
|
|
|
|
Future<void> submit() async {
|
|
if (email.trim().isEmpty) return;
|
|
|
|
setState(() => isLoading = true);
|
|
try {
|
|
final clientAPI = Client(host);
|
|
await clientAPI.authenticationApi!.authenticationForgotPassword(email.trim());
|
|
setState(() {
|
|
isSent = true;
|
|
isLoading = false;
|
|
});
|
|
} catch (e) {
|
|
setState(() => isLoading = false);
|
|
showNotification(Colors.orange, kWhite, AppLocalizations.of(context)!.loginError, context, null);
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l = AppLocalizations.of(context)!;
|
|
|
|
return Scaffold(
|
|
body: LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
final isMobile = constraints.maxWidth < 550;
|
|
final cardWidth = isMobile ? constraints.maxWidth - 32.0 : 440.0;
|
|
|
|
return Container(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [
|
|
kPrimaryColor.withValues(alpha: 0.12),
|
|
kBackgroundColor,
|
|
kBackgroundColor,
|
|
],
|
|
),
|
|
),
|
|
child: Center(
|
|
child: SingleChildScrollView(
|
|
padding: EdgeInsets.all(isMobile ? 16.0 : 24.0),
|
|
child: Container(
|
|
width: cardWidth,
|
|
decoration: BoxDecoration(
|
|
color: kWhite,
|
|
borderRadius: BorderRadius.circular(16.0),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.black.withValues(alpha: 0.08),
|
|
spreadRadius: 0,
|
|
blurRadius: 32,
|
|
offset: Offset(0, 8),
|
|
),
|
|
],
|
|
),
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: isMobile ? 24.0 : 40.0, vertical: 40.0),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Container(
|
|
constraints: BoxConstraints(maxHeight: 64, minHeight: 40),
|
|
child: SvgPicture.asset('assets/images/MyInfoMate_logo_only.svg'),
|
|
),
|
|
SizedBox(height: 24),
|
|
if (!isSent) ...[
|
|
Text(
|
|
l.forgotPasswordTitle,
|
|
style: TextStyle(color: kPrimaryColor, fontSize: 22, fontWeight: FontWeight.w600),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(height: 8),
|
|
Text(
|
|
l.forgotPasswordDesc,
|
|
style: TextStyle(fontSize: 14, color: Colors.grey[700]),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
SizedBox(height: 24),
|
|
RoundedInputField(
|
|
hintText: "E-mail",
|
|
autofill: "email",
|
|
isEmail: true,
|
|
initialValue: email,
|
|
onChanged: (value) => email = value,
|
|
),
|
|
SizedBox(height: 24),
|
|
!isLoading
|
|
? SizedBox(
|
|
width: double.infinity,
|
|
child: RoundedButton(
|
|
text: l.forgotPasswordSubmit,
|
|
fontSize: 16,
|
|
vertical: 15,
|
|
horizontal: 30,
|
|
press: submit,
|
|
),
|
|
)
|
|
: CommonLoader(iconSize: 40),
|
|
] else ...[
|
|
Icon(Icons.mark_email_read_outlined, color: kSuccess, size: 48),
|
|
SizedBox(height: 16),
|
|
Text(
|
|
l.forgotPasswordSuccess,
|
|
style: TextStyle(fontSize: 15),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
],
|
|
SizedBox(height: 24),
|
|
TextButton(
|
|
onPressed: () => context.go('/login'),
|
|
child: Text(l.backToLogin, style: TextStyle(color: kPrimaryColor)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
}
|