date picker decorations matched with design.

This commit is contained in:
Faris Armoush
2025-05-20 14:20:16 +03:00
parent 15343be258
commit 4c2802acfc
2 changed files with 55 additions and 33 deletions

View File

@ -178,7 +178,6 @@ class _MonthPickerWidgetState extends State<MonthPickerWidget> {
shrinkWrap: true, shrinkWrap: true,
itemCount: 12, itemCount: 12,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(8),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: 3,
childAspectRatio: 2.5, childAspectRatio: 2.5,
@ -191,27 +190,39 @@ class _MonthPickerWidgetState extends State<MonthPickerWidget> {
return InkWell( return InkWell(
onTap: isFutureMonth ? null : () => setState(() => _selectedMonth = index), onTap: isFutureMonth ? null : () => setState(() => _selectedMonth = index),
child: Container( child: DecoratedBox(
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: const Color(0xFFEDF2F7),
? ColorsManager.vividBlue.withValues(alpha: 0.7) borderRadius: BorderRadius.only(
: isFutureMonth topLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero,
? ColorsManager.grey700.withValues(alpha: 0.1) bottomLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero,
: const Color(0xFFEDF2F7), topRight: index % 3 == 2 ? const Radius.circular(16) : Radius.zero,
borderRadius: bottomRight:
isSelected ? BorderRadius.circular(15) : BorderRadius.zero, index % 3 == 2 ? const Radius.circular(16) : Radius.zero,
),
), ),
child: Text( child: Container(
_monthNames[index], alignment: Alignment.center,
style: context.textTheme.titleSmall?.copyWith( decoration: BoxDecoration(
fontSize: 12,
color: isSelected color: isSelected
? ColorsManager.whiteColors ? ColorsManager.vividBlue.withValues(alpha: 0.7)
: isFutureMonth : isFutureMonth
? ColorsManager.blackColor.withValues(alpha: 0.3) ? ColorsManager.grey700.withValues(alpha: 0.1)
: ColorsManager.blackColor.withValues(alpha: 0.8), : const Color(0xFFEDF2F7),
fontWeight: FontWeight.w500, borderRadius:
isSelected ? BorderRadius.circular(15) : BorderRadius.zero,
),
child: Text(
_monthNames[index],
style: context.textTheme.titleSmall?.copyWith(
fontSize: 12,
color: isSelected
? ColorsManager.whiteColors
: isFutureMonth
? ColorsManager.blackColor.withValues(alpha: 0.3)
: ColorsManager.blackColor.withValues(alpha: 0.8),
fontWeight: FontWeight.w500,
),
), ),
), ),
), ),

View File

@ -109,7 +109,6 @@ class _YearPickerWidgetState extends State<YearPickerWidget> {
shrinkWrap: true, shrinkWrap: true,
itemCount: years.length, itemCount: years.length,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(8),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, crossAxisCount: 3,
childAspectRatio: 2.5, childAspectRatio: 2.5,
@ -120,23 +119,35 @@ class _YearPickerWidgetState extends State<YearPickerWidget> {
final isSelected = _currentYear == years[index]; final isSelected = _currentYear == years[index];
return InkWell( return InkWell(
onTap: () => setState(() => _currentYear = years[index]), onTap: () => setState(() => _currentYear = years[index]),
child: Container( child: DecoratedBox(
alignment: Alignment.center,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: const Color(0xFFEDF2F7),
? ColorsManager.vividBlue.withValues(alpha: 0.7) borderRadius: BorderRadius.only(
: const Color(0xFFEDF2F7), topLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero,
borderRadius: bottomLeft: index % 3 == 0 ? const Radius.circular(16) : Radius.zero,
isSelected ? BorderRadius.circular(15) : BorderRadius.zero, topRight: index % 3 == 2 ? const Radius.circular(16) : Radius.zero,
bottomRight:
index % 3 == 2 ? const Radius.circular(16) : Radius.zero,
),
), ),
child: Text( child: Container(
years[index].toString(), alignment: Alignment.center,
style: context.textTheme.titleSmall?.copyWith( decoration: BoxDecoration(
fontSize: 12,
color: isSelected color: isSelected
? ColorsManager.whiteColors ? ColorsManager.vividBlue.withValues(alpha: 0.7)
: ColorsManager.blackColor.withValues(alpha: 0.8), : const Color(0xFFEDF2F7),
fontWeight: FontWeight.w500, borderRadius:
isSelected ? BorderRadius.circular(15) : BorderRadius.zero,
),
child: Text(
years[index].toString(),
style: context.textTheme.titleSmall?.copyWith(
fontSize: 12,
color: isSelected
? ColorsManager.whiteColors
: ColorsManager.blackColor.withValues(alpha: 0.8),
fontWeight: FontWeight.w500,
),
), ),
), ),
), ),