Refactoring + Checkpoint
This commit is contained in:
@@ -3,8 +3,14 @@ import 'package:flutter/material.dart';
|
||||
class DatePickerField extends StatelessWidget {
|
||||
final DateTime? selectedDate;
|
||||
final Function(DateTime?) onDatePicked;
|
||||
final String label; // Texte du label
|
||||
|
||||
const DatePickerField({Key? key, this.selectedDate, required this.onDatePicked}) : super(key: key);
|
||||
const DatePickerField({
|
||||
Key? key,
|
||||
this.selectedDate,
|
||||
required this.onDatePicked,
|
||||
this.label = 'Sélectionnez une date', // Label par défaut
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -21,21 +27,36 @@ class DatePickerField extends StatelessWidget {
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(vertical: 14.0, horizontal: 18.0),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
color: Colors.blueGrey.withOpacity(0.1), // Fond plus doux et moderne
|
||||
borderRadius: BorderRadius.circular(12.0), // Coins arrondis plus prononcés
|
||||
border: Border.all(color: Colors.blueGrey.withOpacity(0.5), width: 2.0), // Bordure légère
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black12,
|
||||
offset: Offset(0, 4),
|
||||
blurRadius: 8,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
selectedDate == null
|
||||
? 'Sélectionnez une date'
|
||||
? label
|
||||
: '${selectedDate!.day}/${selectedDate!.month}/${selectedDate!.year}',
|
||||
style: const TextStyle(color: Colors.white70),
|
||||
style: const TextStyle(
|
||||
color: Colors.blueGrey, // Couleur du texte adaptée
|
||||
fontSize: 16.0, // Taille de police améliorée
|
||||
fontWeight: FontWeight.w600, // Poids de police plus important pour un meilleur contraste
|
||||
),
|
||||
),
|
||||
Icon(
|
||||
Icons.calendar_today,
|
||||
color: Colors.blueGrey, // Couleur de l'icône assortie au texte
|
||||
),
|
||||
const Icon(Icons.calendar_today, color: Colors.white70),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user