Skip to content

Expose 'enable' property to allow the user to disable the SearchBar - #137388

Merged
auto-submit[bot] merged 22 commits into
flutter:masterfrom
Macacoazul01:search-anchor
Jan 11, 2024
Merged

auto-submit[bot] merged 22 commits into
flutter:masterfrom
Macacoazul01:search-anchor

Conversation

@Macacoazul01

@Macacoazul01 Macacoazul01 commented Oct 27, 2023 •

Copy link
Copy Markdown
Contributor

This exposes the enabled property of the TextField widget to the Searchbar widget.

Related Issues

#136943

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.

Still missing tests

@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 or stuartmorgan on the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

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.

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels Oct 27, 2023
@HansMuller
HansMuller requested a review from QuncCccccc November 1, 2023 18:25

@QuncCccccc QuncCccccc 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 a lot for the contribution!

The SearchBar also has a InkWell to show different effects when hover, focused, pressed etc. So if we only disable the text field, we still can see the effects in these states as if the search bar is still enabled. This behavior might look a little strange.

To show a disabled effect for InkWell, we might also need to handle MaterialStates when the search bar is disabled:)

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

saw this behavior when testing the PR and it was strange. Thanks for pointing where i should look for

@flutter-dashboard

Copy link
Copy Markdown

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.

For more guidance, visit Writing a golden file test for package:flutter.

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

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

@QuncCccccc Ready for the review.

@QuncCccccc QuncCccccc 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 fix! As the issue #136943 mentioned, search bar should be greyed out so users can notice it is disabled. We currently don't have a disabled spec from Material Design but usually we use opacity 0.38 to "disable" widgets(such as a disabled Card). So we can use Opacity and do:

return Opacity(
  opacity: widget.enabled? 1 : 0.38,
  child: ConstrainedBox(...)
)

Does this make sense?

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

Ok. I can add this.
When are you able to review again?

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

Everything except this disabled color is ok?

@QuncCccccc

Copy link
Copy Markdown
Contributor

Everything except this disabled color is ok?

Yep! Overall this looks good to me:) We can also check the opacity in the unit test. As for the disabled opacity number 0.38, could you also put this as a constant at the top of the file search_anchor.dart. That's where we put all these numbers:)

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

@QuncCccccc added the opacity and the test. Can you review, please?

@justinmc justinmc 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 with nits. Thanks for the PR!

textInputAction: widget.textInputAction,
keyboardType: widget.keyboardType,
child: Opacity(
opacity: widget.enabled ? 1 : _kDisableSearchBarOpacity,

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.

Super nit: 1.0 instead of 1.

Comment thread packages/flutter/lib/src/material/search_anchor.dart
Comment thread packages/flutter/test/material/search_anchor_test.dart Outdated
@QuncCccccc

Copy link
Copy Markdown
Contributor

@Macacoazul01 Could you rebase master to trigger the tests again? I don't think the test failures are related to your change.

@Macacoazul01

Copy link
Copy Markdown
Contributor Author

Finaly

@QuncCccccc QuncCccccc added the autosubmit Merge PR when tree becomes green via auto submit App label Jan 11, 2024
@auto-submit
auto-submit Bot merged commit e281c39 into flutter:master Jan 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 12, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jan 12, 2024
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Jan 12, 2024
flutter/flutter@9f2e681...7dc856a

2024-01-12 [email protected] Revert "Reverts "Run iOS staging tests with Xcode 15.2"" (flutter/flutter#141420)
2024-01-12 [email protected] Roll Packages from 0744fe6 to d74d687 (5 revisions) (flutter/flutter#141449)
2024-01-12 [email protected] Fix `FlexibleSpaceBar` centered title position and title color (flutter/flutter#140883)
2024-01-12 [email protected] Do not reset framework checkout before running customer tests (flutter/flutter#141013)
2024-01-12 [email protected] Increase delay for checking integration_ui_keyboard_resize test success (flutter/flutter#141301)
2024-01-12 [email protected] Add osx_sdk context for mac builds. (flutter/flutter#141422)
2024-01-12 [email protected] Roll Flutter Engine from ecdaed76f284 to 44a0a6ee4d39 (18 revisions) (flutter/flutter#141432)
2024-01-12 [email protected] Add support for Gradle Kotlin DSL (flutter/flutter#140744)
2024-01-12 [email protected] Fix typo (flutter/flutter#141426)
2024-01-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Run iOS staging tests with Xcode 15.2" (flutter/flutter#141412)
2024-01-11 [email protected] Run iOS staging tests with Xcode 15.2 (flutter/flutter#141392)
2024-01-11 [email protected] Fix `ListWheelScrollView` in an `AnimatedContainer` with zero height throw an error (flutter/flutter#141372)
2024-01-11 [email protected] make asset_test.dart tests not dependent on context (flutter/flutter#141331)
2024-01-11 [email protected] Expose 'enable' property to allow the user to disable the SearchBar (flutter/flutter#137388)
2024-01-11 [email protected] Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (flutter/flutter#141341)

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],[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
@Macacoazul01
Macacoazul01 deleted the search-anchor branch January 18, 2024 00:38
@Macacoazul01
Macacoazul01 restored the search-anchor branch January 18, 2024 00:38
@Macacoazul01
Macacoazul01 deleted the search-anchor branch January 18, 2024 00:38
@HansMuller HansMuller mentioned this pull request Feb 1, 2024
2 tasks done
@Macacoazul01

Copy link
Copy Markdown
Contributor Author

@HansMuller will this land on the next stable?

@HansMuller

Copy link
Copy Markdown
Contributor

Yes, it should be part of the next stable release.

@Macacoazul01 Macacoazul01 mentioned this pull request Aug 12, 2024
9 tasks done
auto-submit Bot pushed a commit that referenced this pull request Sep 4, 2024
Added the same parameter from #137388 to the `SearchAnchor`

This PR will fix: #150331
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
flutter/flutter@9f2e681...7dc856a

2024-01-12 [email protected] Revert "Reverts "Run iOS staging tests with Xcode 15.2"" (flutter/flutter#141420)
2024-01-12 [email protected] Roll Packages from 0744fe6 to d74d687 (5 revisions) (flutter/flutter#141449)
2024-01-12 [email protected] Fix `FlexibleSpaceBar` centered title position and title color (flutter/flutter#140883)
2024-01-12 [email protected] Do not reset framework checkout before running customer tests (flutter/flutter#141013)
2024-01-12 [email protected] Increase delay for checking integration_ui_keyboard_resize test success (flutter/flutter#141301)
2024-01-12 [email protected] Add osx_sdk context for mac builds. (flutter/flutter#141422)
2024-01-12 [email protected] Roll Flutter Engine from ecdaed76f284 to 44a0a6ee4d39 (18 revisions) (flutter/flutter#141432)
2024-01-12 [email protected] Add support for Gradle Kotlin DSL (flutter/flutter#140744)
2024-01-12 [email protected] Fix typo (flutter/flutter#141426)
2024-01-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Run iOS staging tests with Xcode 15.2" (flutter/flutter#141412)
2024-01-11 [email protected] Run iOS staging tests with Xcode 15.2 (flutter/flutter#141392)
2024-01-11 [email protected] Fix `ListWheelScrollView` in an `AnimatedContainer` with zero height throw an error (flutter/flutter#141372)
2024-01-11 [email protected] make asset_test.dart tests not dependent on context (flutter/flutter#141331)
2024-01-11 [email protected] Expose 'enable' property to allow the user to disable the SearchBar (flutter/flutter#137388)
2024-01-11 [email protected] Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (flutter/flutter#141341)

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],[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
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
flutter/flutter@9f2e681...7dc856a

2024-01-12 [email protected] Revert "Reverts "Run iOS staging tests with Xcode 15.2"" (flutter/flutter#141420)
2024-01-12 [email protected] Roll Packages from b67b257 to a49ee07 (5 revisions) (flutter/flutter#141449)
2024-01-12 [email protected] Fix `FlexibleSpaceBar` centered title position and title color (flutter/flutter#140883)
2024-01-12 [email protected] Do not reset framework checkout before running customer tests (flutter/flutter#141013)
2024-01-12 [email protected] Increase delay for checking integration_ui_keyboard_resize test success (flutter/flutter#141301)
2024-01-12 [email protected] Add osx_sdk context for mac builds. (flutter/flutter#141422)
2024-01-12 [email protected] Roll Flutter Engine from ecdaed76f284 to 44a0a6ee4d39 (18 revisions) (flutter/flutter#141432)
2024-01-12 [email protected] Add support for Gradle Kotlin DSL (flutter/flutter#140744)
2024-01-12 [email protected] Fix typo (flutter/flutter#141426)
2024-01-11 98614782+auto-submit[bot]@users.noreply.github.com Reverts "Run iOS staging tests with Xcode 15.2" (flutter/flutter#141412)
2024-01-11 [email protected] Run iOS staging tests with Xcode 15.2 (flutter/flutter#141392)
2024-01-11 [email protected] Fix `ListWheelScrollView` in an `AnimatedContainer` with zero height throw an error (flutter/flutter#141372)
2024-01-11 [email protected] make asset_test.dart tests not dependent on context (flutter/flutter#141331)
2024-01-11 [email protected] Expose 'enable' property to allow the user to disable the SearchBar (flutter/flutter#137388)
2024-01-11 [email protected] Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (flutter/flutter#141341)

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],[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App 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.

4 participants