-
Notifications
You must be signed in to change notification settings - Fork 53
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
Implement OptimisingLayout #29
Conversation
Box(modifier = modifier) { | ||
BoxWithConstraints( | ||
modifier = Modifier | ||
.fillMaxSize(0.84f) |
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.
8% padding on each side instead of hardcoded padding values
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.
I wouldn't hardcode it here (+ the alignment too), this should depend on the call site composable probably.
What if you wouldn't have Box
+ BoxWithConstraints
but just the latter, then apply the incoming modifier
to it rather than on the outer Box
.
shared/src/commonMain/kotlin/com/bumble/puzzyx/composable/ScaledLayout.kt
Show resolved
Hide resolved
Box(modifier = modifier) { | ||
BoxWithConstraints( | ||
modifier = Modifier | ||
.fillMaxSize(0.84f) |
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.
I wouldn't hardcode it here (+ the alignment too), this should depend on the call site composable probably.
What if you wouldn't have Box
+ BoxWithConstraints
but just the latter, then apply the incoming modifier
to it rather than on the outer Box
.
.align(Alignment.Center) | ||
) { | ||
ScaledLayout( | ||
scale = ([email protected] / optimalWidth).coerceIn(0.1f, 1f), |
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.
Why coerceIn(0.1f, 1f)
?
I mean both: why these specific values + whether this could be a call site parameter.
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 shouldn't go above 1f, the lower value probably can be unrestricted
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.
We won't be using it above 1f but I guess it can still make sense? Not too important though.
Implement OptimisingLayout which calculates scaling factor based on the optimal and available space