- Support des modes Desktop/Mobile et Édition/Lecture seule - Refactoring des widgets de formulaire (PersonalInfo, ProfessionalInfo, Presentation, ChildCard) - Mise à jour des écrans de récapitulatif (ParentStep5, AmStep4) - Ajout de navigation (Précédent/Soumettre) sur mobile Closes #78 Co-authored-by: Cursor <cursoragent@cursor.com>
88 lines
2.2 KiB
Dart
88 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
/// Style de bouton de navigation
|
|
enum NavigationButtonStyle {
|
|
green, // Bouton vert avec texte vert foncé
|
|
purple, // Bouton violet avec texte violet foncé
|
|
}
|
|
|
|
/// Widget de bouton de navigation personnalisé
|
|
/// Utilise les assets existants pour le fond
|
|
class CustomNavigationButton extends StatelessWidget {
|
|
final String text;
|
|
final VoidCallback onPressed;
|
|
final NavigationButtonStyle style;
|
|
final double? width;
|
|
final double height;
|
|
final double fontSize;
|
|
|
|
const CustomNavigationButton({
|
|
super.key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
this.style = NavigationButtonStyle.green,
|
|
this.width,
|
|
this.height = 50,
|
|
this.fontSize = 16,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final backgroundImage = _getBackgroundImage();
|
|
final textColor = _getTextColor();
|
|
|
|
return SizedBox(
|
|
width: width,
|
|
height: height,
|
|
child: Stack(
|
|
children: [
|
|
// Fond avec image
|
|
Positioned.fill(
|
|
child: Image.asset(
|
|
backgroundImage,
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
// Bouton cliquable
|
|
Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
onTap: onPressed,
|
|
borderRadius: BorderRadius.circular(8),
|
|
child: Center(
|
|
child: Text(
|
|
text,
|
|
style: GoogleFonts.merienda(
|
|
color: textColor,
|
|
fontSize: fontSize,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
String _getBackgroundImage() {
|
|
switch (style) {
|
|
case NavigationButtonStyle.green:
|
|
return 'assets/images/bg_green.png';
|
|
case NavigationButtonStyle.purple:
|
|
return 'assets/images/bg_lavender.png';
|
|
}
|
|
}
|
|
|
|
Color _getTextColor() {
|
|
switch (style) {
|
|
case NavigationButtonStyle.green:
|
|
return const Color(0xFF2E7D32); // Vert foncé
|
|
case NavigationButtonStyle.purple:
|
|
return const Color(0xFF5E35B1); // Violet foncé
|
|
}
|
|
}
|
|
}
|