akshathjain / sliding_up_panel

A draggable Flutter widget that makes implementing a SlidingUpPanel much easier!
https://pub.dartlang.org/packages/sliding_up_panel
Other
1.37k stars 378 forks source link

Add addListener on controller (like ScrollController) #177

Open GioPan04 opened 4 years ago

GioPan04 commented 4 years ago

Describe the bug There is no addListener method on controller, so is pratically impossible to get a corrected updated value of panelPosition.

Expected behavior A method called every time the SlidingUpPanel changes his position. The code maybe can be like be this:

final PanelController _panelController = PanelController();

@override
void initState() { 
  super.initState();
  _panelController.addListener(() {
    print(_panelController.panelPosition);
  });
}

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: SlidingUpPanel(
      controller: _panelController,
      panelBuilder: (controller) => ListView(
        controller: controller,
        children: List.generate(100, (index) => FlutterLogo()),
      ),
      body: ListView(
        children: [
          Text("Good evening"),
        ],
      ),
    ),
  );
}

Smartphone

ervindobri commented 3 years ago

I second this. Is there a workaround to get the panel position somehow?

manafire commented 3 years ago

onPanelSlide?

ervindobri commented 3 years ago

onPanelSlide?

When I add onPanelSlide it rarely gets any touch input / I can't slide it down or up so responsively.