Compare commits

..

No commits in common. "030ef81038f891f80f0a587bdf46f86a2edad92e" and "6ad88cbbc6f0958d0a547b912ef6a47f8217c8cf" have entirely different histories.

3 changed files with 139 additions and 232 deletions

View File

@ -1,2 +1,2 @@
flutter.sdk=C:\\Users\\marti\\dev\\flutter flutter.sdk=/home/deploy/snap/flutter/common/flutter
sdk.dir=C:\\Users\\myhan\\AppData\\Local\\Android\\Sdk sdk.dir=C:\\Users\\myhan\\AppData\\Local\\Android\\Sdk

View File

@ -1,170 +1,164 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'dart:math' as math; // Pour la rotation du chevron import 'dart:math' as math; // Pour la rotation du chevron
import '../../widgets/choice_card_widget.dart'; // Import du nouveau widget import '../../widgets/hover_relief_widget.dart'; // Import du widget générique
import '../../widgets/custom_navigation_button.dart'; import '../../models/card_assets.dart'; // Import des enums de cartes
import '../../widgets/hover_relief_widget.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
// Screen for choosing between Parent and AM registration
class RegisterChoiceScreen extends StatelessWidget { class RegisterChoiceScreen extends StatelessWidget {
const RegisterChoiceScreen({super.key}); const RegisterChoiceScreen({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
body: LayoutBuilder( body: Stack(
builder: (context, constraints) {
final width = constraints.maxWidth;
final height = constraints.maxHeight;
final screenSize = Size(width, height);
// Utilisation de la largeur disponible pour déterminer le mode
// C'est plus fiable que MediaQuery si le widget est contraint
final isMobile = width < 900;
return Stack(
children: [
// Fond papier
Positioned.fill(
child: Image.asset(
'assets/images/paper2.png',
fit: BoxFit.cover,
repeat: ImageRepeat.repeat,
),
),
// Bouton Retour (chevron gauche) - Desktop uniquement
if (!isMobile)
Positioned(
top: 40,
left: 40,
child: IconButton(
icon: Transform.flip(
flipX: true,
child: Image.asset(
'assets/images/chevron_right.png',
height: 40
)
),
onPressed: () {
if (context.canPop()) {
context.pop();
} else {
context.go('/login');
}
},
tooltip: 'Retour',
),
),
// Contenu principal
isMobile
? _buildMobileLayout(context, screenSize)
: _buildDesktopLayout(context, screenSize),
],
);
},
),
);
}
Widget _buildDesktopLayout(BuildContext context, Size screenSize) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: screenSize.width * 0.05),
child: Row(
children: [ children: [
// Partie Gauche: Texte d'instruction centré // Fond papier
Expanded( Positioned.fill(
flex: 1, child: Image.asset(
child: Center( 'assets/images/paper2.png',
child: Text( fit: BoxFit.cover,
'Veuillez choisir votre\ntype de compte :', repeat: ImageRepeat.repeat,
style: GoogleFonts.merienda(
fontSize: 36,
fontWeight: FontWeight.bold,
color: Colors.black87,
height: 1.5,
),
textAlign: TextAlign.center,
),
), ),
), ),
// Espace entre les deux parties
SizedBox(width: screenSize.width * 0.05), // Bouton Retour (chevron gauche)
Positioned(
// Partie Droite: Carte rose avec les boutons top: 40,
Expanded( left: 40,
flex: 1, child: IconButton(
child: Center( icon: Transform.flip(flipX: true, child: Image.asset('assets/images/chevron_right.png', height: 40)),
child: ConstrainedBox( onPressed: () {
constraints: BoxConstraints( if (context.canPop()) {
maxHeight: screenSize.height * 0.78, context.pop();
), } else {
child: AspectRatio( context.go('/login');
aspectRatio: 2 / 3, }
child: ChoiceCardWidget( },
isMobile: false, tooltip: 'Retour',
onParentSelected: () => context.go('/parent-register-step1'), ),
onAmSelected: () => context.go('/am-register-step1'), ),
// Contenu principal en Row (Gauche / Droite)
Padding(
padding: EdgeInsets.symmetric(horizontal: screenSize.width * 0.05),
child: Row(
children: [
// Partie Gauche: Texte d'instruction centré
Expanded(
flex: 1,
child: Center(
child: Text(
'Veuillez choisir votre\ntype de compte :',
style: GoogleFonts.merienda(
fontSize: 36,
fontWeight: FontWeight.bold,
color: Colors.black87,
height: 1.5,
),
textAlign: TextAlign.center,
),
), ),
), ),
), // Espace entre les deux parties
SizedBox(width: screenSize.width * 0.05),
// Partie Droite: Carte rose avec les boutons
Expanded(
flex: 1,
child: Center(
child: ConstrainedBox(
constraints: BoxConstraints(
maxHeight: screenSize.height * 0.78, // Augmenté pour éviter l'overflow
),
child: AspectRatio(
aspectRatio: 2 / 3,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(CardColorVertical.pink.path),
fit: BoxFit.fill,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// Bouton "Parents" avec HoverReliefWidget appliqué uniquement à l'image
_buildChoiceButton(
context: context,
iconPath: 'assets/images/icon_parents.png',
label: 'Parents',
onPressed: () {
context.go('/parent-register-step1');
},
),
// Bouton "Assistante Maternelle" avec HoverReliefWidget appliqué uniquement à l'image
_buildChoiceButton(
context: context,
iconPath: 'assets/images/icon_assmat.png',
label: 'Assistante Maternelle',
onPressed: () {
context.go('/am-register-step1');
},
),
],
),
),
),
),
),
),
],
), ),
), ),
], ],
), ),
); );
} }
}
Widget _buildMobileLayout(BuildContext context, Size screenSize) { // Nouvelle méthode helper pour construire les boutons de choix
return Center( Widget _buildChoiceButton({
child: SingleChildScrollView( required BuildContext context,
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20), required String iconPath,
child: Column( required String label,
mainAxisAlignment: MainAxisAlignment.center, required VoidCallback onPressed,
children: [ }) {
Text( // TODO: Déterminer la couleur de base de card_rose.png et ajuster ces couleurs d'ombre
'Veuillez choisir votre\ntype de compte :', final Color baseRoseColor = Colors.pink.shade300; // Placeholder
style: GoogleFonts.merienda( final Color initialShadow = baseRoseColor.withAlpha(90); // Rose plus foncé et transparent pour l'ombre initiale
fontSize: 24, final Color hoverShadow = baseRoseColor.withAlpha(130); // Rose encore plus foncé pour l'ombre au survol
fontWeight: FontWeight.bold,
color: Colors.black87, return Column(
height: 1.3, mainAxisSize: MainAxisSize.min,
), children: [
textAlign: TextAlign.center, HoverReliefWidget(
), onPressed: onPressed,
const SizedBox(height: 30), borderRadius: BorderRadius.circular(15.0),
// Carte rose verticale adaptative initialShadowColor: initialShadow, // Ombre rose initiale
ChoiceCardWidget( hoverShadowColor: hoverShadow, // Ombre rose au survol
isMobile: true, child: Padding(
onParentSelected: () => context.go('/parent-register-step1'), padding: const EdgeInsets.all(8.0),
onAmSelected: () => context.go('/am-register-step1'), child: Image.asset(iconPath, height: 140),
),
const SizedBox(height: 30),
// Bouton Précédent
SizedBox(
width: double.infinity,
child: HoverReliefWidget(
child: CustomNavigationButton(
text: 'Précédent',
style: NavigationButtonStyle.purple,
onPressed: () {
if (context.canPop()) {
context.pop();
} else {
context.go('/login');
}
},
width: double.infinity,
height: 50,
fontSize: 16,
),
),
),
],
), ),
), ),
); const SizedBox(height: 15),
} Text(
label,
style: GoogleFonts.merienda(
fontSize: 26,
fontWeight: FontWeight.w600,
color: Colors.black.withOpacity(0.85),
),
textAlign: TextAlign.center,
),
],
);
} }
// --- La classe HoverChoiceButton peut maintenant être supprimée si elle n'est plus utilisée ailleurs ---
// class HoverChoiceButton extends StatefulWidget { ... }
// class _HoverChoiceButtonState extends State<HoverChoiceButton> { ... }

View File

@ -1,87 +0,0 @@
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import '../models/card_assets.dart';
import 'hover_relief_widget.dart';
// Widget for the registration choice card (Parent vs AM)
class ChoiceCardWidget extends StatelessWidget {
final VoidCallback onParentSelected;
final VoidCallback onAmSelected;
final bool isMobile;
const ChoiceCardWidget({
super.key,
required this.onParentSelected,
required this.onAmSelected,
this.isMobile = false,
});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(CardColorVertical.pink.path),
fit: BoxFit.fill,
),
borderRadius: BorderRadius.circular(15),
),
child: Column(
mainAxisAlignment: isMobile ? MainAxisAlignment.center : MainAxisAlignment.spaceEvenly,
children: [
_buildChoiceButton(
iconPath: 'assets/images/icon_parents.png',
label: 'Parents',
onPressed: onParentSelected,
isMobile: isMobile,
),
SizedBox(height: isMobile ? 30 : 0),
_buildChoiceButton(
iconPath: 'assets/images/icon_assmat.png',
label: 'Assistante Maternelle',
onPressed: onAmSelected,
isMobile: isMobile,
),
],
),
);
}
Widget _buildChoiceButton({
required String iconPath,
required String label,
required VoidCallback onPressed,
required bool isMobile,
}) {
final Color baseRoseColor = Colors.pink.shade300;
final Color initialShadow = baseRoseColor.withAlpha(90);
final Color hoverShadow = baseRoseColor.withAlpha(130);
return Column(
mainAxisSize: MainAxisSize.min,
children: [
HoverReliefWidget(
onPressed: onPressed,
borderRadius: BorderRadius.circular(15.0),
initialShadowColor: initialShadow,
hoverShadowColor: hoverShadow,
child: Padding(
padding: EdgeInsets.all(isMobile ? 6.0 : 8.0),
child: Image.asset(iconPath, height: isMobile ? 100 : 140),
),
),
SizedBox(height: isMobile ? 10 : 15),
Text(
label,
style: GoogleFonts.merienda(
fontSize: isMobile ? 20 : 26,
fontWeight: FontWeight.w600,
color: Colors.black.withOpacity(0.85),
),
textAlign: TextAlign.center,
),
],
);
}
}