mirror of
https://github.com/mollyim/monero-wallet-sdk.git
synced 2025-01-25 22:45:54 -05:00
demo: add title to settings screen
This commit is contained in:
parent
c09e3a7894
commit
979e547346
@ -9,6 +9,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.input.nestedscroll.nestedScroll
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.tooling.preview.Preview
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@ -17,6 +18,7 @@ import androidx.lifecycle.viewmodel.compose.viewModel
|
|||||||
import im.molly.monero.demo.data.model.RemoteNode
|
import im.molly.monero.demo.data.model.RemoteNode
|
||||||
import im.molly.monero.demo.data.model.UserSettings
|
import im.molly.monero.demo.data.model.UserSettings
|
||||||
import im.molly.monero.demo.data.model.toSocketAddress
|
import im.molly.monero.demo.data.model.toSocketAddress
|
||||||
|
import im.molly.monero.demo.ui.component.Toolbar
|
||||||
import im.molly.monero.demo.ui.theme.AppIcons
|
import im.molly.monero.demo.ui.theme.AppIcons
|
||||||
import im.molly.monero.demo.ui.theme.AppTheme
|
import im.molly.monero.demo.ui.theme.AppTheme
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ fun SettingsRoute(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
private fun SettingsScreen(
|
private fun SettingsScreen(
|
||||||
settingsUiState: SettingsUiState,
|
settingsUiState: SettingsUiState,
|
||||||
@ -49,14 +52,27 @@ private fun SettingsScreen(
|
|||||||
onChangeSocksProxy: (String) -> Unit = {},
|
onChangeSocksProxy: (String) -> Unit = {},
|
||||||
onValidateSocksProxy: (String) -> Boolean = { true },
|
onValidateSocksProxy: (String) -> Boolean = { true },
|
||||||
) {
|
) {
|
||||||
|
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
|
||||||
|
Scaffold(
|
||||||
|
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
|
||||||
|
topBar = {
|
||||||
|
Toolbar(
|
||||||
|
title = "Settings",
|
||||||
|
scrollBehavior = scrollBehavior,
|
||||||
|
)
|
||||||
|
},
|
||||||
|
) { padding ->
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(padding)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
when (settingsUiState) {
|
when (settingsUiState) {
|
||||||
SettingsUiState.Loading -> {
|
SettingsUiState.Loading -> {
|
||||||
// TODO: Add loading wheel
|
// TODO: Add loading wheel
|
||||||
}
|
}
|
||||||
|
|
||||||
is SettingsUiState.Success -> {
|
is SettingsUiState.Success -> {
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
header = {
|
header = {
|
||||||
@ -73,7 +89,7 @@ private fun SettingsScreen(
|
|||||||
remoteNodes = settingsUiState.remoteNodes,
|
remoteNodes = settingsUiState.remoteNodes,
|
||||||
onEditRemoteNode = onEditRemoteNode,
|
onEditRemoteNode = onEditRemoteNode,
|
||||||
onDeleteRemoteNode = onDeleteRemoteNode,
|
onDeleteRemoteNode = onDeleteRemoteNode,
|
||||||
modifier = Modifier.padding(start = 24.dp),
|
modifier = Modifier.padding(start = 24.dp, bottom = 16.dp),
|
||||||
)
|
)
|
||||||
SettingsSection(
|
SettingsSection(
|
||||||
header = {
|
header = {
|
||||||
@ -94,6 +110,7 @@ private fun SettingsScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun SettingsSection(
|
private fun SettingsSection(
|
||||||
@ -104,7 +121,7 @@ private fun SettingsSection(
|
|||||||
Column(
|
Column(
|
||||||
modifier = modifier.padding(horizontal = 24.dp),
|
modifier = modifier.padding(horizontal = 24.dp),
|
||||||
) {
|
) {
|
||||||
Divider(Modifier.padding(bottom = 24.dp))
|
HorizontalDivider(Modifier.padding(bottom = 16.dp))
|
||||||
Row(
|
Row(
|
||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user