Flutter CupertinoDatePicker error grey box

66 Views Asked by At

this error was already mentioned but could not be solved yet.

CupertinoDatePicker works in debug mode but not in the release version. Sometimes it works, sometimes this grey box appears:

Grey Box in CupertinoDatePicker

 return AlertDialog(
            shape: RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(10.0))),
            title: id == "start"
                ? Text(
                    "Start-Zeit",
                    style: TextStyle(
                        fontSize: 25.0,
                        fontWeight: FontWeight.w600,
                        color: Theme.of(context).accentColor),
                  )
                : Text(
                    "End-Zeit",
                    style: TextStyle(
                        fontSize: 25.0,
                        fontWeight: FontWeight.w600,
                        color: Theme.of(context).accentColor),
                  ),
            content: Container(
              height: 120.0,
              child: CupertinoTheme(
                data: CupertinoThemeData(
                    textTheme: CupertinoTextThemeData(
                        dateTimePickerTextStyle: TextStyle(fontSize: 25.0))),
                child: CupertinoDatePicker(
                    mode: CupertinoDatePickerMode.time,
                    use24hFormat: true,
                    minuteInterval: 1,
                    initialDateTime: initialTime,
                    onDateTimeChanged: (DateTime newDateTime) {
                      initialTime = newDateTime;
                    }),
              ),
            ),
     
          );

I tried to change the themeData but it´s hard to find the problem because it´s finde in debug mode and in most of the release versions

Update:

deleting the CupertinoTheme-Code solves the issue, but I want to use the theme data, so don´t know what kind of rendering issue.

1

There are 1 best solutions below

2
Matthew Trent On

Add this field to your inner-most Container that has a height of 120:

color: Colors.transparent

I’m betting it’s inheriting some theme from somewhere higher up in your app that’s making it grey.