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
This commit is contained in:
parent
741598d848
commit
6dbf2269f0
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user