Add ability to customize the default RangeSlider padding#165317
Merged
auto-submit[bot] merged 2 commits intoflutter:masterfrom Apr 10, 2025
TahaTesser:range_slider_padding
Merged
Add ability to customize the default RangeSlider padding#165317auto-submit[bot] merged 2 commits intoflutter:masterfrom TahaTesser:range_slider_padding
RangeSlider padding#165317auto-submit[bot] merged 2 commits intoflutter:masterfrom
TahaTesser:range_slider_padding
Conversation
dkwingsmt
approved these changes
Apr 7, 2025
Comment on lines
+395
to
+398
| /// If specified, this padding overrides the default vertical padding of | ||
| /// the [RangeSlider], defaults to the height of the overlay shape, and the | ||
| /// horizontal padding, defaults to the width of the thumb shape or | ||
| /// overlay shape, whichever is larger. |
Contributor
There was a problem hiding this comment.
Suggested change
| /// If specified, this padding overrides the default vertical padding of | |
| /// the [RangeSlider], defaults to the height of the overlay shape, and the | |
| /// horizontal padding, defaults to the width of the thumb shape or | |
| /// overlay shape, whichever is larger. | |
| /// If specified, this padding overrides the vertical padding and the | |
| /// horizontal padding of the [RangeSlider]. By default, the vertical padding | |
| /// is the height of the overlay shape, and the horizontal padding is the | |
| /// larger size between the width of the thumb shape and overlay shape. |
Contributor
Author
There was a problem hiding this comment.
Thanks for the suggestion!
Contributor
|
autosubmit label was removed for flutter/flutter/165317, because - The status or check suite Linux customer_testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 11, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Apr 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 14, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 14, 2025
romanejaquez
pushed a commit
to romanejaquez/flutter
that referenced
this pull request
Aug 14, 2025
…65317) Fixes [Ability to change RangeSlider padding](flutter#165046) Add ability to override default padding so the `RangeSlider` can fit better in a layout. ### 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> { RangeValues _sliderValues = const RangeValues(0.0, 1.0); @OverRide Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, theme: ThemeData( sliderTheme: const SliderThemeData( // padding: EdgeInsets.symmetric(vertical: 4), thumbColor: Colors.red, inactiveTrackColor: Colors.amber, ), ), home: Scaffold( body: Directionality( textDirection: TextDirection.ltr, child: Center( child: Card( shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(4.0)), ), color: Theme.of(context).colorScheme.surfaceContainerHighest, margin: const EdgeInsets.symmetric(horizontal: 16.0), child: Padding( padding: const EdgeInsetsDirectional.all(16), child: Column( mainAxisSize: MainAxisSize.min, children: [ const Placeholder(fallbackHeight: 100.0), RangeSlider( values: _sliderValues, onChanged: (RangeValues values) { setState(() { _sliderValues = values; }); }, ), const Placeholder(fallbackHeight: 100.0), ], ), ), ), ), ), ), ); } } ``` </details> ### Before (Cannot adjust default `RangeSlider` padding to fill the horizontal space in a `Column` and reduce the padded height) <img width="862" alt="Screenshot 2025-03-17 at 17 08 35" src="proxy.php?url=https://github.com/user-attachments/assets/8786f2a5-5383-4611-b025-2151bc0f9fa7" /> ### After Can adjust default `RangeSlider` padding via `SliderThemeData,padding` or `RangeSlider.padding`) <img width="862" alt="Screenshot 2025-03-17 at 17 08 26" src="proxy.php?url=https://github.com/user-attachments/assets/38a34cf1-a372-4160-9189-aa4133582b0a" /> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 15, 2025
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Aug 16, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes Ability to change RangeSlider padding
Add ability to override default padding so the
RangeSlidercan fit better in a layout.Code sample
expand to view the code sample
Before
(Cannot adjust default
RangeSliderpadding to fill the horizontal space in aColumnand reduce the padded height)After
Can adjust default
RangeSliderpadding viaSliderThemeData,paddingorRangeSlider.padding)Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.