-
Notifications
You must be signed in to change notification settings - Fork 0
Advnced Filter UI #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
zachseidner1
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please double check that your UI matches the Figma for future PRs before requesting my review. But thank you for your work!
| if (text.isNotEmpty()) { | ||
| Spacer(modifier = Modifier.width(8.dp)) | ||
| } | ||
| } | ||
| Text(text = text, style = bodyMedium.copy(color = White)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: imo it makes more sense to both wrap the Text and the Spacer in text.isNotEmpty() rather than just the Spacer
| if (expanded) { | ||
| Column { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you tried having this conditional rendering within the Column, and then given the Column the animateContentSize modifier? I think it would make this look much better!
| horizontalArrangement = Arrangement.SpaceBetween, | ||
| verticalAlignment = Alignment.CenterVertically | ||
| ) { | ||
| Text(title, fontSize = 18.sp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| var expanded by remember { mutableStateOf(false) } | ||
| var selectedOption by remember { mutableStateOf("Under $20") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This non-nullable type is asserting a filter is always selected. What about when there are no filters selected? Also, I think we should be using an enum class with a display string property to store the filters, rather than just strings.
| .clickable { selectedOption = option } | ||
| .padding(vertical = 4.dp) | ||
| ) { | ||
| RadioButton( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are just using the default material RadioButton. As a result the colors are wrong
| selected = (selectedOption == option), | ||
| onClick = { selectedOption = option } | ||
| ) | ||
| Text(option) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text is styled incorrectly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should not be committed. We should get rid of it and do the proper set up using GitHub secrets. See hustle-android for a recent example of this.
| onDismissRequest = { showBottomSheet = false }, | ||
| sheetState = sheetState | ||
| ) { | ||
| LazyColumn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: personally I'd prefer a regular Column since it makes the UI code easy to work with, and the list of filters will not realistically be so long as to cause performance issues.
| ButtonPrimary( | ||
| "", | ||
| painterResource(id = com.cornellappdev.score.R.drawable.advanced_filter) | ||
| ) { | ||
| onAdvFilterClick() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This button is completely off from the design. If necessary, create a new IconButton component. We need to respect the design.
An additional nit, you can pass onAdvFilterClick by reference for more concision.
One more nit, I always prefer not using shortened words like "Adv" in my variable names. To someone with no context on Score, this could be "onAdvantagedFilterClick", "onAdventurousFilterClick", etc..
It only takes a couple more characters to eliminate all of this ambiguity.

Overview
Added advanced filter button and buttonsheet.
Test Coverage
Visual Tests
Next Steps
ViewModel Logic
Related filtering logic: Related filtering logic