Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

showPlatformDialog is not respecting theme on Material #463

Open
martin-braun opened this issue Jun 11, 2024 · 3 comments
Open

showPlatformDialog is not respecting theme on Material #463

martin-braun opened this issue Jun 11, 2024 · 3 comments

Comments

@martin-braun
Copy link

This is a platform dialog spawned on Material:

image
              await showPlatformDialog<void>(
                context: context,
                builder: (_) => PlatformAlertDialog(
                  title: Text(l10n.cardCabinetDetailActionStartGrow),
                  content:
                      Text(l10n.cardCabinetDetailActionStartGrowInstructions),
                  actions: <Widget>[
                    PlatformDialogAction(
// ...

This is a platform date picker spawned on Material:

image
                        DateTime? startGrowTime = await showPlatformDatePicker(
                            context: context,
                            initialDate: now.add(const Duration(seconds: 1)),
                            firstDate: DateTime.now(),
                            lastDate: now.add(const Duration(days: 90)),
                            material: (context, data) =>
                                MaterialDatePickerData(),
                            cupertino: (context, data) =>
                                CupertinoDatePickerData(
                                  mode: CupertinoDatePickerMode.dateAndTime,
                                ));

Notice how the DateTime picker has a greenish tint to it? My ThemeData is has a colorScheme that was seeded from #0A7A34 and no explicit themes or colors are used here. So, the platform dialog does something differently here and it is wrong.

I noticed the solution is to set the PlatformAlertDialog color to surfaceContainerHigh:

                  material: (_, __) => MaterialAlertDialogData(
                    backgroundColor: theme.colorScheme.surfaceContainerHigh,
                  ),

Defaults should be changed here I guess.

@martin-braun
Copy link
Author

Also I tried to use the surfaceTint instead, but no color would result in surfaceContainerHigh which is the color that the datetime picker uses.

@philipvrx
Copy link

Have you tried using colorScheme secondary color?

Also I tried to use the surfaceTint instead, but no color would result in surfaceContainerHigh which is the color that the datetime picker uses.

@martin-braun
Copy link
Author

Have you tried using colorScheme secondary color?

@philipvrx It has no tint, despite me using secondary and tertiary colors in my theme. I have set almost every color that ThemeData allows me to set.

Even if there is any other field on ThemeData that controls this, it's clearly a bug. The DateTime picker uses the primary color as tint color, so the alert dialog should do the same for a coherent experience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants