@@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.size
1616import androidx.compose.foundation.layout.width
1717import androidx.compose.material.icons.Icons
1818import androidx.compose.material.icons.filled.Person
19+ import androidx.compose.material.icons.filled.Star
1920import androidx.compose.runtime.Composable
2021import androidx.compose.runtime.MutableState
2122import androidx.compose.runtime.getValue
@@ -50,6 +51,7 @@ import top.yukonga.miuix.kmp.utils.squircleshape.SquircleShape
5051@Composable
5152fun TextComponent () {
5253 val showDialog = remember { mutableStateOf(false ) }
54+ val showDialog2 = remember { mutableStateOf(false ) }
5355 var checkbox by remember { mutableStateOf(false ) }
5456 var checkboxTrue by remember { mutableStateOf(true ) }
5557 var switch by remember { mutableStateOf(false ) }
@@ -96,14 +98,16 @@ fun TextComponent() {
9698 ) {
9799 Image (
98100 colorFilter = ColorFilter .tint(MiuixTheme .colorScheme.onBackground),
99- imageVector = Icons .Default .Person ,
101+ imageVector = Icons .Default .Star ,
100102 contentDescription = " Person" ,
101103 )
102104 }
103105 },
104- title = " Person" ,
105- summary = " An introduction" ,
106- onClick = {}
106+ title = " Title" ,
107+ summary = " Click to show Dialog 1" ,
108+ onClick = {
109+ showDialog.value = true
110+ }
107111 )
108112
109113 Row (
@@ -234,9 +238,9 @@ fun TextComponent() {
234238
235239 SuperArrow (
236240 title = " Dialog" ,
237- summary = " Click to show a Dialog" ,
241+ summary = " Click to show Dialog 2 " ,
238242 onClick = {
239- showDialog .value = true
243+ showDialog2 .value = true
240244 }
241245 )
242246
@@ -260,16 +264,58 @@ fun TextComponent() {
260264 }
261265
262266 dialog(showDialog)
267+ dialog2(showDialog2)
263268}
264269
270+
265271@Composable
266272fun dialog (showDialog : MutableState <Boolean >) {
273+ if (! showDialog.value) return
274+ showDialog(
275+ content = {
276+ SuperDialog (
277+ title = " Dialog 1" ,
278+ summary = " Summary" ,
279+ show = showDialog,
280+ onDismissRequest = {
281+ showDialog.value = false
282+ },
283+ ) {
284+ Row (
285+ horizontalArrangement = Arrangement .SpaceBetween
286+ ) {
287+ Button (
288+ modifier = Modifier .weight(1f ),
289+ text = " Cancel" ,
290+ onClick = {
291+ dismissDialog()
292+ showDialog.value = false
293+ }
294+ )
295+ Spacer (Modifier .width(20 .dp))
296+ Button (
297+ modifier = Modifier .weight(1f ),
298+ text = " Confirm" ,
299+ submit = true ,
300+ onClick = {
301+ dismissDialog()
302+ showDialog.value = false
303+ }
304+ )
305+ }
306+ }
307+ }
308+ )
309+ }
310+
311+ @Composable
312+ fun dialog2 (showDialog : MutableState <Boolean >) {
313+ if (! showDialog.value) return
267314 val value = remember { mutableStateOf(" " ) }
268315 showDialog(
269- show = showDialog.value,
270316 content = {
271317 SuperDialog (
272- title = " Title " ,
318+ title = " Dialog 2 " ,
273319 summary = " Summary" ,
274320 show = showDialog,
275321 onDismissRequest = {
@@ -308,4 +354,4 @@ fun dialog(showDialog: MutableState<Boolean>) {
308354 }
309355 }
310356 )
311- }
357+ }
0 commit comments