better "add dictionary" button in dictionaries screen

This commit is contained in:
Helium314 2025-03-01 10:31:38 +01:00
parent b69ec39539
commit f0bb541b72

View file

@ -4,9 +4,12 @@ package helium314.keyboard.settings.screens
import android.content.Context
import android.content.Intent
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
@ -15,8 +18,10 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.tooling.preview.Preview
@ -70,7 +75,19 @@ fun DictionaryScreen(
},
itemContent = { locale ->
if (locale.language == SubtypeLocaleUtils.NO_LANGUAGE) {
Text(stringResource(R.string.add_new_dictionary_title), Modifier.clickable { showAddDictDialog = true })
Row(
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.padding(vertical = 4.dp, horizontal = 16.dp)
.fillMaxWidth()
.clickable { showAddDictDialog = true }
) {
Text(
stringResource(R.string.add_new_dictionary_title),
)
Icon(painterResource(R.drawable.ic_plus), stringResource(R.string.add_new_dictionary_title))
}
} else {
Column(
Modifier.clickable { selectedLocale = locale }