mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-26 09:36:50 +00:00
63 lines
2.3 KiB
Kotlin
63 lines
2.3 KiB
Kotlin
|
// SPDX-License-Identifier: GPL-3.0-only
|
||
|
package helium314.keyboard.settings
|
||
|
|
||
|
import androidx.compose.foundation.layout.Column
|
||
|
import androidx.compose.foundation.layout.ColumnScope
|
||
|
import androidx.compose.foundation.layout.WindowInsets
|
||
|
import androidx.compose.foundation.layout.WindowInsetsSides
|
||
|
import androidx.compose.foundation.layout.fillMaxSize
|
||
|
import androidx.compose.foundation.layout.only
|
||
|
import androidx.compose.foundation.layout.safeDrawing
|
||
|
import androidx.compose.foundation.layout.windowInsetsPadding
|
||
|
import androidx.compose.foundation.rememberScrollState
|
||
|
import androidx.compose.foundation.verticalScroll
|
||
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||
|
import androidx.compose.material3.Icon
|
||
|
import androidx.compose.material3.IconButton
|
||
|
import androidx.compose.material3.LocalTextStyle
|
||
|
import androidx.compose.material3.MaterialTheme
|
||
|
import androidx.compose.material3.Text
|
||
|
import androidx.compose.material3.TopAppBar
|
||
|
import androidx.compose.material3.TopAppBarDefaults
|
||
|
import androidx.compose.runtime.Composable
|
||
|
import androidx.compose.runtime.CompositionLocalProvider
|
||
|
import androidx.compose.ui.Modifier
|
||
|
import androidx.compose.ui.res.painterResource
|
||
|
import androidx.compose.ui.res.stringResource
|
||
|
import helium314.keyboard.latin.R
|
||
|
|
||
|
@OptIn(ExperimentalMaterial3Api::class)
|
||
|
@Composable
|
||
|
fun PrefScreen(
|
||
|
onClickBack: () -> Unit,
|
||
|
title: String,
|
||
|
content: @Composable ColumnScope.() -> Unit
|
||
|
) {
|
||
|
Column(Modifier.fillMaxSize()) {
|
||
|
TopAppBar(
|
||
|
title = { Text(title) },
|
||
|
windowInsets = TopAppBarDefaults.windowInsets,
|
||
|
navigationIcon = {
|
||
|
IconButton(onClick = onClickBack) {
|
||
|
Icon(
|
||
|
painterResource(R.drawable.ic_arrow_left), // see SearchScreen
|
||
|
stringResource(R.string.spoken_description_action_previous)
|
||
|
)
|
||
|
}
|
||
|
},
|
||
|
)
|
||
|
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyLarge) {
|
||
|
Column(
|
||
|
Modifier
|
||
|
.verticalScroll(rememberScrollState())
|
||
|
.windowInsetsPadding(
|
||
|
WindowInsets.safeDrawing.only(
|
||
|
WindowInsetsSides.Horizontal + WindowInsetsSides.Bottom
|
||
|
))
|
||
|
) {
|
||
|
content()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|