Skip to content

Conversation

@DaveShuckerow
Copy link
Contributor

@DaveShuckerow DaveShuckerow force-pushed the layout-entrance-animation branch from a21b3a1 to 71f4e68 Compare November 22, 2019 22:36
@DaveShuckerow DaveShuckerow marked this pull request as ready for review November 25, 2019 17:24
child: AnimatedBuilder(
animation: entranceController,
builder: buildEntranceAnimation,
child: WidgetVisualizer(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This widget tree is too deeply nested to be easily understood. Since changing any part of it also changes the indentation of the entire tree, we'll get more merge conflicts working on it together.

A helpful way to manage this is to break the method up into helper methods or to create new helper widget classes.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree Dave, initially I was going to make a helper widget class for the child but decided not to do that because I was still changing it a lot and I want to avoid 'prop drilling' into the class and just make use of the scope.

But since the implementation has become more complex, I agree splitting it is helpful.

Should I take this one then? @DaveShuckerow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need now, just pointing it out for future improvements. I want you focused on making this work off of Flutter master.

It's perfectly OK to write simple code then realize you need to refactor code later on.

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, will do then, thanks Dave 👍

Copy link
Contributor

@albertusdev albertusdev left a comment

Choose a reason for hiding this comment

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

Thanks Dave for all the help.

image

.map((renderSize) => renderSize.height))
: maxHeight,
),
).normalize(),
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was running into an issue where resizing the screen would sometimes break the box constraints here. I suspect it was a precision glitch in the constraint calculations, and normalizing has fixed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes the cross axis empty space calculation is still buggy now, I'll fix that soon, thanks Dave :-)

Comment on lines +286 to +287
horizontal: (renderSize.width - size.width) / 2,
vertical: (renderSize.height - size.height) / 2,
Copy link
Contributor

Choose a reason for hiding this comment

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

very nit: * 0.5 instead of / 2 for consistency ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's nothing wrong with using division to express division.

I'm also not sure where else there's a *0.5 in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

it's in inspector_data_models.dart where I do the computation for the empty space. But yes it's fine

super.initState();
entranceController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 500),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: make the duration into const maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is const.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, I mean, extract it into top level const?

const defaultMaxRenderHeight = 300.0;

/// The size to shrink a widget by when animating it in.
const entranceMargin = 60;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: 60.0 to avoid casting into double since margin is double?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea.

@DaveShuckerow DaveShuckerow changed the title This is how to add animated opacity to the flex layout children. Add animated opacity to the flex layout children. Nov 25, 2019
@DaveShuckerow DaveShuckerow added the hummingbird Hummingbird implementation-related label Nov 25, 2019
@DaveShuckerow DaveShuckerow merged commit bf7d558 into flutter:master Nov 25, 2019
@DaveShuckerow DaveShuckerow deleted the layout-entrance-animation branch November 25, 2019 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hummingbird Hummingbird implementation-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants