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.38k stars 381 forks source link

Slider notifies "onChangeEnd" twice in panel #128

Open mpcreza opened 4 years ago

mpcreza commented 4 years ago

hi When embedding a Slider inside panel, the Slider fires twice "onChangeEnd" if you start dragging it.

sample:

import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  double sliderVal = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SlidingUpPanel(
        backdropEnabled: true,
        maxHeight: MediaQuery.of(context).size.height,
        minHeight: 100.0,
        panel: Center(
          child: Slider(
            value: sliderVal,
            onChanged: (val) {
              setState(() {
                sliderVal = val;
              });
            },
            onChangeEnd: (val) {
              print('onChangeEnd $val');
            },
          ),
        ),
        collapsed: Container(
          color: Colors.grey,
          child: Center(child: Text('Collapsed'),),
        ),
        body: Center(child: Text('Main page'),),
      ),
    );
  }
}
rohansohonee commented 4 years ago

Correct I am also facing the same issue. Also in PanelBuilder [BETA], the slider does not slide properly at all. The dragging does not work correctly. @akshathjain Please do look at this issue.

nt4f04uNd commented 3 years ago

Looks like a tracked flutter issue https://github.com/flutter/flutter/issues/28115 They are just similar