gskinner / gskinner/flutter_animate

Optionally wrap `Animate` with `RepaintBoundary`

Open
#46 7 comments 3 reactions 0 assignees View on GitHub
enhancement good first issue
Dominant language
Dart
Stars
1.1k
Forks
103
PR merge metrics
No merged PRs in 30d

Description

### Reasoning
As discussed in [this](https://youtu.be/lxkFL9disq0?t=850) talk about `flutter_animate`, the performance of animations **might** get significantly improved by wrapping them in a [RepaintBoundary](https://api.flutter.dev/flutter/widgets/RepaintBoundary-class.html).
I argue that this is not apparent to everyone. Especially newer Flutter developers might not be aware of this performance improvement opportunity.

### Proposal
Add an optional `bool? useRepaintBoundary` to the `Animate()` widget. If set true, the animation should be automatically wrapped with a `RepaintBoundary`. The parameter should be false by default, as RepaintBoundaries also come with a cost and the usage should be transparent.

It would be vital to also add extensive explanation in the documentation of the parameter about when to use `RepaintBoundary` and when not to, optimally with examples. This way, people not knowing about the widget would get educated and situations where `RepaintBoundary` is applied suboptimally get minimized (although not eliminated!).

If the addition of such a parameter comes with too high of a risk of missusage, I propose to at least add a section to the ReadMe/Docs of this package explaining the potential benefits and drawbacks of using a `RepaintBoundary` in combination with animations.

### Additional Context
This matter was discussed briefly in this [tweet](https://twitter.com/sssecki/status/1618979698297688071) with the author of the package.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.