Feat: UI-Anpassungen und Fehlerbehebungen
- Behebt Probleme bei der Artikelauswahl und beim Neuanordnen in der Einkaufslistendetailansicht. - Passt Abstände und Farben für eine sauberere Benutzeroberfläche an. - Behebt Probleme mit den Fensterrändern im Hoch- und Querformat.
This commit is contained in:
@@ -15,6 +15,7 @@ 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.size
|
||||
import androidx.compose.foundation.layout.systemBars
|
||||
@@ -23,6 +24,7 @@ import androidx.compose.foundation.layout.WindowInsetsSides
|
||||
import androidx.compose.foundation.layout.only
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.safeDrawing
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.automirrored.filled.PlaylistAdd
|
||||
@@ -160,7 +162,7 @@ fun AppShell(
|
||||
}
|
||||
) {
|
||||
Scaffold(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.safeDrawing.only(WindowInsetsSides.Horizontal)),
|
||||
topBar = {
|
||||
val topBarTitle = when (currentScreen) {
|
||||
is Screen.ShoppingListDetail -> shoppingListWithItems?.shoppingList?.name ?: ""
|
||||
@@ -170,14 +172,14 @@ fun AppShell(
|
||||
Column {
|
||||
if (currentScreen == Screen.ShoppingListDetail) {
|
||||
TopAppBar(
|
||||
title = { Text(topBarTitle, color = Color.White) },
|
||||
title = { Text(topBarTitle) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = { currentScreen = Screen.ShoppingLists; selectedListId = null }) {
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back), tint = Color.White)
|
||||
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back))
|
||||
}
|
||||
},
|
||||
actions = {
|
||||
IconButton(onClick = { scope.launch { selectedItem?.let { shoppingListsViewModel.moveItemUp(selectedListId ?: 0, it) } } }, enabled = selectedItem != null,
|
||||
IconButton(onClick = { scope.launch { selectedItem?.let { shoppingListsViewModel.moveItemUp(selectedListId ?: 0, it) }; shoppingListsViewModel.onSelectItem(null) } }, enabled = selectedItem != null,
|
||||
modifier = Modifier.pointerInput(Unit) {
|
||||
detectTapGestures(
|
||||
onLongPress = {
|
||||
@@ -186,9 +188,9 @@ fun AppShell(
|
||||
)
|
||||
}
|
||||
) {
|
||||
Icon(Icons.Default.ArrowUpward, contentDescription = stringResource(R.string.move_item_up), tint = Color.White)
|
||||
Icon(Icons.Default.ArrowUpward, contentDescription = stringResource(R.string.move_item_up))
|
||||
}
|
||||
IconButton(onClick = { scope.launch { selectedItem?.let { shoppingListsViewModel.moveItemDown(selectedListId ?: 0, it) } } }, enabled = selectedItem != null,
|
||||
IconButton(onClick = { scope.launch { selectedItem?.let { shoppingListsViewModel.moveItemDown(selectedListId ?: 0, it) } }; shoppingListsViewModel.onSelectItem(null) }, enabled = selectedItem != null,
|
||||
modifier = Modifier.pointerInput(Unit) {
|
||||
detectTapGestures(
|
||||
onLongPress = {
|
||||
@@ -197,11 +199,11 @@ fun AppShell(
|
||||
)
|
||||
}
|
||||
) {
|
||||
Icon(Icons.Default.ArrowDownward, contentDescription = stringResource(R.string.move_item_down), tint = Color.White)
|
||||
Icon(Icons.Default.ArrowDownward, contentDescription = stringResource(R.string.move_item_down))
|
||||
}
|
||||
var showMenu by remember { mutableStateOf(false) }
|
||||
IconButton(onClick = { showMenu = !showMenu }, enabled = selectedItem != null) {
|
||||
Icon(Icons.Default.MoreVert, contentDescription = stringResource(R.string.more_options), tint = Color.White)
|
||||
Icon(Icons.Default.MoreVert, contentDescription = stringResource(R.string.more_options))
|
||||
}
|
||||
DropdownMenu(expanded = showMenu, onDismissRequest = { showMenu = false }) {
|
||||
DropdownMenuItem(text = { Text(stringResource(R.string.rename)) }, onClick = { shoppingListsViewModel.onShowRenameDialog(true); showMenu = false })
|
||||
@@ -209,7 +211,7 @@ fun AppShell(
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer
|
||||
containerColor = Color.Transparent
|
||||
)
|
||||
)
|
||||
} else {
|
||||
@@ -219,7 +221,10 @@ fun AppShell(
|
||||
IconButton(onClick = { scope.launch { drawerState.apply { if (isClosed) open() else close() } } }) {
|
||||
Icon(imageVector = Icons.Default.Menu, contentDescription = stringResource(id = R.string.menu_open))
|
||||
}
|
||||
}
|
||||
},
|
||||
colors = TopAppBarDefaults.topAppBarColors(
|
||||
containerColor = Color.Transparent
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -231,7 +236,7 @@ fun AppShell(
|
||||
leadingIcon = { Icon(Icons.Default.Search, contentDescription = null) },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
||||
.padding(horizontal = 16.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -239,7 +244,7 @@ fun AppShell(
|
||||
bottomBar = {
|
||||
if (currentScreen == Screen.ShoppingListDetail) {
|
||||
BottomAppBar(
|
||||
modifier = Modifier.imePadding(),
|
||||
modifier = Modifier.navigationBarsPadding().imePadding().height(56.dp),
|
||||
) {
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
|
||||
@@ -150,7 +150,7 @@ fun ShoppingListDetailScreen(
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.shadow(elevation)
|
||||
.background(if (isSelected) MaterialTheme.colorScheme.primaryContainer else Color.Transparent)
|
||||
.background(if (isSelected) MaterialTheme.colorScheme.surfaceVariant else Color.Transparent)
|
||||
.pointerInput(Unit) {
|
||||
detectTapGestures(
|
||||
onTap = {
|
||||
@@ -167,7 +167,7 @@ fun ShoppingListDetailScreen(
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp),
|
||||
.padding(vertical = 8.dp, horizontal = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Text(
|
||||
|
||||
@@ -166,7 +166,7 @@ fun ShoppingListCard(
|
||||
Card(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.padding(vertical = 8.dp)
|
||||
.padding(vertical = 8.dp, horizontal = 16.dp)
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
Row(
|
||||
|
||||
@@ -8,6 +8,4 @@ val Pink80 = Color(0xFFEFB8C8)
|
||||
|
||||
val Purple40 = Color(0xFF6650a4)
|
||||
val PurpleGrey40 = Color(0xFF625b71)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
|
||||
val DarkPrimaryContainer = Color(0xFF6975BC)
|
||||
val Pink40 = Color(0xFF7D5260)
|
||||
@@ -14,8 +14,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
private val DarkColorScheme = darkColorScheme(
|
||||
primary = Purple80,
|
||||
secondary = PurpleGrey80,
|
||||
tertiary = Pink80,
|
||||
primaryContainer = DarkPrimaryContainer
|
||||
tertiary = Pink80
|
||||
)
|
||||
|
||||
private val LightColorScheme = lightColorScheme(
|
||||
|
||||
Reference in New Issue
Block a user