I have a date picker in Flutter. I want to make the 'Ok' and 'Cancel' button text black. But I can't find the correct theme setting.
Code displaying the date picker:
Future<void> selectDate(
BuildContext context,
DateTime initialDate,
TextEditingController controller,
Function(DateTime picked, TextEditingController controller) onDatePicked,
String label) async {
final DateTime picked = await showDatePicker(
context: context,
builder: (BuildContext context, Widget child) {
return Theme(
data: ThemeData(
primarySwatch: Colors.grey,
splashColor: Colors.black,
textTheme: TextTheme(
subtitle1: TextStyle(color: Colors.black),
button: TextStyle(color: Colors.black),
),
accentColor: Colors.black,
colorScheme: ColorScheme.light(
primary: Colors.green[600],
primaryVariant: Colors.black,
secondaryVariant: Colors.black,
onSecondary: Colors.black,
onPrimary: Colors.white,
surface: Colors.black,
onSurface: Colors.black,
secondary: Colors.black),
dialogBackgroundColor: Colors.white,
),
child: child,
);
},
initialDate: initialDate.toLocal(),
firstDate: DateTime(2015, 8).toLocal(),
lastDate: DateTime(2101).toLocal(),
fieldLabelText: label);
if (picked != null) onDatePicked(picked, controller);
}
Thanks!
