-
Notifications
You must be signed in to change notification settings - Fork 86
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
feat: add optional useRepaintBoundary
to Animate
#47
base: main
Are you sure you want to change the base?
Conversation
lib/src/animate.dart
Outdated
@@ -176,6 +177,9 @@ class Animate extends StatefulWidget with AnimateManager<Animate> { | |||
/// ``` | |||
final double? target; | |||
|
|||
// TODO: add documentation |
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.
Appreciate if you take a first stab at this.
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.
Will gladly do this tomorrow :)
lib/src/animate.dart
Outdated
@@ -320,7 +324,9 @@ class _AnimateState extends State<Animate> with SingleTickerProviderStateMixin { | |||
for (EffectEntry entry in widget._entries) { | |||
child = entry.effect.build(context, child, _controller, entry); | |||
} | |||
return reparent?.call(parent, child) ?? child; | |||
Widget returnWidget = reparent?.call(parent, child) ?? child; | |||
if (widget.useRepaintBoundary) return RepaintBoundary(child: returnWidget); |
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.
instead of an additional return, I'd just add to returnWidget. I wonder if there's a better name than returnWidget also.
lib/src/animate.dart
Outdated
@@ -346,6 +353,7 @@ extension AnimateWidgetExtensions on Widget { | |||
controller: controller, | |||
adapter: adapter, | |||
target: target, | |||
useRepaintBoundary: useRepaintBoundary ?? false, |
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 try really hard to not duplicate defaults in extension methods, since it creates fragility when changing them (easy to forget to update in all locations). Take a look at any of the extension methods on various effects for examples.
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.
Really good point, pulled it out of the constructors!
@gskinner I added a first draft of the docs, let me know what you think! And feel free to change anyting obviously. As a side note: The dart docs for parameters are only available with the "standalone" widgets, not with the extension methods. I can totally see not wanting to copy/paste the docs due to various reasons. What do you think about that? |
This is a draft PR
Documentation is still open, I will add it next week when I have more time.
closes #46