Repository navigation
Slider will call onChanged before onChangeStart when sliding. #136707
Copy link
Copy link
Closed
Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Description
Is there an existing issue for this?
- I have searched the existing issues
- I have read the guide to filing a bug
Steps to reproduce
- Create a slider bar
- print log when drag the slider (onChangeStart, onChanged, onChangeEnd)
- You will see also (onChanged print at first)
Expected results
Don't trigger the slider onChanged event before onChangeStart
Actual results
onChanged will called before onChangeStart every times.
Code sample
Code Sample
class SliderExample extends StatefulWidget {
@override
_SliderExampleState createState() => _SliderExampleState();
}
class _SliderExampleState extends State<SliderExample> {
double _sliderValue = 0.0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Flutter Slider Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('Slider Value: $_sliderValue'),
Slider(
value: _sliderValue,
onChangeStart: (newValue) {
print("onChangeStart ......");
},
onChanged: (newValue) {
print("onChanged ......");
},
onChangeEnd: (newValue) {
print("onChangeEnd ......");
},
min: 0,
max: 100,
divisions: 100,
label: '$_sliderValue',
),
],
),
),
);
}
}Flutter Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.13.3, on macOS 13.5 22G74 darwin-arm64 (Rosetta), locale zh-Hant-TW)
• Flutter version 3.13.3 on channel stable at /Users/chupa/fvm/versions/3.13.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 2524052335 (6 weeks ago), 2023-09-06 14:32:31 -0700
• Engine revision b8d35810e9
• Dart version 3.1.1
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/chupa/Library/Android/sdk
• Platform android-33, build-tools 32.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.82.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• SM T820 (mobile) • 804aec3701e8cf48 • android-arm64 • Android 9 (API 28)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.5 22G74 darwin-arm64 (Rosetta)
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.140
[✓] Network resources
• All expected network resources are available.
• No issues found!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
c: regressionIt was better in the past than it is nowIt was better in the past than it is nowfound in release: 3.13Found to occur in 3.13Found to occur in 3.13found in release: 3.16Found to occur in 3.16Found to occur in 3.16frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamOwned by Design Languages team
Type
Projects
- StatusShow more project fieldsDone (PR merged)
Activity
[-]SliderBar will call onChanged before onChangeStart when sliding.[/-][+]Slider will call onChanged before onChangeStart when sliding.[/+]dam-ease commentedon Oct 17, 2023
Hi @empirejames. Thanks for filing this. I'm able to reproduce this on the latest
masterandstablechannels following the reproduction steps provided above.Code Sample Used
stable, master flutter doctor -v
TahaTesser commentedon Oct 17, 2023
This regressed in #121483
TahaTesser commentedon Oct 17, 2023
Besides this,
allowedInteraction: SliderInteraction.slideOnlydoesn't callonChangedStartat any point.Fix `Slider` `onChanged` callback order & never calls `onChangeStart`…
github-actions commentedon Nov 2, 2023
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.