Fix SegmentedButton default size and default tappable size#142243
Merged
auto-submit[bot] merged 10 commits intoflutter:masterfrom Jan 26, 2024
Merged
Fix SegmentedButton default size and default tappable size#142243auto-submit[bot] merged 10 commits intoflutter:masterfrom
SegmentedButton default size and default tappable size#142243auto-submit[bot] merged 10 commits intoflutter:masterfrom
Conversation
SegmentedButton default size and default tapTargetSizeSegmentedButton default size and default tappable size
HansMuller
approved these changes
Jan 25, 2024
| final double adjustButtonMinHeight = textButtonMinHeight + densityAdjustment.dy; | ||
| final double effectiveVerticalPadding = resolvedPadding.vertical + densityAdjustment.dy * 2; | ||
| final double effectedButtonHeight = max(fontSize + effectiveVerticalPadding, adjustButtonMinHeight); | ||
| final double tapTargetVerticalPadding; |
Contributor
There was a problem hiding this comment.
Could be initialized using the new switch expression:
final double tapTargetVerticalPadding = switch (resolvedTargetSize) {
MaterialTapTargetSize.shrinkWrap => 0,
MaterialTapTargetSize.padded => max(0, kMinInteractiveDimension + densityAdjustment.dy - effectedButtonHeight);
};| expect(state.statesControllers.values.first.value, states); | ||
| }); | ||
|
|
||
| testWidgets('Min button height is 48.0 with standard density and MaterialTapTargetSize.padded', (WidgetTester tester) async { |
Contributor
There was a problem hiding this comment.
Might be better to not that the button's height is 40 but its tap target's height is 48. Like:
'Min button hit target height is 48 and min (painted) button height is 40'
| paints..rrect( | ||
| style: PaintingStyle.stroke, | ||
| strokeWidth: 1.0, | ||
| // Button border height is 43.5 - 4.5 + stoke width(1) = 40. |
Contributor
There was a problem hiding this comment.
If 43.5 and 4.5 correspond to something can identify here, then best to include that info in the comment.
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 26, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 27, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 27, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 28, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 28, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/packages
that referenced
this pull request
Jan 29, 2024
auto-submit bot
pushed a commit
to flutter/packages
that referenced
this pull request
Jan 29, 2024
Manual roll requested by [email protected] flutter/flutter@a8efa77...2f6fdf2 2024-01-26 [email protected] Start renaming by adding a new `bringup: true` as an Android emulator. (flutter/flutter#142257) 2024-01-26 [email protected] Instrument ImageInfo. (flutter/flutter#141411) 2024-01-26 [email protected] Fix `SegmentedButton` default size and default tappable size (flutter/flutter#142243) 2024-01-26 [email protected] Update name for android_defines_test. (flutter/flutter#142273) 2024-01-26 [email protected] Enable native compilation for windows-arm64 (flutter/flutter#141930) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions)" (flutter/flutter#142274) 2024-01-25 [email protected] Run a few mac tests only on arm. (flutter/flutter#142188) 2024-01-25 [email protected] fix Ink not updating on TextField newline (flutter/flutter#140700) 2024-01-25 49699333+dependabot[bot]@users.noreply.github.com Bump codecov/codecov-action from 3.1.4 to 3.1.5 (flutter/flutter#142259) 2024-01-25 [email protected] Roll Flutter Engine from 4b145d041560 to 44f26274bfbe (6 revisions) (flutter/flutter#142264) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Reverts "Rename `integration_tests/external_ui` but do not touch anything else..."" (flutter/flutter#142268) 2024-01-25 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Rename `integration_tests/external_ui` but do not touch anything else..." (flutter/flutter#142265) 2024-01-25 [email protected] Roll Flutter Engine from b2167a93c1a0 to 4b145d041560 (3 revisions) (flutter/flutter#142256) 2024-01-25 [email protected] Implementing `switch` expressions in the `cupertino/` directory (flutter/flutter#141591) 2024-01-25 [email protected] Rename `integration_tests/external_ui` but do not touch anything else... (flutter/flutter#142238) 2024-01-25 [email protected] Roll Flutter Engine from 55eefd5bd255 to b2167a93c1a0 (2 revisions) (flutter/flutter#142252) 2024-01-25 [email protected] Roll Flutter Engine from 3b4779324b44 to 55eefd5bd255 (6 revisions) (flutter/flutter#142245) 2024-01-25 [email protected] Fix incorrect zh-cn translation for Look Up Label in selection controls (flutter/flutter#142158) 2024-01-25 [email protected] PopScope example improvements (flutter/flutter#142163) 2024-01-25 [email protected] Roll Flutter Engine from 1d3f16b0d62e to 3b4779324b44 (1 revision) (flutter/flutter#142225) 2024-01-25 [email protected] Roll Packages from 8fbdf65 to 21b5abb (6 revisions) (flutter/flutter#142224) 2024-01-25 [email protected] Don't show legacy welcome message when analytics are disabled (flutter/flutter#140956) 2024-01-25 [email protected] Roll Flutter Engine from 7c4ed15cb271 to 1d3f16b0d62e (1 revision) (flutter/flutter#142223) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
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.
fix #121493
SegmentedButtonusesTextButtonfor each segments. When we haveMaterialTapTargetSize.paddedforTextButton, we make sure the minimum tap target size is 48.0( this value can be adjusted by visual density), even tough the actual button size is smaller. WhenSegmentedButtonpaints segments by usingMultiChildRenderObjectWidget, it also includes the tap target size so the button that it actually draws always has the same height as the height of the tap target size.To fix it, this PR firstly calculate the actual height of a text button in
SegmentedButtonclass, then we can get the height delta if there is. Then the the value of (Segmented button render box height - the delta) would be the actual button size that we should see.For now, we are not able to customize the min, max, fixed size in
SegmentedButtonstyle. So the standard button height is always 40 and can only be customized bystyle.visualDensityandstyle.tapTargetSize;SegmentedButtononly simulates theTextButtonbehavior whenTextButton's height is its default value.SegmentedButtonDemo.mov
Pre-launch Checklist
///).