11package de.pawcode.cardstore.ui.screens
22
3+ import androidx.compose.foundation.layout.Arrangement
34import androidx.compose.foundation.layout.Box
45import androidx.compose.foundation.layout.Column
6+ import androidx.compose.foundation.layout.Row
57import androidx.compose.foundation.layout.WindowInsets
68import androidx.compose.foundation.layout.fillMaxHeight
79import androidx.compose.foundation.layout.padding
10+ import androidx.compose.foundation.layout.size
811import androidx.compose.foundation.layout.statusBars
912import androidx.compose.foundation.layout.windowInsetsPadding
1013import androidx.compose.foundation.lazy.grid.rememberLazyGridState
@@ -24,9 +27,11 @@ import androidx.compose.material.icons.outlined.QrCodeScanner
2427import androidx.compose.material.icons.twotone.CreditCard
2528import androidx.compose.material.icons.twotone.DeleteForever
2629import androidx.compose.material3.ExperimentalMaterial3Api
30+ import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
2731import androidx.compose.material3.ExtendedFloatingActionButton
32+ import androidx.compose.material3.FilledIconButton
2833import androidx.compose.material3.Icon
29- import androidx.compose.material3.IconButton
34+ import androidx.compose.material3.IconButtonDefaults
3035import androidx.compose.material3.ModalBottomSheet
3136import androidx.compose.material3.Scaffold
3237import androidx.compose.material3.Text
@@ -151,7 +156,7 @@ fun CardListScreen(navController: NavController, viewModel: CardViewModel = view
151156 )
152157}
153158
154- @OptIn(ExperimentalMaterial3Api ::class )
159+ @OptIn(ExperimentalMaterial3Api ::class , ExperimentalMaterial3ExpressiveApi :: class )
155160@Composable
156161fun CardListScreenComponent (
157162 cardsFlow : Flow <List <CardWithLabels >>,
@@ -217,38 +222,58 @@ fun CardListScreenComponent(
217222 AppBar (
218223 title = stringResource(R .string.app_name),
219224 actions = {
220- IconButton (onClick = { onShowAbout() }) {
221- Icon (Icons .Outlined .Info , contentDescription = stringResource(R .string.about))
222- }
223- SelectDropdownMenu (
224- icon = Icons .AutoMirrored .Filled .Sort ,
225- title = stringResource(R .string.cards_sort),
226- value = sortBy,
227- values =
228- listOf (
229- DropdownOption (
230- title = stringResource(R .string.sort_intelligent),
231- icon = Icons .Filled .AutoFixHigh ,
232- value = SortAttribute .INTELLIGENT ,
233- ),
234- DropdownOption (
235- title = stringResource(R .string.sort_alphabetically),
236- icon = Icons .Filled .SortByAlpha ,
237- value = SortAttribute .ALPHABETICALLY ,
225+ Row (horizontalArrangement = Arrangement .spacedBy(8 .dp)) {
226+ FilledIconButton (
227+ modifier =
228+ Modifier .size(
229+ IconButtonDefaults .smallContainerSize(
230+ IconButtonDefaults .IconButtonWidthOption .Wide
231+ )
238232 ),
239- DropdownOption (
240- title = stringResource(R .string.sort_most_used),
241- icon = Icons .AutoMirrored .Filled .TrendingUp ,
242- value = SortAttribute .MOST_USED ,
233+ onClick = { onShowAbout() },
234+ shapes =
235+ IconButtonDefaults .shapes(
236+ shape = IconButtonDefaults .smallRoundShape,
237+ pressedShape = IconButtonDefaults .smallPressedShape,
243238 ),
244- DropdownOption (
245- title = stringResource(R .string.sort_recently_used),
246- icon = Icons .Filled .History ,
247- value = SortAttribute .RECENTLY_USED ,
239+ ) {
240+ Icon (
241+ Icons .Outlined .Info ,
242+ contentDescription = stringResource(R .string.about),
243+ modifier = Modifier .size(IconButtonDefaults .smallIconSize),
244+ )
245+ }
246+
247+ SelectDropdownMenu (
248+ icon = Icons .AutoMirrored .Filled .Sort ,
249+ title = stringResource(R .string.cards_sort),
250+ value = sortBy,
251+ values =
252+ listOf (
253+ DropdownOption (
254+ title = stringResource(R .string.sort_intelligent),
255+ icon = Icons .Filled .AutoFixHigh ,
256+ value = SortAttribute .INTELLIGENT ,
257+ ),
258+ DropdownOption (
259+ title = stringResource(R .string.sort_alphabetically),
260+ icon = Icons .Filled .SortByAlpha ,
261+ value = SortAttribute .ALPHABETICALLY ,
262+ ),
263+ DropdownOption (
264+ title = stringResource(R .string.sort_most_used),
265+ icon = Icons .AutoMirrored .Filled .TrendingUp ,
266+ value = SortAttribute .MOST_USED ,
267+ ),
268+ DropdownOption (
269+ title = stringResource(R .string.sort_recently_used),
270+ icon = Icons .Filled .History ,
271+ value = SortAttribute .RECENTLY_USED ,
272+ ),
248273 ),
249- ) ,
250- onValueChange = { onSortChange(it) },
251- )
274+ onValueChange = { onSortChange(it) } ,
275+ )
276+ }
252277 },
253278 )
254279 },
@@ -449,8 +474,8 @@ fun CardListScreenComponent(
449474 }
450475}
451476
452- @Preview
453- @Preview(device = " id:pixel_tablet" )
477+ @Preview(showSystemUi = true )
478+ @Preview(device = " id:pixel_tablet" , showSystemUi = true )
454479@Composable
455480fun PreviewCardListScreenComponent () {
456481 CardListScreenComponent (
@@ -468,8 +493,8 @@ fun PreviewCardListScreenComponent() {
468493 )
469494}
470495
471- @Preview
472- @Preview(device = " id:pixel_tablet" )
496+ @Preview(showSystemUi = true )
497+ @Preview(device = " id:pixel_tablet" , showSystemUi = true )
473498@Composable
474499fun PreviewCardListScreenComponentEmpty () {
475500 CardListScreenComponent (
0 commit comments