Commit 6dbf2269 authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Create one listener that merges the leading and trailing glow controllers and...

Create one listener that merges the leading and trailing glow controllers and use it in each paint (#11311)

If a new listener is created for each paint, then the leading and trailing
controllers will accumulate and invoke a list of all those listeners
parent 741598d8
...@@ -117,12 +117,14 @@ class GlowingOverscrollIndicator extends StatefulWidget { ...@@ -117,12 +117,14 @@ class GlowingOverscrollIndicator extends StatefulWidget {
class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> with TickerProviderStateMixin { class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> with TickerProviderStateMixin {
_GlowController _leadingController; _GlowController _leadingController;
_GlowController _trailingController; _GlowController _trailingController;
Listenable _leadingAndTrailingListener;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_leadingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis); _leadingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis);
_trailingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis); _trailingController = new _GlowController(vsync: this, color: widget.color, axis: widget.axis);
_leadingAndTrailingListener = new Listenable.merge(<Listenable>[_leadingController, _trailingController]);
} }
@override @override
...@@ -210,6 +212,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> ...@@ -210,6 +212,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
leadingController: widget.showLeading ? _leadingController : null, leadingController: widget.showLeading ? _leadingController : null,
trailingController: widget.showTrailing ? _trailingController : null, trailingController: widget.showTrailing ? _trailingController : null,
axisDirection: widget.axisDirection, axisDirection: widget.axisDirection,
repaint: _leadingAndTrailingListener,
), ),
child: new RepaintBoundary( child: new RepaintBoundary(
child: widget.child, child: widget.child,
...@@ -444,8 +447,9 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter { ...@@ -444,8 +447,9 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter {
this.leadingController, this.leadingController,
this.trailingController, this.trailingController,
this.axisDirection, this.axisDirection,
Listenable repaint,
}) : super( }) : super(
repaint: new Listenable.merge(<Listenable>[leadingController, trailingController]) repaint: repaint,
); );
/// The controller for the overscroll glow on the side with negative scroll offsets. /// The controller for the overscroll glow on the side with negative scroll offsets.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment