Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PanelController can now addListeners so user can listen for updates #194

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions lib/src/panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,17 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid

ScrollController _sc;
bool _scrollingEnabled = false;
VelocityTracker _vt = new VelocityTracker();
PointerDeviceKind _pointerDeviceKind = PointerDeviceKind.unknown;
VelocityTracker _vt;

bool _isPanelVisible = true;

@override
void initState(){
super.initState();

_vt = new VelocityTracker(_pointerDeviceKind);

_ac = new AnimationController(
vsync: this,
duration: const Duration(milliseconds: 300),
Expand All @@ -233,6 +236,9 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> 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
Expand Down Expand Up @@ -605,7 +611,7 @@ class _SlidingUpPanelState extends State<SlidingUpPanel> with SingleTickerProvid



class PanelController{
class PanelController extends ChangeNotifier {
_SlidingUpPanelState _panelState;

void _addState(_SlidingUpPanelState panelState){
Expand Down Expand Up @@ -712,4 +718,4 @@ class PanelController{
return _panelState._isPanelShown;
}

}
}