yearButtonBuilder property
Build your own year buttons
- NOTE: COPY & PASTE
-
Sample code
yearButtonBuilder: (dateTime, heightResponsive,widthResponsive, isyearDisabled, isYearselected) {
final txtTheme = Theme.of(context).textTheme;
final colorTheme = Theme.of(context);
return SizedBox(
height: heightResponsive,
width: widthResponsive,
child: DecoratedBox(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(heightResponsive),
),
border: Border.all(
color: isyearDisabled
? colorTheme.disabledColor.withOpacity(0.1)
: isYearselected
? (colorTheme.brightness ==
Brightness.dark
? colorTheme.accentColor
: Colors.black)
: Colors.grey,
width: isyearDisabled
? 1
: isYearselected
? 1.5
: 1),
),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Text(dateTime.year.toString(),
style: isyearDisabled
? txtTheme.caption
: isYearselected
? txtTheme.button
: txtTheme.button,),
),
),
);
},
{@end-tool}
Implementation
final WidgetCbYearButton? yearButtonBuilder;