Share Username dialog body; make BasicTextField cursor visible in dark mode
- New: shared/ui/UsernameDialogContent.kt (material-free) - Android: use UsernameDialogContent for title/message/input; keep platform buttons - Fix: pass cursorColor (Material color) to shared content so caret is visible in dark theme
This commit is contained in:
@@ -148,6 +148,7 @@ import app.klottr.ui.LoginRequiredContent
|
||||
import app.klottr.ui.NearbyContent // Delat material-fritt innehåll för Närliggande
|
||||
import app.klottr.ui.NearbyDialogContent
|
||||
import app.klottr.ui.SettingsContent // Delad material-fri UI för inställningar
|
||||
import app.klottr.ui.UsernameDialogContent
|
||||
import app.klottr.ui.WikiDetailContent // Ny: delad Wiki-layout
|
||||
import app.klottr.ui.WriteDocContent // Använd delad, material-fri formulär-UI
|
||||
import app.klottr.util.Auth
|
||||
@@ -1573,37 +1574,38 @@ private fun UsernameDialog(
|
||||
modifier = Modifier.padding(20.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
) {
|
||||
Text("Välj användarnamn", style = MaterialTheme.typography.titleLarge)
|
||||
Text(
|
||||
"Du måste välja ett användarnamn för att fortsätta.",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
|
||||
OutlinedTextField(
|
||||
value = input,
|
||||
onValueChange = {
|
||||
UsernameDialogContent(
|
||||
titleText = "Välj användarnamn",
|
||||
messageText = "Du måste välja ett användarnamn för att fortsätta.",
|
||||
input = input,
|
||||
onInputChange = {
|
||||
input = it
|
||||
validateLocal(it)
|
||||
// display uppdateras i validateLocal
|
||||
validateLocal(it) // Uppdaterar även 'display'
|
||||
},
|
||||
label = { Text("Användarnamn") },
|
||||
singleLine = true,
|
||||
isError = localErr != null || remoteErr != null,
|
||||
supportingText = {
|
||||
val msg = localErr ?: remoteErr
|
||||
if (checking && msg == null) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
CircularProgressIndicator(modifier = Modifier.size(16.dp), strokeWidth = 2.dp)
|
||||
Text("Kontrollerar …")
|
||||
}
|
||||
} else if (msg != null) {
|
||||
Text(msg, color = MaterialTheme.colorScheme.error)
|
||||
} else if (okRemote && display.isNotBlank()) {
|
||||
Text("Namnet är ledigt.")
|
||||
}
|
||||
placeholder = "Användarnamn",
|
||||
titleStyle = MaterialTheme.typography.titleLarge.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
),
|
||||
messageStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
),
|
||||
inputTextStyle = MaterialTheme.typography.bodyMedium.copy(
|
||||
color = MaterialTheme.colorScheme.onSurface
|
||||
),
|
||||
statusText = when {
|
||||
checking && localErr == null && remoteErr == null -> "Kontrollerar …"
|
||||
localErr != null -> localErr
|
||||
remoteErr != null -> remoteErr
|
||||
okRemote && display.isNotBlank() -> "Namnet är ledigt."
|
||||
else -> null
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
statusStyle = when {
|
||||
localErr != null || remoteErr != null ->
|
||||
MaterialTheme.typography.bodySmall.copy(color = MaterialTheme.colorScheme.error)
|
||||
else ->
|
||||
MaterialTheme.typography.bodySmall.copy(color = MaterialTheme.colorScheme.onSurfaceVariant)
|
||||
},
|
||||
cursorColor = MaterialTheme.colorScheme.primary // Ny: tydlig markör i både ljust/mörkt läge
|
||||
)
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(12.dp)) {
|
||||
|
||||
Reference in New Issue
Block a user