mirror of
https://github.com/msfjarvis/compose-lobsters
synced 2025-08-14 22:17:03 +05:30
refactor: simplify settings screen
This commit is contained in:
parent
92fb2939e6
commit
1385edc3bf
1 changed files with 41 additions and 44 deletions
|
@ -11,7 +11,6 @@ import androidx.activity.compose.rememberLauncherForActivityResult
|
|||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
|
@ -63,8 +62,7 @@ fun SettingsScreen(
|
|||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val coroutineScope = rememberCoroutineScope()
|
||||
Box(modifier = modifier.padding(contentPadding)) {
|
||||
Column {
|
||||
Column(modifier.padding(contentPadding)) {
|
||||
ListItem(
|
||||
headlineContent = { Text("Data transfer") },
|
||||
leadingContent = {
|
||||
|
@ -103,7 +101,6 @@ fun SettingsScreen(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.ImportPosts(
|
||||
|
@ -136,12 +133,12 @@ private fun RowScope.ImportPosts(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun RowScope.ExportPosts(
|
||||
private inline fun RowScope.ExportPosts(
|
||||
coroutineScope: CoroutineScope,
|
||||
snackbarHostState: SnackbarHostState,
|
||||
openOutputStream: (Uri) -> OutputStream?,
|
||||
exportPostsAsJson: suspend (OutputStream) -> Unit,
|
||||
exportPostsAsHtml: suspend (OutputStream) -> Unit,
|
||||
crossinline openOutputStream: (Uri) -> OutputStream?,
|
||||
crossinline exportPostsAsJson: suspend (OutputStream) -> Unit,
|
||||
crossinline exportPostsAsHtml: suspend (OutputStream) -> Unit,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
val jsonExportAction =
|
||||
|
@ -208,7 +205,7 @@ private fun RowScope.ExportPosts(
|
|||
}
|
||||
|
||||
/** Shows a Snackbar but dismisses any existing ones first. */
|
||||
private suspend fun SnackbarHostState.showSnackbarDismissing(text: String) {
|
||||
private suspend inline fun SnackbarHostState.showSnackbarDismissing(text: String) {
|
||||
currentSnackbarData?.dismiss()
|
||||
showSnackbar(text)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue