mirror of
https://github.com/bleackstorm/satiea.git
synced 2026-12-03 07:41:56 +01:00
fix(planning): respect safeDrawing and IME insets in barcode scanner dialog
This commit is contained in:
1 parent
7c5dab5477
commit
02ff698140
1 file changed
+33
-21
@@ -21,13 +21,14 @@ import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.safeDrawing
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.statusBarsPadding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
@@ -61,6 +62,7 @@ import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
@@ -137,23 +139,29 @@ fun BarcodeScannerScreen(
|
||||
onDismissRequest = onDismiss,
|
||||
properties = DialogProperties(
|
||||
usePlatformDefaultWidth = false,
|
||||
decorFitsSystemWindows = false
|
||||
decorFitsSystemWindows = true
|
||||
)
|
||||
) {
|
||||
BackHandler(onBack = onDismiss)
|
||||
|
||||
Surface(
|
||||
Scaffold(
|
||||
contentWindowInsets = WindowInsets.safeDrawing,
|
||||
containerColor = Color.Black,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.testTag("barcode_scanner_screen"),
|
||||
color = Color.Black
|
||||
.testTag("barcode_scanner_screen")
|
||||
) { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(innerPadding)
|
||||
.imePadding()
|
||||
) {
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
// Top camera preview section
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(0.46f)
|
||||
.weight(0.44f)
|
||||
.background(Color.Black)
|
||||
) {
|
||||
CameraBarcodePreview(
|
||||
@@ -170,15 +178,14 @@ fun BarcodeScannerScreen(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.statusBarsPadding()
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
.align(Alignment.TopCenter),
|
||||
horizontalArrangement = Arrangement.SpaceBetween,
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Surface(
|
||||
shape = CircleShape,
|
||||
color = Color.Black.copy(alpha = 0.55f)
|
||||
color = Color.Black.copy(alpha = 0.6f)
|
||||
) {
|
||||
IconButton(
|
||||
onClick = onDismiss,
|
||||
@@ -192,23 +199,30 @@ fun BarcodeScannerScreen(
|
||||
}
|
||||
}
|
||||
|
||||
Box(
|
||||
modifier = Modifier.weight(1f),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Surface(
|
||||
shape = RoundedCornerShape(20.dp),
|
||||
color = Color.Black.copy(alpha = 0.55f)
|
||||
color = Color.Black.copy(alpha = 0.6f)
|
||||
) {
|
||||
Text(
|
||||
text = if (isScanningPaused) "Scan en pause" else "Mode rafale actif",
|
||||
text = if (isScanningPaused) "En pause" else "Mode rafale",
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
fontWeight = FontWeight.SemiBold,
|
||||
color = Color.White,
|
||||
maxLines = 1,
|
||||
overflow = TextOverflow.Ellipsis,
|
||||
modifier = Modifier.padding(horizontal = 12.dp, vertical = 6.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) {
|
||||
Row(horizontalArrangement = Arrangement.spacedBy(6.dp)) {
|
||||
Surface(
|
||||
shape = CircleShape,
|
||||
color = Color.Black.copy(alpha = 0.55f)
|
||||
color = Color.Black.copy(alpha = 0.6f)
|
||||
) {
|
||||
IconButton(
|
||||
onClick = { showManualBarcodeDialog = true },
|
||||
@@ -223,7 +237,7 @@ fun BarcodeScannerScreen(
|
||||
}
|
||||
Surface(
|
||||
shape = CircleShape,
|
||||
color = Color.Black.copy(alpha = 0.55f)
|
||||
color = Color.Black.copy(alpha = 0.6f)
|
||||
) {
|
||||
IconButton(
|
||||
onClick = { isScanningPaused = !isScanningPaused },
|
||||
@@ -238,7 +252,7 @@ fun BarcodeScannerScreen(
|
||||
}
|
||||
Surface(
|
||||
shape = CircleShape,
|
||||
color = Color.Black.copy(alpha = 0.55f)
|
||||
color = Color.Black.copy(alpha = 0.6f)
|
||||
) {
|
||||
IconButton(
|
||||
onClick = { torchEnabled = !torchEnabled },
|
||||
@@ -293,14 +307,12 @@ fun BarcodeScannerScreen(
|
||||
Surface(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(0.54f),
|
||||
.weight(0.56f),
|
||||
shape = RoundedCornerShape(topStart = 24.dp, topEnd = 24.dp),
|
||||
color = MaterialTheme.colorScheme.surface
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.navigationBarsPadding()
|
||||
modifier = Modifier.fillMaxSize()
|
||||
) {
|
||||
// Tray header
|
||||
Row(
|
||||
|
||||
Reference in new issue
Block a user