I want to change Selected color for Yearpicker
I want to change selected color to green
In simple Date picker there is Build method available for change in theme but For Yearpicker i could not find any way.
return AlertDialog(
title: const Text("Select Year"),
content: SizedBox(
width: 300,
height: 300,
child: YearPicker(
firstDate: DateTime(DateTime.now().year - 23, 1),
lastDate: DateTime(DateTime.now().year),
initialDate: DateTime.now(),
selectedDate: selectedDate,
onChanged: (DateTime dateTime) {
Navigator.pop(context);
},
),
),
);
2
Answers
You can change the color like this
By wrapping it with a Theme Widget