Removed Dialog and Fullscreen upper right close button on mobile (is not common on mobile and anyway harder to reach with thumb than buttons at the bottom
This commit is contained in:
parent
e5119b237e
commit
abfe92a19b
|
@ -11,6 +11,13 @@ expect fun getPlatform(): Platform
|
|||
interface Platform {
|
||||
val name: String
|
||||
val type: PlatformType
|
||||
|
||||
|
||||
val isMobile: Boolean
|
||||
get() = type == PlatformType.iOS || type == PlatformType.Android // TODO: for Web check if it's a mobile browser, but very low priority
|
||||
|
||||
val isDesktop: Boolean
|
||||
get() = type == PlatformType.JVM || type == PlatformType.Web // TODO: for Web check if it's a desktop browser, but very low priority
|
||||
}
|
||||
|
||||
enum class PlatformType {
|
||||
|
@ -19,7 +26,3 @@ enum class PlatformType {
|
|||
iOS,
|
||||
Web
|
||||
}
|
||||
|
||||
|
||||
val Platform.isMobile: Boolean
|
||||
get() = type == PlatformType.iOS || type == PlatformType.Android // TODO: for Web check if it's a mobile browser, but very low priority
|
|
@ -15,10 +15,9 @@ import androidx.compose.ui.window.Dialog
|
|||
import androidx.compose.ui.window.DialogProperties
|
||||
import net.codinux.banking.ui.composables.text.HeaderText
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
import net.codinux.banking.ui.config.DI
|
||||
import net.codinux.banking.ui.extensions.copy
|
||||
import net.codinux.banking.ui.forms.*
|
||||
import net.codinux.banking.ui.getPlatform
|
||||
import net.codinux.banking.ui.isMobile
|
||||
|
||||
@Composable
|
||||
fun BaseDialog(
|
||||
|
@ -32,7 +31,7 @@ fun BaseDialog(
|
|||
properties: DialogProperties = DialogProperties(),
|
||||
content: @Composable () -> Unit
|
||||
) {
|
||||
val overwriteDefaultWidth = useMoreThanPlatformDefaultWidthOnMobile && getPlatform().isMobile
|
||||
val overwriteDefaultWidth = useMoreThanPlatformDefaultWidthOnMobile && DI.platform.isMobile
|
||||
|
||||
Dialog(onDismissRequest = onDismiss, if (overwriteDefaultWidth) properties.copy(usePlatformDefaultWidth = false) else properties) {
|
||||
RoundedCornersCard(Modifier.let { if (overwriteDefaultWidth) it.fillMaxWidth(0.95f) else it }) {
|
||||
|
@ -41,8 +40,10 @@ fun BaseDialog(
|
|||
Row(Modifier.fillMaxWidth()) {
|
||||
HeaderText(title, Modifier.padding(top = 8.dp, bottom = 16.dp).weight(1f))
|
||||
|
||||
TextButton(onDismiss, colors = ButtonDefaults.buttonColors(contentColor = Colors.Zinc700, backgroundColor = Color.Transparent)) {
|
||||
Icon(Icons.Filled.Close, contentDescription = "Close dialog", Modifier.size(32.dp))
|
||||
if (DI.platform.isDesktop) {
|
||||
TextButton(onDismiss, colors = ButtonDefaults.buttonColors(contentColor = Colors.Zinc700, backgroundColor = Color.Transparent)) {
|
||||
Icon(Icons.Filled.Close, contentDescription = "Close dialog", Modifier.size(32.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import androidx.compose.ui.text.style.TextAlign
|
|||
import androidx.compose.ui.unit.dp
|
||||
import net.codinux.banking.ui.composables.text.HeaderText
|
||||
import net.codinux.banking.ui.config.Colors
|
||||
import net.codinux.banking.ui.config.DI
|
||||
|
||||
@Composable
|
||||
fun FullscreenViewBase(
|
||||
|
@ -26,8 +27,10 @@ fun FullscreenViewBase(
|
|||
Row(Modifier.fillMaxWidth()) {
|
||||
HeaderText(title, Modifier.padding(top = 8.dp, bottom = 16.dp).weight(1f))
|
||||
|
||||
TextButton(onClosed, colors = ButtonDefaults.buttonColors(contentColor = Colors.Zinc700, backgroundColor = Color.Transparent)) {
|
||||
Icon(Icons.Filled.Close, contentDescription = "Close dialog", Modifier.size(32.dp))
|
||||
if (DI.platform.isDesktop) {
|
||||
TextButton(onClosed, colors = ButtonDefaults.buttonColors(contentColor = Colors.Zinc700, backgroundColor = Color.Transparent)) {
|
||||
Icon(Icons.Filled.Close, contentDescription = "Close dialog", Modifier.size(32.dp))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue