Switched to Material 3 text field
This commit is contained in:
parent
49aaf609b9
commit
7580e8ab62
3 changed files with 11 additions and 52 deletions
|
|
@ -36,10 +36,11 @@ fun PluginsList() = Column(
|
|||
var search by remember { mutableStateOf("") }
|
||||
|
||||
if (plugins.isNotEmpty()) {
|
||||
TextField(
|
||||
OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
value = search,
|
||||
onValueChange = { search = it },
|
||||
placeholder = { Text(stringResource(R.string.search)) },
|
||||
label = { Text(stringResource(R.string.search)) },
|
||||
trailingIcon = { Icon(Icons.Default.Search, stringResource(R.string.search_plugins)) },
|
||||
keyboardOptions = KeyboardOptions(autoCorrect = false, imeAction = ImeAction.Search),
|
||||
keyboardActions = KeyboardActions { focusManager.clearFocus() },
|
||||
|
|
|
|||
|
|
@ -1,45 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2022 Juby210 & zt
|
||||
* Licensed under the Open Software License version 3.0
|
||||
*/
|
||||
|
||||
package com.aliucord.manager.ui.components
|
||||
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.OutlinedTextField
|
||||
import androidx.compose.material.TextFieldDefaults
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
@Composable
|
||||
fun TextField(
|
||||
value: String,
|
||||
onValueChange: (String) -> Unit,
|
||||
placeholder: @Composable (() -> Unit)? = null,
|
||||
label: @Composable (() -> Unit)? = null,
|
||||
trailingIcon: @Composable (() -> Unit)? = null,
|
||||
keyboardOptions: KeyboardOptions = KeyboardOptions(autoCorrect = false),
|
||||
keyboardActions: KeyboardActions = KeyboardActions.Default,
|
||||
) = OutlinedTextField(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
singleLine = true,
|
||||
value = value,
|
||||
onValueChange = onValueChange,
|
||||
placeholder = placeholder,
|
||||
label = label,
|
||||
trailingIcon = trailingIcon,
|
||||
keyboardOptions = keyboardOptions,
|
||||
keyboardActions = keyboardActions,
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = TextFieldDefaults.outlinedTextFieldColors(
|
||||
textColor = MaterialTheme.colorScheme.onSecondaryContainer,
|
||||
backgroundColor = MaterialTheme.colorScheme.secondaryContainer,
|
||||
focusedBorderColor = MaterialTheme.colorScheme.outline,
|
||||
cursorColor = MaterialTheme.colorScheme.primary
|
||||
)
|
||||
)
|
||||
|
|
@ -22,7 +22,6 @@ import androidx.compose.ui.unit.dp
|
|||
import com.aliucord.manager.R
|
||||
import com.aliucord.manager.preferences.Prefs
|
||||
import com.aliucord.manager.ui.components.ListItem
|
||||
import com.aliucord.manager.ui.components.TextField
|
||||
import com.aliucord.manager.ui.components.settings.*
|
||||
import com.ramcosta.composedestinations.annotation.Destination
|
||||
|
||||
|
|
@ -57,10 +56,12 @@ fun SettingsScreen() = Column(
|
|||
preference = Prefs.replaceBg
|
||||
)
|
||||
|
||||
TextField(
|
||||
OutlinedTextField(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 10.dp),
|
||||
value = Prefs.appName.get(),
|
||||
onValueChange = Prefs.appName::set,
|
||||
placeholder = { Text(stringResource(R.string.app_name_setting)) },
|
||||
label = { Text(stringResource(R.string.app_name_setting)) },
|
||||
)
|
||||
|
||||
|
|
@ -73,10 +74,12 @@ fun SettingsScreen() = Column(
|
|||
)
|
||||
|
||||
if (devModeOn) {
|
||||
TextField(
|
||||
OutlinedTextField(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 8.dp),
|
||||
value = Prefs.packageName.get(),
|
||||
onValueChange = Prefs.packageName::set,
|
||||
placeholder = { Text(stringResource(R.string.package_name)) },
|
||||
label = { Text(stringResource(R.string.package_name)) },
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue