-
Notifications
You must be signed in to change notification settings - Fork 1
/
SeedBottomSheet.kt
54 lines (52 loc) · 2.26 KB
/
SeedBottomSheet.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
package com.dluvian.voyage.ui.components.bottomSheet
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.grid.GridCells
import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.itemsIndexed
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheet
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import com.dluvian.voyage.R
import com.dluvian.voyage.core.Fn
import com.dluvian.voyage.ui.components.indicator.FullLinearProgressIndicator
import com.dluvian.voyage.ui.theme.spacing
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun SeedBottomSheet(seed: List<String>, onLoadSeed: Fn, onDismiss: Fn) {
LaunchedEffect(key1 = Unit) {
onLoadSeed()
}
ModalBottomSheet(onDismissRequest = onDismiss) {
BottomSheetColumn(header = stringResource(id = R.string.recovery_phrase)) {
if (seed.isEmpty()) FullLinearProgressIndicator()
LazyVerticalGrid(
modifier = Modifier.fillMaxSize(),
columns = GridCells.Fixed(count = 3),
contentPadding = PaddingValues(spacing.bigScreenEdge)
) {
itemsIndexed(seed) { i, word ->
Row(modifier = Modifier.fillMaxWidth()) {
Text(
text = "${i + 1}",
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.SemiBold
)
Spacer(modifier = Modifier.width(spacing.medium))
Text(text = word, fontWeight = FontWeight.SemiBold)
}
}
}
}
}
}