Skip to content

[Dynamic Dashboard] Fix date header layout to work better with large fonts #11552

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

Merged
merged 2 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
18.7
-----
- [*] Products: Fixed a bug that caused the app to crash sometimes during screen rotation [https://github.com/woocommerce/woocommerce-android/pull/11484]
- [*] Dashboard: Fixed an issue that caused the date range picker to be invisible when using large fonts [https://github.com/woocommerce/woocommerce-android/pull/11552]

18.6
-----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.defaultMinSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.material.ContentAlpha
import androidx.compose.material.DropdownMenu
import androidx.compose.material.DropdownMenuItem
Expand Down Expand Up @@ -56,12 +57,14 @@ fun DashboardStatsHeader(
style = MaterialTheme.typography.body2,
color = MaterialTheme.colors.onSurface
)
val isCustomRange = rangeSelection.selectionType == SelectionType.CUSTOM

val isCustomRange = rangeSelection.selectionType == SelectionType.CUSTOM
Row(
horizontalArrangement = Arrangement.spacedBy(dimensionResource(id = dimen.minor_100)),
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.weight(1f)
.wrapContentSize(align = Alignment.CenterStart)
Comment on lines +66 to +67
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weight will make sure this layout will have a lower priority than the IconButton below, and the wrapContentSize modifier will make sure the view's content won't fill the space when it's larger than the content.

.then(if (isCustomRange) Modifier.clickable(onClick = onCustomRangeClick) else Modifier)
.padding(dimensionResource(id = dimen.minor_100))
) {
Expand All @@ -72,7 +75,8 @@ fun DashboardStatsHeader(
MaterialTheme.colors.primary
} else {
MaterialTheme.colors.onSurface.copy(alpha = ContentAlpha.medium)
}
},
modifier = Modifier.weight(1f, fill = false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this to make sure the Pencil icon is always visible.

)
if (isCustomRange) {
Icon(
Expand All @@ -84,8 +88,6 @@ fun DashboardStatsHeader(
}
}

Spacer(modifier = Modifier.weight(1f))

Box {
var isMenuExpanded by remember { mutableStateOf(false) }
IconButton(
Expand Down
Loading