Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Date/Time Picker Flutter : OK/CANCEL button not visible

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

like image 919
Koushik Ravikumar Avatar asked Feb 28 '19 09:02

Koushik Ravikumar


1 Answers

You need to overwrite - buttonTheme:

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

enter image description here

like image 188
anmol.majhail Avatar answered Oct 21 '22 03:10

anmol.majhail