Skip to content

Improvements to SearchDelegate - #91982

Merged
fluttergithubbot merged 2 commits into
flutter:masterfrom
prateekmedia:patch-2
Apr 29, 2022
Merged

fluttergithubbot merged 2 commits into
flutter:masterfrom
prateekmedia:patch-2

Conversation

@prateekmedia

@prateekmedia prateekmedia commented Oct 18, 2021 •

Copy link
Copy Markdown
Contributor

Use searchFieldStyle for SearchDelegate's TextStyle as an alternative to regular headline6, so that someone can easily change the text style without messing with the app's theme.

List which issues are fixed by this PR. You must list at least one issue.
#93861

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@flutter-dashboard flutter-dashboard Bot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Oct 18, 2021
@google-cla google-cla Bot added the cla: yes label Oct 18, 2021
@prateekmedia
prateekmedia marked this pull request as ready for review October 18, 2021 08:10
@flutter-dashboard

Copy link
Copy Markdown

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.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

@prateekmedia

prateekmedia commented Nov 7, 2021 •

Copy link
Copy Markdown
Contributor Author

@darrenaustin Can you please review this PR.

Use Case:

  • When your TextTheme's headline6 is set to custom font size which is either too high or too low to be used as a font size of a search field.

Why:
I can't find any other way to change the font size of that field, also note that you can't wrap search delegate with Theme class. If that was the case then I would simply just wrap it with Theme and change the font size of headline6 from their.

How I solved it:
So the only possible way to change search field text style was to make the field use searchFieldStyle(if provided), else to use the default headline6.

@flutter-dashboard

Copy link
Copy Markdown

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.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

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

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

Thanks for the contribution. Sorry it has taken me so long to look at it.

This looks like a reasonable change. We need to have a test for this to verify that searchFieldStyle is being used here. You can add a new test or perhaps add an expect cause to the existing 'Custom searchFieldStyle value' test in packages/flutter/test/material/search_test.dart.

@prateekmedia

Copy link
Copy Markdown
Contributor Author

@darrenaustin I have added some test and also rebased the PR.

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

flutter-lgtm

Thx!

@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. This is effectively an incompatible change; hopefully it will not inadvertently break anything.

@prateekmedia

Copy link
Copy Markdown
Contributor Author

OK so two LGTM from official contributors, Is there anything which is stopping this PR?

@CaseyHillers

Copy link
Copy Markdown
Contributor

re Google testing being stuck, can you try rebasing your PR with the latest from upstream?

The PR is 1000 commits behind master, so it's unable to be tested

@prateekmedia

Copy link
Copy Markdown
Contributor Author

re Google testing being stuck, can you try rebasing your PR with the latest from upstream?

The PR is 1000 commits behind master, so it's unable to be tested

done

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 29, 2022
@prateekmedia
prateekmedia deleted the patch-2 branch April 30, 2022 02:02
egramond pushed a commit to egramond/flutter that referenced this pull request May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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.

5 participants