fix(#78): Ajustements UI ChildCardWidget et ParentStep3
- Réduction de la taille des polices et des champs dans la carte enfant (Mobile/Desktop) pour éviter l'overflow. - Restauration de la taille du bouton "+" en mode Desktop (100px). Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
eea94769bf
commit
6452706680
@ -433,12 +433,12 @@ class _ParentRegisterStep3ScreenState extends State<ParentRegisterStep3Screen> {
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// Bouton Ajouter
|
||||
// Bouton Ajouter Desktop (Gros bouton)
|
||||
return Center(
|
||||
child: HoverReliefWidget(
|
||||
onPressed: () => _addChild(registrationData),
|
||||
borderRadius: BorderRadius.circular(15),
|
||||
child: Image.asset('assets/images/plus.png', height: 80, width: 80),
|
||||
child: Image.asset('assets/images/plus.png', height: 100, width: 100, fit: BoxFit.contain),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import '../models/user_registration_data.dart';
|
||||
import '../models/card_assets.dart';
|
||||
import 'custom_app_text_field.dart';
|
||||
import 'form_field_wrapper.dart';
|
||||
import 'app_custom_checkbox.dart';
|
||||
import 'hover_relief_widget.dart';
|
||||
import '../config/display_config.dart';
|
||||
@ -23,6 +24,8 @@ class ChildCardWidget extends StatefulWidget {
|
||||
final ValueChanged<bool> onToggleIsUnborn;
|
||||
final VoidCallback onRemove;
|
||||
final bool canBeRemoved;
|
||||
final DisplayMode mode;
|
||||
final VoidCallback? onEdit;
|
||||
|
||||
const ChildCardWidget({
|
||||
required Key key,
|
||||
@ -37,6 +40,8 @@ class ChildCardWidget extends StatefulWidget {
|
||||
required this.onToggleIsUnborn,
|
||||
required this.onRemove,
|
||||
required this.canBeRemoved,
|
||||
this.mode = DisplayMode.editable,
|
||||
this.onEdit,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
@ -88,7 +93,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final config = DisplayConfig.fromContext(context);
|
||||
final config = DisplayConfig.fromContext(context, mode: widget.mode);
|
||||
final scaleFactor = config.isMobile ? 0.9 : 1.1; // Réduire légèrement sur mobile
|
||||
|
||||
final File? currentChildImage = widget.childData.imageFile;
|
||||
@ -101,7 +106,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
|
||||
return Container(
|
||||
width: 345.0 * scaleFactor,
|
||||
height: config.isMobile ? null : 570.0 * scaleFactor, // Hauteur auto sur mobile
|
||||
height: config.isMobile ? null : 600.0 * scaleFactor, // Hauteur augmentée pour éviter l'overflow
|
||||
padding: EdgeInsets.all(22.0 * scaleFactor),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(image: AssetImage(widget.childData.cardColor.path), fit: BoxFit.fill),
|
||||
@ -113,7 +118,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
HoverReliefWidget(
|
||||
onPressed: widget.onPickImage,
|
||||
onPressed: config.isReadonly ? null : widget.onPickImage,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
initialShadowColor: initialPhotoShadow,
|
||||
hoverShadowColor: hoverPhotoShadow,
|
||||
@ -130,7 +135,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12.0 * scaleFactor),
|
||||
SizedBox(height: 10.0 * scaleFactor), // Réduit de 12 à 10
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@ -143,58 +148,58 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
),
|
||||
Transform.scale(
|
||||
scale: config.isMobile ? 0.8 : 1.0,
|
||||
child: Switch(value: widget.childData.isUnbornChild, onChanged: widget.onToggleIsUnborn, activeColor: Theme.of(context).primaryColor),
|
||||
child: Switch(
|
||||
value: widget.childData.isUnbornChild,
|
||||
onChanged: config.isReadonly ? null : widget.onToggleIsUnborn,
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 9.0 * scaleFactor),
|
||||
CustomAppTextField(
|
||||
SizedBox(height: 8.0 * scaleFactor), // Réduit de 9 à 8
|
||||
_buildField(
|
||||
config: config,
|
||||
scaleFactor: scaleFactor,
|
||||
label: 'Prénom',
|
||||
controller: _firstNameController,
|
||||
labelText: 'Prénom',
|
||||
hintText: 'Facultatif si à naître',
|
||||
hint: 'Facultatif si à naître',
|
||||
isRequired: !widget.childData.isUnbornChild,
|
||||
fieldHeight: config.isMobile ? 45.0 : 55.0 * scaleFactor,
|
||||
labelFontSize: config.isMobile ? 14.0 : 22.0, // Police réduite mobile
|
||||
inputFontSize: config.isMobile ? 14.0 : 20.0,
|
||||
),
|
||||
SizedBox(height: 6.0 * scaleFactor),
|
||||
CustomAppTextField(
|
||||
SizedBox(height: 5.0 * scaleFactor), // Réduit de 6 à 5
|
||||
_buildField(
|
||||
config: config,
|
||||
scaleFactor: scaleFactor,
|
||||
label: 'Nom',
|
||||
controller: _lastNameController,
|
||||
labelText: 'Nom',
|
||||
hintText: 'Nom de l\'enfant',
|
||||
enabled: true,
|
||||
fieldHeight: config.isMobile ? 45.0 : 55.0 * scaleFactor,
|
||||
labelFontSize: config.isMobile ? 14.0 : 22.0,
|
||||
inputFontSize: config.isMobile ? 14.0 : 20.0,
|
||||
hint: 'Nom de l\'enfant',
|
||||
),
|
||||
SizedBox(height: 9.0 * scaleFactor),
|
||||
CustomAppTextField(
|
||||
SizedBox(height: 8.0 * scaleFactor), // Réduit de 9 à 8
|
||||
_buildField(
|
||||
config: config,
|
||||
scaleFactor: scaleFactor,
|
||||
label: widget.childData.isUnbornChild ? 'Date prévisionnelle de naissance' : 'Date de naissance',
|
||||
controller: _dobController,
|
||||
labelText: widget.childData.isUnbornChild ? 'Date prévisionnelle de naissance' : 'Date de naissance',
|
||||
hintText: 'JJ/MM/AAAA',
|
||||
readOnly: true,
|
||||
onTap: widget.onDateSelect,
|
||||
hint: 'JJ/MM/AAAA',
|
||||
readOnly: true, // Toujours readonly pour le TextField (date picker)
|
||||
onTap: config.isReadonly ? null : widget.onDateSelect,
|
||||
suffixIcon: Icons.calendar_today,
|
||||
fieldHeight: config.isMobile ? 45.0 : 55.0 * scaleFactor,
|
||||
labelFontSize: config.isMobile ? 14.0 : 22.0,
|
||||
inputFontSize: config.isMobile ? 14.0 : 20.0,
|
||||
),
|
||||
SizedBox(height: 11.0 * scaleFactor),
|
||||
SizedBox(height: 10.0 * scaleFactor), // Réduit de 11 à 10
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppCustomCheckbox(
|
||||
label: 'Consentement photo',
|
||||
value: widget.childData.photoConsent,
|
||||
onChanged: widget.onTogglePhotoConsent,
|
||||
onChanged: config.isReadonly ? (v) {} : widget.onTogglePhotoConsent,
|
||||
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
||||
fontSize: config.isMobile ? 13.0 : 16.0,
|
||||
),
|
||||
SizedBox(height: 6.0 * scaleFactor),
|
||||
SizedBox(height: 5.0 * scaleFactor), // Réduit de 6 à 5
|
||||
AppCustomCheckbox(
|
||||
label: 'Naissance multiple',
|
||||
value: widget.childData.multipleBirth,
|
||||
onChanged: widget.onToggleMultipleBirth,
|
||||
onChanged: config.isReadonly ? (v) {} : widget.onToggleMultipleBirth,
|
||||
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
||||
fontSize: config.isMobile ? 13.0 : 16.0,
|
||||
),
|
||||
@ -202,7 +207,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
),
|
||||
],
|
||||
),
|
||||
if (widget.canBeRemoved)
|
||||
if (widget.canBeRemoved && !config.isReadonly)
|
||||
Positioned(
|
||||
top: -5, right: -5,
|
||||
child: InkWell(
|
||||
@ -216,8 +221,51 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
if (config.isReadonly && widget.onEdit != null)
|
||||
Positioned(
|
||||
top: -5, right: -5,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.edit, color: Colors.black54),
|
||||
onPressed: widget.onEdit,
|
||||
tooltip: 'Modifier',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildField({
|
||||
required DisplayConfig config,
|
||||
required double scaleFactor,
|
||||
required String label,
|
||||
required TextEditingController controller,
|
||||
String? hint,
|
||||
bool isRequired = false,
|
||||
bool readOnly = false,
|
||||
VoidCallback? onTap,
|
||||
IconData? suffixIcon,
|
||||
}) {
|
||||
if (config.isReadonly) {
|
||||
return FormFieldWrapper(
|
||||
config: config,
|
||||
label: label,
|
||||
value: controller.text,
|
||||
);
|
||||
} else {
|
||||
return CustomAppTextField(
|
||||
controller: controller,
|
||||
labelText: label,
|
||||
hintText: hint ?? label,
|
||||
isRequired: isRequired,
|
||||
fieldHeight: config.isMobile ? 40.0 : 50.0 * scaleFactor, // Hauteur réduite
|
||||
labelFontSize: config.isMobile ? 12.0 : 18.0, // Police réduite
|
||||
inputFontSize: config.isMobile ? 13.0 : 16.0, // Police réduite
|
||||
readOnly: readOnly,
|
||||
onTap: onTap,
|
||||
suffixIcon: suffixIcon,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user