- Backend: mail après inscription parent avec n° dossier, UPLOAD_PHOTOS_DIR, réponse API - Frontend: imageBytes + payload photo, utils email/code postal/téléphone, champs dédiés - Formulaires admin, login (focus), personal_info, child_card, custom_app_text_field Made-with: Cursor
20 lines
641 B
Dart
20 lines
641 B
Dart
import 'package:flutter/services.dart';
|
|
|
|
/// Saisie code postal français : uniquement des chiffres, au plus 5.
|
|
final List<TextInputFormatter> kFrenchPostalCodeInputFormatters = [
|
|
FilteringTextInputFormatter.digitsOnly,
|
|
LengthLimitingTextInputFormatter(5),
|
|
];
|
|
|
|
/// Valide un code postal français (exactement 5 chiffres).
|
|
String? validateFrenchPostalCode(String? raw, {bool allowEmpty = false}) {
|
|
final s = raw?.trim() ?? '';
|
|
if (s.isEmpty) {
|
|
return allowEmpty ? null : 'Ce champ est obligatoire';
|
|
}
|
|
if (s.length != 5 || int.tryParse(s) == null) {
|
|
return 'Le code postal doit comporter 5 chiffres.';
|
|
}
|
|
return null;
|
|
}
|