0

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.

Jeanz
  • 1
  • 2

1 Answers1

0

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.

Matthew Trent
  • 2,611
  • 1
  • 17
  • 30
  • changed to transparent but no changes. The thing is, it's not only the color, there are just no time elements appearing, not even under and above the selected time field in the middle. – Jeanz Feb 23 '23 at 13:06
  • 1
    deleted the whole CupertinoTheme part and the picker works, so definitely some rendering issue, but problem not solved (because I want to use the theme data) – Jeanz Feb 23 '23 at 14:13