Skip to content

[cupertino_ui] Add SemanticsRole.slider to CupertinoSlider - #12710

Draft
hannah-hyj wants to merge 1 commit into
flutter:mainfrom
hannah-hyj:cupertino-slider-semantics-role
Draft

[cupertino_ui] Add SemanticsRole.slider to CupertinoSlider#12710
hannah-hyj wants to merge 1 commit into
flutter:mainfrom
hannah-hyj:cupertino-slider-semantics-role

Conversation

@hannah-hyj

Copy link
Copy Markdown
Member

Adds SemanticsRole.slider, minValue, and maxValue to Slider semantics.

issue: flutter/flutter#184030

blocked by flutter/flutter#184029

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2

Adds SemanticsRole.slider, minValue, and maxValue to CupertinoSlider semantics.

Fixes flutter/flutter#184030
Related to flutter/flutter#184029
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 1, 2026
@github-actions github-actions Bot added p: cupertino_ui triage-design Should be looked at in design triage labels Sep 1, 2026
@hannah-hyj
hannah-hyj marked this pull request as draft September 1, 2026 01:51

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates CupertinoSlider to include SemanticsRole.slider and the min and max bounds in its semantics configuration, passing these properties down to the underlying render object and updating the associated tests. The review feedback identifies a type mismatch where minValue and maxValue are incorrectly assigned and tested as String values instead of double values.

Comment on lines +669 to +670
config.minValue = min.toString();
config.maxValue = max.toString();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

In Flutter's SemanticsConfiguration, minValue and maxValue are of type double?, not String?. Assigning a String (via toString()) will cause a compile-time type mismatch error. They should be assigned directly as double values.

Suggested change
config.minValue = min.toString();
config.maxValue = max.toString();
config.minValue = min;
config.maxValue = max;

Comment on lines +446 to +447
minValue: '0.0',
maxValue: '1.0',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since minValue and maxValue are double values, they should be matched as double literals rather than strings in matchesSemantics.

Suggested change
minValue: '0.0',
maxValue: '1.0',
minValue: 0.0,
maxValue: 1.0,

Comment on lines +473 to +474
minValue: '0.0',
maxValue: '1.0',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since minValue and maxValue are double values, they should be matched as double literals rather than strings in matchesSemantics.

Suggested change
minValue: '0.0',
maxValue: '1.0',
minValue: 0.0,
maxValue: 1.0,

Comment on lines +499 to +500
minValue: '0.0',
maxValue: '1.0',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since minValue and maxValue are double values, they should be matched as double literals rather than strings in matchesSemantics.

Suggested change
minValue: '0.0',
maxValue: '1.0',
minValue: 0.0,
maxValue: 1.0,

Comment on lines +525 to +526
minValue: '0.0',
maxValue: '1.0',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since minValue and maxValue are double values, they should be matched as double literals rather than strings in matchesSemantics.

Suggested change
minValue: '0.0',
maxValue: '1.0',
minValue: 0.0,
maxValue: 1.0,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD p: cupertino_ui triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant