- Corrige le débordement visuel (RenderFlex overflow) dans les cartes enfants.
- Augmente les marges latérales du sélecteur d'enfants pour un meilleur centrage.
- Ajoute un défilement automatique vers la droite lors de l'ajout d'un enfant.
- Intègre une barre de défilement horizontale et un effet de fondu dynamique (fading edges) au sélecteur d'enfants.
- Ajuste le padding vertical dans CustomAppTextField pour un meilleur centrage du hintText.
- Met à jour index.html :
- Utilise le token {{flutter_service_worker_version}}.
- Ajoute la balise meta mobile-web-app-capable.
- Rétablit temporairement loadEntrypoint pour éviter un écran blanc (avertissement de dépréciation en attente de correction).
84 lines
2.7 KiB
Dart
84 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class CustomAppTextField extends StatelessWidget {
|
|
final TextEditingController controller;
|
|
final String label;
|
|
final String? hintText;
|
|
final TextInputType? keyboardType;
|
|
final bool obscureText;
|
|
final bool enabled;
|
|
final bool readOnly;
|
|
final VoidCallback? onTap;
|
|
final IconData? suffixIcon;
|
|
final bool isRequired;
|
|
final String? Function(String?)? validator; // Permettre un validateur personnalisé
|
|
|
|
const CustomAppTextField({
|
|
super.key,
|
|
required this.controller,
|
|
required this.label,
|
|
this.hintText,
|
|
this.keyboardType,
|
|
this.obscureText = false,
|
|
this.enabled = true,
|
|
this.readOnly = false,
|
|
this.onTap,
|
|
this.suffixIcon,
|
|
this.isRequired = true,
|
|
this.validator,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: GoogleFonts.merienda(fontSize: 14, fontWeight: FontWeight.w600, color: Colors.black87),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Container(
|
|
height: 45,
|
|
decoration: const BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage('assets/images/input_field_bg.png'),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
child: TextFormField(
|
|
controller: controller,
|
|
keyboardType: keyboardType,
|
|
obscureText: obscureText,
|
|
enabled: enabled,
|
|
readOnly: readOnly,
|
|
onTap: onTap,
|
|
style: GoogleFonts.merienda(fontSize: 15, color: enabled ? Colors.black87 : Colors.grey),
|
|
textAlignVertical: TextAlignVertical.center,
|
|
decoration: InputDecoration(
|
|
border: InputBorder.none,
|
|
contentPadding: const EdgeInsets.fromLTRB(15, 13, 15, 11),
|
|
hintText: hintText,
|
|
hintStyle: GoogleFonts.merienda(fontSize: 15, color: Colors.black38),
|
|
suffixIcon: suffixIcon != null ? Padding(
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
child: Icon(suffixIcon, color: Colors.black54, size: 20),
|
|
) : null,
|
|
isDense: true,
|
|
),
|
|
validator: validator ?? // Utilise le validateur fourni, ou celui par défaut
|
|
(value) {
|
|
if (!enabled) return null;
|
|
if (readOnly) return null;
|
|
if (isRequired && (value == null || value.isEmpty)) {
|
|
return 'Ce champ est obligatoire';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
} |