Add word counter to Import Account screen
This commit is contained in:
parent
ea27b33b3e
commit
ca86caa72e
2 changed files with 15 additions and 3 deletions
|
@ -5,6 +5,7 @@ import androidx.compose.material3.*
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import cafe.adriel.voyager.core.screen.Screen
|
import cafe.adriel.voyager.core.screen.Screen
|
||||||
import cafe.adriel.voyager.navigator.LocalNavigator
|
import cafe.adriel.voyager.navigator.LocalNavigator
|
||||||
|
@ -17,6 +18,8 @@ import org.jetbrains.compose.resources.vectorResource
|
||||||
import org.jetbrains.compose.ui.tooling.preview.Preview
|
import org.jetbrains.compose.ui.tooling.preview.Preview
|
||||||
import ui.theme.KeeTheme
|
import ui.theme.KeeTheme
|
||||||
|
|
||||||
|
private const val RECOVERY_WORDS_COUNT = 25
|
||||||
|
|
||||||
class ImportAccountScreen : Screen {
|
class ImportAccountScreen : Screen {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -51,11 +54,20 @@ private fun ImportAccountScreenContent() {
|
||||||
OutlinedTextField(
|
OutlinedTextField(
|
||||||
value = recoveryText,
|
value = recoveryText,
|
||||||
onValueChange = { recoveryText = it },
|
onValueChange = { recoveryText = it },
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
minLines = 5,
|
minLines = 5,
|
||||||
modifier = Modifier.fillMaxWidth()
|
maxLines = 5,
|
||||||
|
supportingText = {
|
||||||
|
Text(
|
||||||
|
text = "${recoveryWords.count()}/${RECOVERY_WORDS_COUNT} words",
|
||||||
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
textAlign = TextAlign.End,
|
||||||
|
)
|
||||||
|
}
|
||||||
)
|
)
|
||||||
Button(
|
Button(
|
||||||
enabled = recoveryWords.size == 2,
|
enabled = recoveryWords.size == RECOVERY_WORDS_COUNT,
|
||||||
|
modifier = Modifier.padding(top = 16.dp),
|
||||||
onClick = { navigator?.replace(HomeScreen()) }
|
onClick = { navigator?.replace(HomeScreen()) }
|
||||||
) {
|
) {
|
||||||
Text("Import Account")
|
Text("Import Account")
|
||||||
|
|
|
@ -14,7 +14,7 @@ fun main() = application {
|
||||||
size = DpSize(420.dp, 880.dp),
|
size = DpSize(420.dp, 880.dp),
|
||||||
position = WindowPosition(300.dp, 300.dp)
|
position = WindowPosition(300.dp, 300.dp)
|
||||||
)
|
)
|
||||||
Window(title = "", onCloseRequest = ::exitApplication, state = state) {
|
Window(title = "Kee", onCloseRequest = ::exitApplication, state = state) {
|
||||||
Navigator(HomeScreen())
|
Navigator(HomeScreen())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue