Skip to content

Chips text scaling - #57745

Merged
fluttergithubbot merged 13 commits into
flutter:masterfrom
JoseAlba:chips_text_scaling
Jun 18, 2020
Merged

fluttergithubbot merged 13 commits into
flutter:masterfrom
JoseAlba:chips_text_scaling

Conversation

@JoseAlba

@JoseAlba JoseAlba commented May 21, 2020 •

Copy link
Copy Markdown
Contributor

Description

Improved text scaling for chips widget. Currently the chips component is being themed within the default theme data using the ChipThemeData.fromDefaults constructor. Removed the labelPadding from being defined in the ChipTheme and moved it to the raw chip. Similar to how the defaults are set in the newer widgets like the Slider.

Currently there is no text scaling with the Chips component. By default the chip component has label padding of 8px in the horizontal axis. Now the chip starts with 8px on each side and as text scaling gets closer to 2 the label padding is linearly interpolated from 8px to 4px. Once the widget has a text scaling of 2 or higher than the label padding remains 4px.

Tests

I added the following tests:

Updated test in chip_test.dart and chip_theme_test.dart

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • [ x I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.
    • I wrote a design doc: https://flutter.dev/go/template Replace this with a link to your design doc's short link
    • I got input from the developer relations team, specifically from: Hans
    • I wrote a migration guide: Replace with a link to your migration guide

@fluttergithubbot fluttergithubbot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels May 21, 2020
@fluttergithubbot

Copy link
Copy Markdown
Contributor

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@JoseAlba

Copy link
Copy Markdown
Contributor Author

chip_text_scaling

@JoseAlba JoseAlba changed the title [WIP] Chips text scaling Chips text scaling May 26, 2020
Comment thread packages/flutter/lib/src/material/chip.dart Outdated
Comment thread packages/flutter/test/material/chip_test.dart Outdated
Comment thread packages/flutter/test/material/chip_test.dart Outdated
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated

@rami-a rami-a 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.

LGTM

Comment thread packages/flutter/lib/src/material/chip.dart Outdated

@clocksmith clocksmith 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.

I think this is missing new tests to test different paddings for different text scale factors

@JoseAlba

Copy link
Copy Markdown
Contributor Author

I think this is missing new tests to test different paddings for different text scale factors

There is already a text that does this. It is in chip_test.dart and the name of the test is: Chip responds to textScaleFactor

@HansMuller HansMuller 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.

Please be careful.

Comment thread packages/flutter/lib/src/material/chip.dart
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated
Comment thread packages/flutter/test/material/chip_theme_test.dart Outdated
Comment thread packages/flutter/test/material/chip_test.dart Outdated

@HansMuller HansMuller 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.

LGTM

Comment thread packages/flutter/lib/src/material/chip.dart Outdated
Comment thread packages/flutter/lib/src/material/chip.dart
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants