Open
Description
Problem:
Wrong values are notified when following below steps.
- Change values property while page transition.
- Drag outside of thumb
- Wrong values are notified from slider and wrong handler position is displayed.
- Handler will jump to left end. (expected behavior is following pointer.)
Simulator.Screen.Recording.-.iPhone.12.Pro.Max.-.2021-07-19.at.20.51.14.mp4
Dart snippet to reproduce the bug:
import 'package:another_xlider/another_xlider.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Sample'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Builder(builder: (context) {
return TextButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => SliderView(),
),
);
},
child:
Text('Show Slider View', style: TextStyle(fontSize: 30)),
);
}),
],
),
),
),
);
}
}
class SliderView extends StatefulWidget {
@override
_SliderViewState createState() => _SliderViewState();
}
class _SliderViewState extends State<SliderView> {
double _sliderValue = 0.0;
@override
void initState() {
super.initState();
// To reproduce the bug,
// the duration of `delayed` should be less than transition animation's duration (maybe 300ms).
// For example, this demo uses 1ms.
Future.delayed(Duration(milliseconds: 1)).then((_) {
setState(() {
_sliderValue = 50;
});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: SafeArea(
child: Center(
child: FlutterSlider(
values: [_sliderValue],
min: 0,
max: 100,
),
),
),
);
}
}
Metadata
Metadata
Assignees
Labels
No labels