feat: Avancée majeure parcours inscription parent et refactorisation widgets UI

Ce commit comprend plusieurs améliorations significatives :

Inscription Parent - Étape 5 (Récapitulatif) :
- Initialisation de l'écran pour l'étape 5/5 du parcours d'inscription parent.
- Mise en place de la structure de base de l'écran de récapitulatif (titre, fond, bouton de soumission initial, modale de confirmation).
- Intégration de la navigation vers l'étape 5 depuis l'étape 4, incluant le passage (actuellement factice) des données d'inscription.
- Correction des erreurs de navigation et de typage liées à l'introduction de `PlaceholderRegistrationData` pour cette nouvelle étape.

Refactorisation des Widgets UI :
- `CustomAppTextField` :
    - Évolution majeure pour supporter différents styles de fond (beige, lavande, jaune) via un nouvel enum `CustomAppTextFieldStyle`.
    - Les images de fond pour les styles lavande et jaune (`input_field_lavande.png`, `input_field_jaune.png`) ont été renommées et sont maintenant utilisées.
    - Mise à jour de l'écran de login pour utiliser ce `CustomAppTextField` stylisé, remplaçant l'ancien widget privé `_ImageTextField`.
    - Réintégration des paramètres `isRequired`, `enabled`, `readOnly`, `onTap`, et `suffixIcon` qui avaient été omis lors d'une refactorisation précédente, assurant la compatibilité avec l'étape 3.
- `ImageButton` :
    - Extraction du widget privé `_ImageButton` de l'écran de login en un widget public `ImageButton` (dans `widgets/image_button.dart`) pour une réutilisation globale.
    - Mise à jour de l'écran de login pour utiliser ce nouveau widget public.
    - Utilisation du nouveau `ImageButton` pour le bouton "Soumettre ma demande" sur l'écran de l'étape 5.

Corrections :
- Correction d'une erreur de `RenderFlex overflowed` dans la carte enfant (`_ChildCardWidget`) de l'étape 3 de l'inscription parent, en ajustant les espacements internes.
- Résolution de diverses erreurs de compilation qui sont apparues pendant ces refactorisations.
This commit is contained in:
Julien Martin
2025-05-07 17:43:07 +02:00
parent 0772f83369
commit acb602643a
10 changed files with 336 additions and 226 deletions
+18 -158
View File
@@ -5,6 +5,8 @@ import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:url_launcher/url_launcher.dart';
import 'package:p_tits_pas/services/bug_report_service.dart';
import 'package:go_router/go_router.dart';
import '../../widgets/image_button.dart';
import '../../widgets/custom_app_text_field.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@@ -103,68 +105,40 @@ class _LoginPageState extends State<LoginPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
// Labels au-dessus des champs
// Champs côte à côte
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
'Email',
style: GoogleFonts.merienda(
fontSize: 20,
color: Colors.black87,
fontWeight: FontWeight.w600,
),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20),
child: Text(
'Mot de passe',
style: GoogleFonts.merienda(
fontSize: 20,
color: Colors.black87,
fontWeight: FontWeight.w600,
),
),
),
),
],
),
const SizedBox(height: 10),
// Champs côte à côte
Row(
children: [
Expanded(
child: _ImageTextField(
bg: 'assets/images/field_email.png',
width: 400,
height: 53,
hint: 'Email',
child: CustomAppTextField(
controller: _emailController,
labelText: 'Email',
hintText: 'Votre adresse email',
validator: _validateEmail,
style: CustomAppTextFieldStyle.lavande,
fieldHeight: 53,
fieldWidth: double.infinity,
),
),
const SizedBox(width: 20),
Expanded(
child: _ImageTextField(
bg: 'assets/images/field_password.png',
width: 400,
height: 53,
hint: 'Mot de passe',
obscure: true,
child: CustomAppTextField(
controller: _passwordController,
labelText: 'Mot de passe',
hintText: 'Votre mot de passe',
obscureText: true,
validator: _validatePassword,
style: CustomAppTextFieldStyle.jaune,
fieldHeight: 53,
fieldWidth: double.infinity,
),
),
],
),
const SizedBox(height: 20), // Réduit l'espacement
const SizedBox(height: 20),
// Bouton centré
Center(
child: _ImageButton(
child: ImageButton(
bg: 'assets/images/btn_green.png',
width: 300,
height: 40,
@@ -393,120 +367,6 @@ class ImageDimensions {
ImageDimensions({required this.width, required this.height});
}
// ───────────────────────────────────────────────────────────────
// Champ texte avec fond image
// ───────────────────────────────────────────────────────────────
class _ImageTextField extends StatelessWidget {
final String bg;
final double width;
final double height;
final String hint;
final bool obscure;
final TextEditingController? controller;
final String? Function(String?)? validator;
const _ImageTextField({
required this.bg,
required this.width,
required this.height,
required this.hint,
this.obscure = false,
this.controller,
this.validator,
});
@override
Widget build(BuildContext context) {
return Container(
width: width,
height: height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(bg),
fit: BoxFit.fill,
),
),
child: TextFormField(
controller: controller,
obscureText: obscure,
textAlign: TextAlign.left,
style: GoogleFonts.merienda(
fontSize: height * 0.25,
color: Colors.black87,
),
validator: validator,
decoration: InputDecoration(
border: InputBorder.none,
hintText: hint,
hintStyle: GoogleFonts.merienda(
fontSize: height * 0.25,
color: Colors.black38,
),
contentPadding: EdgeInsets.symmetric(
horizontal: width * 0.1,
vertical: height * 0.3,
),
errorStyle: GoogleFonts.merienda(
fontSize: height * 0.2,
color: Colors.red,
),
),
),
);
}
}
// ───────────────────────────────────────────────────────────────
// Bouton avec fond image
// ───────────────────────────────────────────────────────────────
class _ImageButton extends StatelessWidget {
final String bg;
final double width;
final double height;
final String text;
final Color textColor;
final VoidCallback onPressed;
const _ImageButton({
required this.bg,
required this.width,
required this.height,
required this.text,
required this.textColor,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return Container(
width: width,
height: height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(bg),
fit: BoxFit.fill,
),
),
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: onPressed,
child: Center(
child: Text(
text,
style: GoogleFonts.merienda(
fontSize: height * 0.4,
color: textColor,
fontWeight: FontWeight.w600,
),
),
),
),
),
);
}
}
// ───────────────────────────────────────────────────────────────
// Lien du pied de page
// ───────────────────────────────────────────────────────────────