Skip to content

Conversation

Macacoazul01
Copy link
Contributor

@Macacoazul01 Macacoazul01 commented Oct 27, 2023

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

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. f: material design flutter/packages/flutter/material repository. labels Oct 27, 2023
@HansMuller HansMuller requested a review from QuncCccccc November 1, 2023 18:25
Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

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
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

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
Contributor Author

@QuncCccccc Ready for the review.

Copy link
Contributor

@QuncCccccc QuncCccccc left a comment

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
Contributor Author

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

@Macacoazul01
Copy link
Contributor Author

Everything except this disabled color is ok?

@QuncCccccc
Copy link
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
Contributor Author

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

Copy link
Contributor

@justinmc justinmc left a comment

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

@QuncCccccc
Copy link
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
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 36861262+QuncCccccc@users.noreply.github.com Revert "Reverts "Run iOS staging tests with Xcode 15.2"" (flutter/flutter#141420)
2024-01-12 engine-flutter-autoroll@skia.org Roll Packages from 0744fe6 to d74d687 (5 revisions) (flutter/flutter#141449)
2024-01-12 tessertaha@gmail.com Fix `FlexibleSpaceBar` centered title position and title color (flutter/flutter#140883)
2024-01-12 whesse@google.com Do not reset framework checkout before running customer tests (flutter/flutter#141013)
2024-01-12 43054281+camsim99@users.noreply.github.com Increase delay for checking integration_ui_keyboard_resize test success (flutter/flutter#141301)
2024-01-12 godofredoc@google.com Add osx_sdk context for mac builds. (flutter/flutter#141422)
2024-01-12 engine-flutter-autoroll@skia.org Roll Flutter Engine from ecdaed76f284 to 44a0a6ee4d39 (18 revisions) (flutter/flutter#141432)
2024-01-12 barpac02@gmail.com Add support for Gradle Kotlin DSL (flutter/flutter#140744)
2024-01-12 36861262+QuncCccccc@users.noreply.github.com 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 15619084+vashworth@users.noreply.github.com Run iOS staging tests with Xcode 15.2 (flutter/flutter#141392)
2024-01-11 tessertaha@gmail.com Fix `ListWheelScrollView` in an `AnimatedContainer` with zero height throw an error (flutter/flutter#141372)
2024-01-11 andrewrkolos@gmail.com make asset_test.dart tests not dependent on context (flutter/flutter#141331)
2024-01-11 57464965+Macacoazul01@users.noreply.github.com Expose 'enable' property to allow the user to disable the SearchBar (flutter/flutter#137388)
2024-01-11 jonahwilliams@google.com 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 camillesimon@google.com,rmistry@google.com,stuartmorgan@google.com 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
@Macacoazul01
Copy link
Contributor Author

@HansMuller will this land on the next stable?

@HansMuller
Copy link
Contributor

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

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
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 f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants