diff --git a/lib/src/panel.dart b/lib/src/panel.dart index ca397cf..8f3db91 100644 --- a/lib/src/panel.dart +++ b/lib/src/panel.dart @@ -215,7 +215,8 @@ class _SlidingUpPanelState extends State with SingleTickerProvid ScrollController _sc; bool _scrollingEnabled = false; - VelocityTracker _vt = new VelocityTracker(); + PointerDeviceKind _pointerDeviceKind = PointerDeviceKind.unknown; + VelocityTracker _vt; bool _isPanelVisible = true; @@ -223,6 +224,8 @@ class _SlidingUpPanelState extends State with SingleTickerProvid void initState(){ super.initState(); + _vt = new VelocityTracker(_pointerDeviceKind); + _ac = new AnimationController( vsync: this, duration: const Duration(milliseconds: 300), @@ -233,6 +236,9 @@ class _SlidingUpPanelState extends State with SingleTickerProvid if(widget.onPanelOpened != null && _ac.value == 1.0) widget.onPanelOpened(); if(widget.onPanelClosed != null && _ac.value == 0.0) widget.onPanelClosed(); + + //Notify listeners when the panel is sliding + widget.controller.notifyListeners(); }); // prevent the panel content from being scrolled only if the widget is @@ -605,7 +611,7 @@ class _SlidingUpPanelState extends State with SingleTickerProvid -class PanelController{ +class PanelController extends ChangeNotifier { _SlidingUpPanelState _panelState; void _addState(_SlidingUpPanelState panelState){ @@ -712,4 +718,4 @@ class PanelController{ return _panelState._isPanelShown; } -} \ No newline at end of file +}