From 6dbf2269f013cefa304ca9e526f199dd3c1ca121 Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 19 Jul 2017 17:32:39 -0700 Subject: [PATCH] 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 --- packages/flutter/lib/src/widgets/overscroll_indicator.dart | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/flutter/lib/src/widgets/overscroll_indicator.dart b/packages/flutter/lib/src/widgets/overscroll_indicator.dart index 83fee2b526..266cf2123d 100644 --- a/packages/flutter/lib/src/widgets/overscroll_indicator.dart +++ b/packages/flutter/lib/src/widgets/overscroll_indicator.dart @@ -117,12 +117,14 @@ class GlowingOverscrollIndicator extends StatefulWidget { class _GlowingOverscrollIndicatorState extends State 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([_leadingController, _trailingController]); } @override @@ -210,6 +212,7 @@ class _GlowingOverscrollIndicatorState extends State 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([leadingController, trailingController]) + repaint: repaint, ); /// The controller for the overscroll glow on the side with negative scroll offsets.