Skip to content

Conversation

QuncCccccc
Copy link
Contributor

@QuncCccccc QuncCccccc commented Apr 17, 2023

This PR is to:

  • Update API doc for SearchBar.
  • Add an example to show how to use a SearchBar as the builder of the SearchAnchor.

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.

@flutter-dashboard flutter-dashboard bot added d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos documentation f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. c: contributor-productivity Team-specific productivity, code health, technical debt. labels Apr 17, 2023
@QuncCccccc QuncCccccc requested a review from HansMuller April 17, 2023 20:37
@QuncCccccc QuncCccccc marked this pull request as ready for review April 17, 2023 20:37
@QuncCccccc QuncCccccc removed the request for review from HansMuller April 17, 2023 20:37
@QuncCccccc QuncCccccc force-pushed the add_search_bar_example branch from 6bcdb64 to e69bb9d Compare April 17, 2023 20:44
@QuncCccccc QuncCccccc requested a review from HansMuller April 17, 2023 20:47
/// Search bars include a [leading] Search icon, a text input field and optional
/// [trailing] icons. A search bar is typically used to open a search view.
/// It is the default trigger for a search view.
/// Search bars typically consist of a [leading] search icon, a text input field
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still a bit confusing because it implies that SearchBar is a SearchAnchorChildBuilder and because it doesn't make it obvious that a SearchBar is the thing that the user taps to get a search view route. Here's a suggestion on how to describe SearchBar:

A SearchBar looks like a TextField. Tapping a SearchBar typically shows a "search view" route: a route with the search bar at the top and a list of suggested completions for the search bar's text below. SearchBars are usually created by a [SearchAnchor.builder]. The builder provides a [SearchController] that's used by the search bar's [SearchBar.onTap] callback to show the search view and to hide it when the user selects a suggestion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is much better than my version🥲. Just updated. Thanks a lot for the suggestion!

@@ -982,6 +983,21 @@ class SearchController extends TextEditingController {
/// the search bar. Typically only one or two action icons are included.
/// These actions can represent additional modes of searching (like voice search),
/// a separate high-level action (such as current location) or an overflow menu.
///
/// {@tool dartpad}
/// This example shows how to use a [SearchBar] as the builder of the [SearchAnchor].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SearchBar isn't a SearchAnchorChildBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah right, it should be the builder's return value instead of the builder. Just updated.

Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Apr 18, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Apr 18, 2023
flutter/flutter@15cb1f8...42fb0b2

2023-04-18 katelovett@google.com Fix text theme dart fix cases (flutter/flutter#125052)
2023-04-18 gspencergoog@users.noreply.github.com Update the copy icon in snippets and samples to use the standard one (flutter/flutter#123651)
2023-04-18 jmccandless@google.com Remove unused context parameter (flutter/flutter#124254)
2023-04-18 jmccandless@google.com iOS spell check cursor placement (flutter/flutter#124875)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from d2973619074e to 55bb065c607b (1 revision) (flutter/flutter#125047)
2023-04-18 zanderso@users.noreply.github.com Stop running "_impeller_" benchmark variants (flutter/flutter#125044)
2023-04-18 engine-flutter-autoroll@skia.org Roll Packages from 0277f2a to faf53fb (7 revisions) (flutter/flutter#125040)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from c4396f9f602f to d2973619074e (6 revisions) (flutter/flutter#125039)
2023-04-18 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#125005)
2023-04-18 pateltirth454@gmail.com [InputDatePickerFormField] adds acceptEmptyDate to InputDatePickerFormField Widget (flutter/flutter#124143)
2023-04-18 44755140+werainkhatri@users.noreply.github.com relayout active ListWheelScrollView children every performLayout (flutter/flutter#124476)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4a603aaff32e to c4396f9f602f (2 revisions) (flutter/flutter#125007)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 20034a8d62c4 to 4a603aaff32e (2 revisions) (flutter/flutter#125004)
2023-04-18 katelovett@google.com Add optional axis specifier to static scrollable methods (flutter/flutter#124894)
2023-04-17 barpac02@gmail.com Update usage of standalone`pub` executable in flutter_tools testing docs (flutter/flutter#124898)
2023-04-17 warriorharish95668@gmail.com Add Harish Anbalagan to AUTHORS (flutter/flutter#124684)
2023-04-17 engine-flutter-autoroll@skia.org Roll Flutter Engine from b2d07388ceb6 to 20034a8d62c4 (7 revisions) (flutter/flutter#125001)
2023-04-17 36861262+QuncCccccc@users.noreply.github.com Add an example for SearchBar (flutter/flutter#124992)
2023-04-17 47866232+chunhtai@users.noreply.github.com SelectionContainer's listeners can remove itself during listener call� (flutter/flutter#124624)

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 rmistry@google.com,stuartmorgan@google.com,ychris@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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@reidbaker reidbaker mentioned this pull request Apr 21, 2023
8 tasks
nploi pushed a commit to nploi/packages that referenced this pull request Jul 16, 2023
flutter/flutter@15cb1f8...42fb0b2

2023-04-18 katelovett@google.com Fix text theme dart fix cases (flutter/flutter#125052)
2023-04-18 gspencergoog@users.noreply.github.com Update the copy icon in snippets and samples to use the standard one (flutter/flutter#123651)
2023-04-18 jmccandless@google.com Remove unused context parameter (flutter/flutter#124254)
2023-04-18 jmccandless@google.com iOS spell check cursor placement (flutter/flutter#124875)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from d2973619074e to 55bb065c607b (1 revision) (flutter/flutter#125047)
2023-04-18 zanderso@users.noreply.github.com Stop running "_impeller_" benchmark variants (flutter/flutter#125044)
2023-04-18 engine-flutter-autoroll@skia.org Roll Packages from 0277f2a to faf53fb (7 revisions) (flutter/flutter#125040)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from c4396f9f602f to d2973619074e (6 revisions) (flutter/flutter#125039)
2023-04-18 fluttergithubbot@gmail.com Roll pub packages (flutter/flutter#125005)
2023-04-18 pateltirth454@gmail.com [InputDatePickerFormField] adds acceptEmptyDate to InputDatePickerFormField Widget (flutter/flutter#124143)
2023-04-18 44755140+werainkhatri@users.noreply.github.com relayout active ListWheelScrollView children every performLayout (flutter/flutter#124476)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 4a603aaff32e to c4396f9f602f (2 revisions) (flutter/flutter#125007)
2023-04-18 engine-flutter-autoroll@skia.org Roll Flutter Engine from 20034a8d62c4 to 4a603aaff32e (2 revisions) (flutter/flutter#125004)
2023-04-18 katelovett@google.com Add optional axis specifier to static scrollable methods (flutter/flutter#124894)
2023-04-17 barpac02@gmail.com Update usage of standalone`pub` executable in flutter_tools testing docs (flutter/flutter#124898)
2023-04-17 warriorharish95668@gmail.com Add Harish Anbalagan to AUTHORS (flutter/flutter#124684)
2023-04-17 engine-flutter-autoroll@skia.org Roll Flutter Engine from b2d07388ceb6 to 20034a8d62c4 (7 revisions) (flutter/flutter#125001)
2023-04-17 36861262+QuncCccccc@users.noreply.github.com Add an example for SearchBar (flutter/flutter#124992)
2023-04-17 47866232+chunhtai@users.noreply.github.com SelectionContainer's listeners can remove itself during listener call� (flutter/flutter#124624)

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 rmistry@google.com,stuartmorgan@google.com,ychris@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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

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 c: contributor-productivity Team-specific productivity, code health, technical debt. d: api docs Issues with https://api.flutter.dev/ d: examples Sample code and demos 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.

2 participants