feat(auth): amélioration UI et UX étape 4 inscription parent
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
|
||||
class CustomDecoratedTextField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
final String hintText;
|
||||
final int maxLines;
|
||||
final double? fieldHeight; // Hauteur optionnelle pour le champ
|
||||
final bool expandDynamically; // Nouvelle propriété
|
||||
|
||||
const CustomDecoratedTextField({
|
||||
super.key,
|
||||
required this.controller,
|
||||
this.hintText = 'Écrire votre texte ici...',
|
||||
this.maxLines = 10, // Un nombre raisonnable de lignes par défaut si non dynamique
|
||||
this.fieldHeight, // Si non fourni, la hauteur sera intrinsèque ou définie par l'image
|
||||
this.expandDynamically = false, // Par défaut, non dynamique
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: fieldHeight, // Permet de forcer une hauteur si besoin
|
||||
child: Stack(
|
||||
alignment: Alignment.topLeft,
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/square.png', // L'image de fond
|
||||
fit: BoxFit.fill, // Pour remplir l'espace du Stack/SizedBox
|
||||
width: double.infinity, // S'assurer qu'elle prend toute la largeur disponible
|
||||
height: fieldHeight != null ? double.infinity : null, // Et toute la hauteur si fieldHeight est spécifié
|
||||
),
|
||||
Padding(
|
||||
// Ajouter un padding interne pour que le texte ne colle pas aux bords de l'image
|
||||
padding: const EdgeInsets.only(top: 25.0, bottom: 15.0, left: 20.0, right: 20.0), // Augmentation de la marge supérieure
|
||||
child: TextFormField(
|
||||
controller: controller,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: expandDynamically ? null : maxLines, // S'étend dynamiquement si expandDynamically est true
|
||||
style: GoogleFonts.merienda(fontSize: 15, color: Colors.black87),
|
||||
textAlignVertical: TextAlignVertical.top,
|
||||
decoration: InputDecoration(
|
||||
hintText: hintText,
|
||||
hintStyle: GoogleFonts.merienda(fontSize: 15, color: Colors.black54.withOpacity(0.7)),
|
||||
border: InputBorder.none, // Pas de bordure pour le TextFormField lui-même
|
||||
contentPadding: EdgeInsets.zero, // Le padding est géré par le widget Padding externe
|
||||
// Pour aligner le hintText en haut à gauche
|
||||
alignLabelWithHint: true,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user