mirror of
https://github.com/bleackstorm/satiea.git
synced 2026-12-03 07:41:56 +01:00
fix(planning): anchor barcode scanner footer in Scaffold bottomBar above nav bar
This commit is contained in:
1 parent
d2024c59c2
commit
6b245d31bb
1 file changed
+72
-67
@@ -26,9 +26,10 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.imePadding
|
||||
import androidx.compose.foundation.layout.navigationBarsPadding
|
||||
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
|
||||
@@ -139,29 +140,92 @@ fun BarcodeScannerScreen(
|
||||
onDismissRequest = onDismiss,
|
||||
properties = DialogProperties(
|
||||
usePlatformDefaultWidth = false,
|
||||
decorFitsSystemWindows = true
|
||||
decorFitsSystemWindows = false
|
||||
)
|
||||
) {
|
||||
BackHandler(onBack = onDismiss)
|
||||
|
||||
Scaffold(
|
||||
contentWindowInsets = WindowInsets.safeDrawing,
|
||||
contentWindowInsets = WindowInsets(0, 0, 0, 0),
|
||||
containerColor = Color.Black,
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.testTag("barcode_scanner_screen")
|
||||
.testTag("barcode_scanner_screen"),
|
||||
bottomBar = {
|
||||
Surface(
|
||||
tonalElevation = 6.dp,
|
||||
shadowElevation = 8.dp,
|
||||
color = MaterialTheme.colorScheme.surface,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.navigationBarsPadding()
|
||||
.imePadding()
|
||||
.padding(horizontal = 16.dp, vertical = 12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
if (scannedItems.isNotEmpty()) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { alsoCheckShoppingList = !alsoCheckShoppingList },
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Checkbox(
|
||||
checked = alsoCheckShoppingList,
|
||||
onCheckedChange = { alsoCheckShoppingList = it }
|
||||
)
|
||||
Text(
|
||||
text = "Cocher aussi sur la liste de courses",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
onConfirmImport(alsoCheckShoppingList)
|
||||
onDismiss()
|
||||
},
|
||||
enabled = validItemsCount > 0,
|
||||
shape = RoundedCornerShape(14.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp)
|
||||
.testTag("barcode_confirm_import_button")
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Check,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(18.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(
|
||||
text = if (validItemsCount > 0) {
|
||||
"Ajouter au stock ($validItemsCount)"
|
||||
} else {
|
||||
"Ajouter au stock"
|
||||
},
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
) { innerPadding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.padding(innerPadding)
|
||||
.imePadding()
|
||||
.padding(bottom = innerPadding.calculateBottomPadding())
|
||||
) {
|
||||
// Top camera preview section
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.weight(0.44f)
|
||||
.weight(0.45f)
|
||||
.background(Color.Black)
|
||||
) {
|
||||
CameraBarcodePreview(
|
||||
@@ -178,6 +242,7 @@ fun BarcodeScannerScreen(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.statusBarsPadding()
|
||||
.padding(horizontal = 12.dp, vertical = 8.dp)
|
||||
.align(Alignment.TopCenter),
|
||||
horizontalArrangement = Arrangement.spacedBy(6.dp),
|
||||
@@ -402,66 +467,6 @@ fun BarcodeScannerScreen(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Sticky footer
|
||||
Surface(
|
||||
tonalElevation = 3.dp,
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 10.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(6.dp)
|
||||
) {
|
||||
if (scannedItems.isNotEmpty()) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.clickable { alsoCheckShoppingList = !alsoCheckShoppingList },
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Checkbox(
|
||||
checked = alsoCheckShoppingList,
|
||||
onCheckedChange = { alsoCheckShoppingList = it }
|
||||
)
|
||||
Text(
|
||||
text = "Cocher aussi sur la liste de courses",
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Button(
|
||||
onClick = {
|
||||
onConfirmImport(alsoCheckShoppingList)
|
||||
onDismiss()
|
||||
},
|
||||
enabled = validItemsCount > 0,
|
||||
shape = RoundedCornerShape(14.dp),
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.height(48.dp)
|
||||
.testTag("barcode_confirm_import_button")
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Check,
|
||||
contentDescription = null,
|
||||
modifier = Modifier.size(18.dp)
|
||||
)
|
||||
Spacer(modifier = Modifier.width(8.dp))
|
||||
Text(
|
||||
text = if (validItemsCount > 0) {
|
||||
"Ajouter au stock ($validItemsCount)"
|
||||
} else {
|
||||
"Ajouter au stock"
|
||||
},
|
||||
fontWeight = FontWeight.SemiBold
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user