-
Notifications
You must be signed in to change notification settings - Fork 28.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Slider] Thumb's center doesn't align with division's center #62567
Comments
This is reproducible in a new duplicate #108007 Results provided by @danagbemava-nc
|
This is blocking #147783 I'm fixing this bug to unblock the PR. BeforeAfter |
…ounded corners (#149594) fixes [[Slider] Thumb's center doesn't align with division's center](#62567) fixes [Slider thumb doesn't respect round slider track shape](#149591) fixes [`RoundedRectSliderTrackShape` corners are not rendered correctly](#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 #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.   
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 |
I'm trying to create a custom slider like the one below :
For that, I created 2 custom classes from SliderComponentShape and SliderTickMarkShape for the Slider's Thumb and the Slider divisions. In both the class, I was just fiddling around the paint object and radius to create the custom shape for my division and my thumb, and there is nothing fancy.
But the problem is, except the center position in the slider, the thumb doesn't get aligned to any other division's center.
I've posted this problem in the StackOverflow here and explained this very clearly with all the needed codes.
The question is: Shouldn't the thumb's center get naturally aligned to the division's center in all its positions? Or am I missing something?
The text was updated successfully, but these errors were encountered: