The date picker widget in flutter displays the ok/cancel buttons in white, and therefore are not visible in a white background.

_displayFromDate = await showDatePicker(
                    context: context,
                    initialDate: now,
                    firstDate: now,
                    lastDate: now.add(new Duration(days: 30)),
                  );

I've tried changing the page theme with primary, accent colours as black. Still not visible. The button are there, because I can tap on them, just the titles aren't visible.

[✓] Flutter (Channel master, v1.2.3-pre.67, on Mac OS X 10.13.6 17G5019, locale
    en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] Connected device (2 available)

enter image description here


Solution 1: anmol.majhail

You need to overwrite - buttonTheme:

theme: ThemeData(
            buttonTheme: ButtonThemeData(textTheme: ButtonTextTheme.accent),
            accentColor: Colors.black,
            primaryColor: Colors.black)

enter image description here


Solution 2: Florian

I debugged this all the way down to the actual Widgets used because the solution didn't work for me. What I found is that buttonTheme has absolutely no effect and accentColor doesn't either. PrimaryColor is used but not the one specified in the answer but rather colorScheme.primaryColor. For the buttons at the bottom, primaryColor is of the .colorScheme part of ThemeData is used at all times. To use my theme and override just the primaryColor for the child Widgets, I use the following:

final DateTime picked = await showDatePicker(
  context: context,
  builder: (context, child) {
    return SingleChildScrollView(
        child: Theme(
      child: child,
      data: Theme.of(context).copyWith(
          colorScheme: Theme.of(context)
              .colorScheme
              .copyWith(primary: <Desired Color>)),
    ));
  });

You will find that on Light-Mode the primary color is also responsible for the background color of the header section (where it says the selected date in large letters). Unfortunately there's no way around that. On Dark-Mode surface color is used. From the documentation of Widget DatePickerHeader:

    // The header should use the primary color in light themes and surface color in dark

Hope this helps and again, the accepted answer doesn't work at all from what I've found!