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 {
|
} else {
|
||||||
// Bouton Ajouter
|
// Bouton Ajouter Desktop (Gros bouton)
|
||||||
return Center(
|
return Center(
|
||||||
child: HoverReliefWidget(
|
child: HoverReliefWidget(
|
||||||
onPressed: () => _addChild(registrationData),
|
onPressed: () => _addChild(registrationData),
|
||||||
borderRadius: BorderRadius.circular(15),
|
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/user_registration_data.dart';
|
||||||
import '../models/card_assets.dart';
|
import '../models/card_assets.dart';
|
||||||
import 'custom_app_text_field.dart';
|
import 'custom_app_text_field.dart';
|
||||||
|
import 'form_field_wrapper.dart';
|
||||||
import 'app_custom_checkbox.dart';
|
import 'app_custom_checkbox.dart';
|
||||||
import 'hover_relief_widget.dart';
|
import 'hover_relief_widget.dart';
|
||||||
import '../config/display_config.dart';
|
import '../config/display_config.dart';
|
||||||
@ -23,6 +24,8 @@ class ChildCardWidget extends StatefulWidget {
|
|||||||
final ValueChanged<bool> onToggleIsUnborn;
|
final ValueChanged<bool> onToggleIsUnborn;
|
||||||
final VoidCallback onRemove;
|
final VoidCallback onRemove;
|
||||||
final bool canBeRemoved;
|
final bool canBeRemoved;
|
||||||
|
final DisplayMode mode;
|
||||||
|
final VoidCallback? onEdit;
|
||||||
|
|
||||||
const ChildCardWidget({
|
const ChildCardWidget({
|
||||||
required Key key,
|
required Key key,
|
||||||
@ -37,6 +40,8 @@ class ChildCardWidget extends StatefulWidget {
|
|||||||
required this.onToggleIsUnborn,
|
required this.onToggleIsUnborn,
|
||||||
required this.onRemove,
|
required this.onRemove,
|
||||||
required this.canBeRemoved,
|
required this.canBeRemoved,
|
||||||
|
this.mode = DisplayMode.editable,
|
||||||
|
this.onEdit,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -88,7 +93,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
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 scaleFactor = config.isMobile ? 0.9 : 1.1; // Réduire légèrement sur mobile
|
||||||
|
|
||||||
final File? currentChildImage = widget.childData.imageFile;
|
final File? currentChildImage = widget.childData.imageFile;
|
||||||
@ -101,7 +106,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 345.0 * scaleFactor,
|
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),
|
padding: EdgeInsets.all(22.0 * scaleFactor),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(image: AssetImage(widget.childData.cardColor.path), fit: BoxFit.fill),
|
image: DecorationImage(image: AssetImage(widget.childData.cardColor.path), fit: BoxFit.fill),
|
||||||
@ -113,7 +118,7 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
HoverReliefWidget(
|
HoverReliefWidget(
|
||||||
onPressed: widget.onPickImage,
|
onPressed: config.isReadonly ? null : widget.onPickImage,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
initialShadowColor: initialPhotoShadow,
|
initialShadowColor: initialPhotoShadow,
|
||||||
hoverShadowColor: hoverPhotoShadow,
|
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(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -143,58 +148,58 @@ class _ChildCardWidgetState extends State<ChildCardWidget> {
|
|||||||
),
|
),
|
||||||
Transform.scale(
|
Transform.scale(
|
||||||
scale: config.isMobile ? 0.8 : 1.0,
|
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),
|
SizedBox(height: 8.0 * scaleFactor), // Réduit de 9 à 8
|
||||||
CustomAppTextField(
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
scaleFactor: scaleFactor,
|
||||||
|
label: 'Prénom',
|
||||||
controller: _firstNameController,
|
controller: _firstNameController,
|
||||||
labelText: 'Prénom',
|
hint: 'Facultatif si à naître',
|
||||||
hintText: 'Facultatif si à naître',
|
|
||||||
isRequired: !widget.childData.isUnbornChild,
|
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),
|
SizedBox(height: 5.0 * scaleFactor), // Réduit de 6 à 5
|
||||||
CustomAppTextField(
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
scaleFactor: scaleFactor,
|
||||||
|
label: 'Nom',
|
||||||
controller: _lastNameController,
|
controller: _lastNameController,
|
||||||
labelText: 'Nom',
|
hint: 'Nom de l\'enfant',
|
||||||
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,
|
|
||||||
),
|
),
|
||||||
SizedBox(height: 9.0 * scaleFactor),
|
SizedBox(height: 8.0 * scaleFactor), // Réduit de 9 à 8
|
||||||
CustomAppTextField(
|
_buildField(
|
||||||
|
config: config,
|
||||||
|
scaleFactor: scaleFactor,
|
||||||
|
label: widget.childData.isUnbornChild ? 'Date prévisionnelle de naissance' : 'Date de naissance',
|
||||||
controller: _dobController,
|
controller: _dobController,
|
||||||
labelText: widget.childData.isUnbornChild ? 'Date prévisionnelle de naissance' : 'Date de naissance',
|
hint: 'JJ/MM/AAAA',
|
||||||
hintText: 'JJ/MM/AAAA',
|
readOnly: true, // Toujours readonly pour le TextField (date picker)
|
||||||
readOnly: true,
|
onTap: config.isReadonly ? null : widget.onDateSelect,
|
||||||
onTap: widget.onDateSelect,
|
|
||||||
suffixIcon: Icons.calendar_today,
|
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(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
AppCustomCheckbox(
|
AppCustomCheckbox(
|
||||||
label: 'Consentement photo',
|
label: 'Consentement photo',
|
||||||
value: widget.childData.photoConsent,
|
value: widget.childData.photoConsent,
|
||||||
onChanged: widget.onTogglePhotoConsent,
|
onChanged: config.isReadonly ? (v) {} : widget.onTogglePhotoConsent,
|
||||||
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
||||||
fontSize: config.isMobile ? 13.0 : 16.0,
|
fontSize: config.isMobile ? 13.0 : 16.0,
|
||||||
),
|
),
|
||||||
SizedBox(height: 6.0 * scaleFactor),
|
SizedBox(height: 5.0 * scaleFactor), // Réduit de 6 à 5
|
||||||
AppCustomCheckbox(
|
AppCustomCheckbox(
|
||||||
label: 'Naissance multiple',
|
label: 'Naissance multiple',
|
||||||
value: widget.childData.multipleBirth,
|
value: widget.childData.multipleBirth,
|
||||||
onChanged: widget.onToggleMultipleBirth,
|
onChanged: config.isReadonly ? (v) {} : widget.onToggleMultipleBirth,
|
||||||
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
checkboxSize: config.isMobile ? 20.0 : 22.0 * scaleFactor,
|
||||||
fontSize: config.isMobile ? 13.0 : 16.0,
|
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(
|
Positioned(
|
||||||
top: -5, right: -5,
|
top: -5, right: -5,
|
||||||
child: InkWell(
|
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