mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
fixes [[Slider] Thumb's center doesn't align with division's center](https://github.com/flutter/flutter/issues/62567) fixes [Slider thumb doesn't respect round slider track shape](https://github.com/flutter/flutter/issues/149591) fixes [`RoundedRectSliderTrackShape` corners are not rendered correctly](https://github.com/flutter/flutter/issues/149589) (Verified these behaviors with Android components implementation) ### 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 StatefulWidget { const MyApp({super.key}); @override State<MyApp> createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { double _value = 5.0; @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( sliderTheme: const SliderThemeData( trackHeight: 32, thumbColor: Colors.green, activeTrackColor: Colors.deepPurple, inactiveTrackColor: Colors.amber, ), ), home: Scaffold( body: Slider( value: _value, // divisions: 10, // ignore: avoid_redundant_argument_values min: 0, max: 10, onChanged: (double value) { setState(() { _value = value; }); }, ), ), ); } } ``` </details> ### Description This PR fixes several core `Sliders` issues which are apparent in https://github.com/flutter/flutter/pull/147783. As a result, fixing the these bugs will unblock it. ### 1. Fixes the thumb doesn't align with `Slider` divisions.   ### 2. Fixes `RoundedRectSliderTrackShape` corners are not rendered correctly.  ### 3. Fixes round track shape corners when the thumb is at the start or end of the round track shape.   