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

Add hero widget for profile picture animation #1131

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

fernandorego
Copy link

Closes #1120
Add hero widget for profile picture animation

Review checklist

  • Terms and conditions reflect the current change
  • Contains enough appropriate tests
  • If aimed at production, writes a new summary in whatsnew/whatsnew-pt-PT
  • Properly adds an entry in changelog.md with the change
  • If PR includes UI updates/additions, its description has screenshots
  • Behavior is as expected
  • Clean, well-structured code

@LuisDuarte1
Copy link
Member

Hi! Thanks for contributing, please fix the linting errors first 😅, thanks!

Copy link
Collaborator

@bdmendes bdmendes left a comment

Choose a reason for hiding this comment

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

Besides the linter annoyances, I left some comments below. Thank you for the contribution!

@override
Widget build(BuildContext context) {
if (onLoad == null) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It think it is cleaner to simply surround the callback with the condition, this is repeated below.

Copy link
Author

Choose a reason for hiding this comment

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

If the callback is surrounded by if (onLoad != null) {...} the variable _loading should be also set to false so the condition else { _loading = false; } is needed. Do you still prefer this approach over the implemented one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm, I meant surround the add callback statement, not the callback body

Copy link
Collaborator

Choose a reason for hiding this comment

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

But still, I get that, can we set loading and onLoad not null?

Copy link
Author

Choose a reason for hiding this comment

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

Yep, it is feasible, but I think that in this case, the return early pattern makes the code simpler and easier to read

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, seems like a tradeoff. In that case, I'll leave it to your preference.

),
if (decorationImage.hasData)
{
Navigator.push(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any way to keep the named route and pass a parameter, to keep consistency?

Copy link
Author

Choose a reason for hiding this comment

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

Maybe. I think pushNamed can receive arguments and then be used on RouteSettings.
I'll try 🚀

@@ -23,6 +23,14 @@ class CourseUnitDetailPageView extends StatefulWidget {

class CourseUnitDetailPageViewState
extends SecondaryPageViewState<CourseUnitDetailPageView> {
@override
void initState() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't you achieve this simply calling the construction? This field should be private, I think.

@thePeras
Copy link
Member

I love to see that in the app! What can we do to make it possible?

@fernandorego
Copy link
Author

I love to see that in the app! What can we do to make it possible?

From what I remember, the hero widget was working correctly. However, I suppose that the usage of this particular widget triggered some internal application behaviour which conflicts with the test...

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.

Use Hero widget to switch between Home and ProfilePage
4 participants