-
Notifications
You must be signed in to change notification settings - Fork 17
/
DialogsPlayground.kt
109 lines (105 loc) · 4.9 KB
/
DialogsPlayground.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.github.terrakok.modo.sample.screens.dialogs
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import com.github.terrakok.modo.ExperimentalModoApi
import com.github.terrakok.modo.Screen
import com.github.terrakok.modo.ScreenKey
import com.github.terrakok.modo.generateScreenKey
import com.github.terrakok.modo.sample.screens.ButtonsState
import com.github.terrakok.modo.sample.screens.GroupedButtonsState
import com.github.terrakok.modo.sample.screens.MainScreen
import com.github.terrakok.modo.sample.screens.base.ButtonsScreenContent
import com.github.terrakok.modo.stack.LocalStackNavigation
import com.github.terrakok.modo.stack.StackNavContainer
import com.github.terrakok.modo.stack.forward
import kotlinx.parcelize.Parcelize
@Parcelize
class DialogsPlayground(
private val screenIndex: Int,
override val screenKey: ScreenKey = generateScreenKey()
) : Screen {
@Composable
override fun Content(modifier: Modifier) {
DialogsPlaygroundContent(screenIndex, screenKey)
}
}
@Composable
internal fun DialogsPlaygroundContent(screenIndex: Int, screenKey: ScreenKey, modifier: Modifier = Modifier) {
ButtonsScreenContent(
screenIndex = screenIndex,
screenName = "DialogsPlayground",
screenKey = screenKey,
state = rememberDialogsButtons(LocalStackNavigation.current, screenIndex),
modifier = modifier
)
}
@Suppress("Wrapping")
@OptIn(ExperimentalModoApi::class)
@Composable
internal fun rememberDialogsButtons(
navigation: StackNavContainer,
i: Int
): GroupedButtonsState =
remember {
listOf(
"Forward" to { navigation.forward(MainScreen(i + 1)) },
"Forward Dialogs" to { navigation.forward(DialogsPlayground(i + 1)) },
"System Dialog" to {
navigation.forward(
SampleDialog(
i + 1,
dialogsPlayground = true,
systemDialog = true,
permanentDialog = false
)
)
},
"Custom Dialog" to {
navigation.forward(
SampleDialog(
i + 1,
dialogsPlayground = true,
systemDialog = false,
permanentDialog = false
)
)
},
"System Dialog perm" to {
navigation.forward(
SampleDialog(
i + 1,
dialogsPlayground = true,
systemDialog = true,
permanentDialog = true
)
)
},
"Custom Dialog perm" to {
navigation.forward(
SampleDialog(
i + 1,
dialogsPlayground = true,
systemDialog = false,
permanentDialog = true
)
)
},
"System Dialog Stack" to { navigation.forward(SampleDialogWithStack(i + 1, systemDialog = true, permanentDialog = false)) },
"Custom Dialog Stack" to { navigation.forward(SampleDialogWithStack(i + 1, systemDialog = false, permanentDialog = false)) },
"System Dialog Stack perm" to { navigation.forward(SampleDialogWithStack(i + 1, systemDialog = true, permanentDialog = true)) },
"Custom Dialog Stack perm" to { navigation.forward(SampleDialogWithStack(i + 1, systemDialog = false, permanentDialog = true)) },
"System BS" to { navigation.forward(SampleBottomSheet(i + 1, systemDialog = true, permanentDialog = false)) },
"Custom BS" to { navigation.forward(SampleBottomSheet(i + 1, systemDialog = false, permanentDialog = false)) },
"System BS perm" to { navigation.forward(SampleBottomSheet(i + 1, systemDialog = true, permanentDialog = false)) },
"Custom BS perm" to { navigation.forward(SampleBottomSheet(i + 1, systemDialog = false, permanentDialog = false)) },
"System BS Stack" to { navigation.forward(SampleBottomSheetStack(i + 1, systemDialog = true, permanentDialog = false)) },
"Custom BS Stack" to { navigation.forward(SampleBottomSheetStack(i + 1, systemDialog = false, permanentDialog = false)) },
"System BS Stack perm" to { navigation.forward(SampleBottomSheetStack(i + 1, systemDialog = true, permanentDialog = false)) },
"Custom BS Stack perm" to { navigation.forward(SampleBottomSheetStack(i + 1, systemDialog = false, permanentDialog = false)) },
"System Dialog random dim" to { navigation.forward(SystemDialogWithCustomDimSample(i + 1)) },
"M3 BottomSheet" to { navigation.forward(M3BottomSheet(i + 1)) },
).let {
ButtonsState(it)
}
}