mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
fixes [Slider will call onChanged before onChangeStart when sliding.](https://github.com/flutter/flutter/issues/136707) This fixes a regression from https://github.com/flutter/flutter/pull/121483 ### Code sample <details> <summary>expand to view the code sample</summary> ```dart import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return const MaterialApp( debugShowCheckedModeBanner: false, home: Example(), ); } } class Example extends StatefulWidget { const Example({super.key}); @override State<Example> createState() => _ExampleState(); } class _ExampleState extends State<Example> { double _sliderValue = 0.5; @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Slider( // allowedInteraction: SliderInteraction.tapAndSlide, // allowedInteraction: SliderInteraction.tapOnly, // allowedInteraction: SliderInteraction.slideOnly // allowedInteraction: SliderInteraction.slideThumb, value: _sliderValue, onChangeStart: (newValue) { print("onChangeStart ......"); }, onChanged: (newValue) { print("onChanged ......"); setState(() { _sliderValue = newValue; }); }, onChangeEnd: (newValue) { print("onChangeEnd ......"); }, ), ), ); } } ``` </details>
Flutter
Flutter is a new way to build high-performance, cross-platform mobile, web, and desktop apps. Flutter is optimized for today's — and tomorrow's — mobile and desktop devices. We are focused on low-latency input and high frame rates on all platforms.
See the getting started guide for information about using Flutter.