-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 1.22Found to occur in 1.22Found to occur in 1.22found in release: 1.26Found to occur in 1.26Found to occur in 1.26frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
When embedding a Slider inside a InkWell, the Slider fires twice "onChangeEnd" if you start dragging it.
Check this snippet:
void main() => runApp(MyAppTeste());
class MyAppTeste extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Tests Flutter',
home: Page(),
);
}
}
class Page extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
InkWell(
onTap: () {
print("Tapped Inkwell!");
},
child: SliderTest(),
),
// SliderTest()
],
),
);
}
}
class SliderTest extends StatefulWidget {
@override
_SliderTestState createState() => _SliderTestState();
}
class _SliderTestState extends State<SliderTest> {
double value = 0;
@override
Widget build(BuildContext context) {
return Slider(
value: value,
min: 0,
max: 100,
onChanged: (value) {
setState(() {
this.value = value;
});
},
onChangeEnd: (value) {
print("Value selected $value");
},
);
}
}
If you just tap somewhere in the slider's "line" verything works fine. But if you drag it, it will fire twict the "onChanceEnd" method.
I also realized the if you drag too fast, it will fires only once. But users don't use the sliders like that. I believe this has something related to the InkWell/GestureDetector that is behind it....
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.0.0, on Microsoft Windows [versão 10.0.17763.316], locale pt-BR)
[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
[√] Android Studio (version 3.3)
[√] IntelliJ IDEA Community Edition (version 2018.3)
[√] VS Code (version 1.30.1)
[√] Connected device (1 available)
• No issues found!
esfomeado, tzvc, shinayser, salvatore373, jonjon1123 and 50 moretzvc, snaeji, alexeyselina, liugangnhm, nt4f04uNd and 9 more
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.Affects or could affect many people, though not necessarily a specific customer.f: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.found in release: 1.22Found to occur in 1.22Found to occur in 1.22found in release: 1.26Found to occur in 1.26Found to occur in 1.26frameworkflutter/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 onr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version