Mark
02/02/2023, 2:57 AMAlertDialog
in MaterialTheme
why are the buttons not styled according to Material spec?
https://foso.github.io/Jetpack-Compose-Playground/material/alertdialog/
https://m2.material.io/components/dialogs/android#alert-dialogAlbert Chang
02/02/2023, 3:25 AMTextButton
should be used instead of Button
. See official document.Mark
02/02/2023, 3:36 AMButton
instead of TextButton
, most likely because that’s the most instinctive composable to use. It seems a likely error that by having such a flexible confirmButton
and dismissButton
that the spec will be disregarded. What I was wondering was whether a Button
used in, say, confirmButton
composable, would somehow pick up some styling (by default) that would make it look like the appropriate TextButton
(which is just a Button
with a couple of default args).Albert Chang
02/02/2023, 3:37 AMMark
02/02/2023, 3:45 AMAlertDialog
, and that this should be default when wrapped inside a MaterialTheme
composable. Or at least some way to say it explicitly. I guess that’s how it was done in the XML world, so it takes some adjusting. It just seems strange to me that there is not an easier way to create an AlertDialog
without these potential issues that are easily made. At the very least I would also expect a composable for AlertDialog
that takes simple button labels (Strings) to ensure they are styled correctly, since this is probably what 90% (or even 99%) of cases require.Albert Chang
02/02/2023, 3:50 AMMark
02/02/2023, 4:01 AMtitle
, text
, confirmButton
, I’m ending up spending a lot of time trying to figure out how to apply the proper styling. I’m not seeing many defaults being applied from the theme. For example, using a TextButton
for confirmButton
the label is not captialized, so I have to do it myself. Or for the title, I end up trying a bunch of different text styles until I find one that looks right (subtitle1 and bold!?). What am I missing?Albert Chang
02/02/2023, 4:06 AMMark
02/02/2023, 4:30 AMAlbert Chang
02/02/2023, 4:38 AMMark
02/02/2023, 4:39 AMAlbert Chang
02/02/2023, 4:40 AMMark
02/02/2023, 4:41 AM