feat: Refine ShoppingListDetailScreen UI and interaction\n\nThis commit refines the user interface and interaction for the ShoppingListDetailScreen.\n\nKey changes include:\n- Removed the duplicate list name display above the input field.\n- Removed the back navigation icon from the default TopAppBar when no item is selected, relying on system back navigation.\n- Ensured the contextual TopAppBar title is empty when an item is selected.\n- Added a quantity edit button to the contextual TopAppBar for selected items.

This commit is contained in:
2025-10-11 14:54:02 +02:00
parent 2f088ad9c2
commit 2970834778

View File

@@ -83,7 +83,7 @@ fun ShoppingListDetailScreen(
topBar = {
if (selectedItem != null) {
TopAppBar(
title = { Text(text = selectedItem!!.name) },
title = { Text(text = "") },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primaryContainer,
titleContentColor = MaterialTheme.colorScheme.primary,
@@ -113,20 +113,18 @@ fun ShoppingListDetailScreen(
IconButton(onClick = { showRenameDialog = true }) {
Icon(Icons.Filled.Edit, contentDescription = stringResource(R.string.rename))
}
IconButton(onClick = { showQuantityDialog = true }) {
Icon(Icons.Filled.LooksOne, contentDescription = stringResource(R.string.change_quantity))
}
}
)
} else {
TopAppBar(
title = { Text(text = shoppingListWithItems?.shoppingList?.name ?: stringResource(R.string.menu_shopping_list_detail)) },
title = { Text(text = shoppingListWithItems?.shoppingList?.name ?: "") },
colors = TopAppBarDefaults.topAppBarColors(
containerColor = MaterialTheme.colorScheme.primaryContainer,
titleContentColor = MaterialTheme.colorScheme.primary,
),
navigationIcon = {
IconButton(onClick = navigateBack) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
}
}
)
)
}
},
@@ -241,12 +239,6 @@ fun ShoppingListDetailScreen(
Spacer(modifier = Modifier.height(16.dp))
} else {
val list = shoppingListWithItems!!
Text(
text = list.shoppingList.name,
style = MaterialTheme.typography.headlineMedium,
modifier = Modifier.padding(bottom = 16.dp)
)
OutlinedTextField(
value = newItemName,
onValueChange = { newItemName = it },