Skip to content

Commit

Permalink
Merge pull request #4 from terrakok/add_cards
Browse files Browse the repository at this point in the history
Use TopAppBar in full-screen DialogsDemo
  • Loading branch information
eymar authored Nov 1, 2023
2 parents 6556745 + c5a563d commit 0057e9e
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions composeApp/src/commonMain/kotlin/com/github/terrakok/Containment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.*
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.Close
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.icons.outlined.*
Expand Down Expand Up @@ -155,6 +156,7 @@ private val DefaultDialogProperties = DialogProperties(
usePlatformInsets = false
)

@OptIn(ExperimentalMaterial3Api::class)
@Composable
private fun FullScreenDialog(onDismissRequest: () -> Unit) {
Dialog(onDismissRequest = { onDismissRequest() }, properties = DefaultDialogProperties) {
Expand All @@ -164,29 +166,27 @@ private fun FullScreenDialog(onDismissRequest: () -> Unit) {
.clickable { onDismissRequest() }
) {

Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
) {

Row(
verticalAlignment = Alignment.CenterVertically,
) {
IconButton(onClick = onDismissRequest) {
Icon(imageVector = Icons.Default.Close, contentDescription = null)
TopAppBar(
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.background
),
navigationIcon = {
IconButton(
onClick = { onDismissRequest() }
) {
Icon(
imageVector = Icons.Default.Close,
contentDescription = null
)
}
},
title = { Text("Full-screen dialog") },
actions = {
TextButton(onClick = { onDismissRequest() }, modifier = Modifier) {
Text("Close")
}

Text(
text = "Full-screen dialog",
style = MaterialTheme.typography.headlineSmall,
)
}

TextButton(onClick = { onDismissRequest() }, modifier = Modifier) {
Text("Close")
}
}
)
}
}
}
Expand Down

0 comments on commit 0057e9e

Please sign in to comment.