Browse Source

Add todo edit dialog to iOS (#3001)

pull/3002/head
Nikita Lipsky 2 years ago committed by GitHub
parent
commit
08d5fa3487
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      examples/todoapp-lite/shared/src/iosMain/kotlin/example/todoapp/lite/common/Utils.kt

48
examples/todoapp-lite/shared/src/iosMain/kotlin/example/todoapp/lite/common/Utils.kt

@ -1,10 +1,16 @@
package example.todoapp.lite.common
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
@ -29,4 +35,44 @@ internal actual fun Dialog(
title: String,
onCloseRequest: () -> Unit,
content: @Composable () -> Unit
) = Unit
) {
Box(
Modifier
.fillMaxSize()
.background(Color.Black.copy(alpha = 0.4f))
.clickable {
onCloseRequest()
}
) {
Box(
Modifier
.padding(30.dp)
.background(Color.White)
.align(Alignment.TopCenter)
.clickable(enabled = false){}
) {
Column(
modifier = Modifier.padding(8.dp)
) {
ProvideTextStyle(MaterialTheme.typography.subtitle1) {
Text(text = title)
}
Spacer(modifier = Modifier.height(8.dp))
Box(modifier = Modifier.fillMaxHeight(0.5f)) {
content()
}
Spacer(modifier = Modifier.height(8.dp))
Button(
onClick = onCloseRequest,
modifier = Modifier.align(Alignment.End)
) {
Text(text = "Done")
}
}
}
}
}

Loading…
Cancel
Save