-
Notifications
You must be signed in to change notification settings - Fork 73
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
Make CrossAxisAlignment
modifier available for items within LazyList
#1288
base: trunk
Are you sure you want to change the base?
Conversation
(widget.value.parent as? FrameLayout)?.removeAllViews() | ||
widget.value.layoutParams = layoutParams | ||
holder.container.addView(widget.value) | ||
widget.value.applyModifier(widget.modifier) |
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 needs to be re-applied if the modifier changes. I tried listening to changes in Items#onModifierUpdated
, but it was never called on change.
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.
Seems like a bug! FYI @JakeWharton
76b3d70
to
ef8332c
Compare
@@ -25,25 +25,25 @@ import app.cash.redwood.ui.Margin | |||
@LayoutScopeMarker | |||
public interface LazyListScope { | |||
public fun item( | |||
content: @Composable () -> Unit, | |||
content: @Composable LazyItemScope.() -> Unit, |
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.
Nice
import app.cash.redwood.layout.api.CrossAxisAlignment | ||
import app.cash.redwood.layout.modifier.Alignment | ||
|
||
internal class AlignmentImpl( |
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.
not a data class?
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.
It's copied generated code from redwood-layout-compose
. Ultimately I want to share modifier
definitions with redwood-layout
, so this is somewhat of a stop gap in the meantime.
ef8332c
to
9bdec48
Compare
public fun Modifier.alignment(alignment: CrossAxisAlignment): Modifier = | ||
then(AlignmentImpl(alignment)) |
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.
@colinrtwhite Do you have any ideas on how to convert this to horizontalAlignment
/verticalAlignment
without introducing a new scope? LazyItemScope
is used for more than just scoping modifiers (see LazyListIntervalContent
), so I'm a bit hesitant to just have two separate scopes for LazyRow
and LazyColumn
.
Closes #1265
This only works for Android Views.