55 lines
1.9 KiB
Dart
55 lines
1.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class TitleField extends StatelessWidget {
|
|
final FormFieldSetter<String> onSaved;
|
|
const TitleField({Key? key, required this.onSaved}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return TextFormField(
|
|
decoration: InputDecoration(
|
|
labelText: 'Titre',
|
|
labelStyle: const TextStyle(color: Colors.blueGrey), // Couleur du label
|
|
filled: true,
|
|
fillColor: Colors.blueGrey.withOpacity(0.1), // Fond plus doux
|
|
hintStyle: const TextStyle(color: Colors.blueGrey),
|
|
hintText: 'Entrez un le titre ici...',
|
|
border: const OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(12.0)), // Bordure plus arrondie
|
|
borderSide: BorderSide.none, // Pas de bordure par défaut
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
|
borderSide: const BorderSide(
|
|
color: Colors.blueGrey, // Bordure de base
|
|
width: 1.5,
|
|
),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
|
borderSide: const BorderSide(
|
|
color: Colors.blue, // Bordure en bleu lors du focus
|
|
width: 2.0,
|
|
),
|
|
),
|
|
prefixIcon: const Icon(
|
|
Icons.title,
|
|
color: Colors.blueGrey, // Icône assortie
|
|
),
|
|
),
|
|
style: const TextStyle(
|
|
color: Colors.blueGrey, // Texte en bleu pour un meilleur contraste
|
|
fontSize: 16.0, // Taille de police améliorée
|
|
fontWeight: FontWeight.w600, // Poids de la police pour la lisibilité
|
|
),
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Veuillez entrer un titre';
|
|
}
|
|
return null;
|
|
},
|
|
onSaved: onSaved,
|
|
);
|
|
}
|
|
}
|