Carson Holzheimer
01/23/2021, 5:48 AMJavier
01/23/2021, 11:26 AMButton
composable, and in that screen/file both are used.
The drawback is that if you have two themes in the app, in one screen you use material theme and in another screen you uses custom theme, you can't know without a Preview or checking the imports what theme you are using.
But the fact that Material uses no prefixes indicates that it should be the way to go because they was using prefixes in the no compose Material Library and there must have been a detailed analysis to do this movement.Carson Holzheimer
01/23/2021, 12:31 PMCarson Holzheimer
01/23/2021, 1:12 PMJavier
01/23/2021, 1:12 PMButton
looks different if I am on Android, on Windows or on Mac. So a lib could provides a bridge for that three "commonMain" modules (material, macOS and Windows themes).
Probably this can be done in JVM desktop apps injecting different themes based on the platform.Javier
01/23/2021, 1:18 PMCarson Holzheimer
01/23/2021, 1:21 PMCarson Holzheimer
01/23/2021, 1:33 PMButton
, however that could again interfere with consumers that want to name their components Button
:/Javier
01/23/2021, 1:39 PMJavier
01/23/2021, 1:41 PMAdam Powell
01/23/2021, 2:32 PMAdam Powell
01/23/2021, 2:33 PMAdam Powell
01/23/2021, 2:33 PMKirill Grouchnikov
01/24/2021, 3:01 AMandroidx.compose.material
package. It's quite convenient that the default Studio / IDEA project wizard adds the entirety of that as your dependencies without you having to manually list all the packages. It's also convenient that this UI toolkit has a collection of common components such as buttons, checkboxes, sliders and more. But on the other hand, I am not the biggest fan of the naming of these component composeables - Button
, Checkbox
etc. They are specific implementation of a design system - Material in this case. I'd rather have these components represent themselves as what they are - Material components. Not generic Compose components. But Material components. So MaterialButton
instead of Button
, etc.Kirill Grouchnikov
01/24/2021, 3:03 AMKirill Grouchnikov
01/24/2021, 3:11 AMKirill Grouchnikov
01/24/2021, 3:21 AMCarson Holzheimer
01/24/2021, 4:19 AMCarson Holzheimer
01/25/2021, 4:53 AM// The component actually used in app
Button {
NativeButton {
when (platform) {
Mac -> MacButton {
Button // Material button
}
Windows -> WindowsButton {
Button // Material
}
}
}
}
But isnāt that the power of composition?Carson Holzheimer
01/25/2021, 5:02 AMKirill Grouchnikov
01/25/2021, 5:29 AMCarson Holzheimer
01/25/2021, 5:34 AMAdam Powell
01/25/2021, 5:45 AMAdam Powell
01/25/2021, 5:48 AMAdam Powell
01/25/2021, 5:50 AM