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 {
class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator> with TickerProviderStateMixin {
_GlowController _leadingController;
_GlowController _trailingController;
Listenable _leadingAndTrailingListener;
@override
void initState() {
super.initState();
_leadingController = 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
......@@ -210,6 +212,7 @@ class _GlowingOverscrollIndicatorState extends State<GlowingOverscrollIndicator>
leadingController: widget.showLeading ? _leadingController : null,
trailingController: widget.showTrailing ? _trailingController : null,
axisDirection: widget.axisDirection,
repaint: _leadingAndTrailingListener,
),
child: new RepaintBoundary(
child: widget.child,
......@@ -444,8 +447,9 @@ class _GlowingOverscrollIndicatorPainter extends CustomPainter {
this.leadingController,
this.trailingController,
this.axisDirection,
Listenable repaint,
}) : super(
repaint: new Listenable.merge(<Listenable>[leadingController, trailingController])
repaint: repaint,
);
/// 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