Skip to content
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

Refactor FAB with onScroll animation #1475

Conversation

jamilxt
Copy link
Contributor

@jamilxt jamilxt commented Sep 30, 2024

The large FAB looks weird with the design. So I've refactored it to use Extended FAB and added animation onScroll like Gmail does.

New:

Old:

We can also consider showing/hiding the Search Bar & Bottom Navigation Bar on the scroll. I will try to do it next if this PR gets merged.
Thank you.

@jamilxt jamilxt requested a review from a team as a code owner September 30, 2024 10:17
Copy link
Member

@bentrengrove bentrengrove left a comment

Choose a reason for hiding this comment

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

Thanks for the submission! I am just checking with our designer whether this meets the Material spec that this sample is demonstrating

One minor comment as well, there is an easier way to determine if the fab should be expanded

)
}
contentColor = MaterialTheme.colorScheme.onTertiaryContainer,
expanded = emailLazyListState.isScrollingUp()
Copy link
Member

Choose a reason for hiding this comment

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

No need for an extension here, you can replace this with

Suggested change
expanded = emailLazyListState.isScrollingUp()
expanded = emailLazyListState.lastScrolledBackward ||
!emailLazyListState.canScrollBackward

Copy link
Contributor Author

@jamilxt jamilxt Oct 1, 2024

Choose a reason for hiding this comment

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

Thank you! I really appreciate it. It's been exciting to try Android development again after 4 years! I've updated as per suggestion.

@jamilxt jamilxt requested a review from bentrengrove October 1, 2024 14:19
Copy link
Member

@bentrengrove bentrengrove left a comment

Choose a reason for hiding this comment

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

LGTM!

@bentrengrove
Copy link
Member

Looks like it just needs formatting. You should be able to just run

./gradlew --init-script buildscripts/init.gradle.kts spotlessApply

@jamilxt
Copy link
Contributor Author

jamilxt commented Oct 3, 2024

Looks like it just needs formatting. You should be able to just run

./gradlew --init-script buildscripts/init.gradle.kts spotlessApply

I've applied spotless to format the code.
Thank you.

@bentrengrove bentrengrove merged commit d673e1b into android:main Oct 3, 2024
5 checks passed
@jamilxt jamilxt deleted the reply/refactor/update-floating-action-button branch October 4, 2024 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants