Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add option for flexible space on material SearchDelegate #128132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jul 6, 2023

Conversation

HenriqueNas
Copy link
Contributor

@HenriqueNas HenriqueNas commented Jun 2, 2023

This pull request introduces the buildFlexibleSpace method to the SearchDelegate class in the material library.
It allows users to add a flexible space widget to the AppBar in a _SearchPage, providing more customization options.

This PR does not fix any specific issue as there are no open issues related to this feature.

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 f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Jun 2, 2023
@github-actions github-actions bot removed the f: material design flutter/packages/flutter/material repository. label Jun 2, 2023
@HenriqueNas HenriqueNas marked this pull request as draft June 2, 2023 19:09
@flutter-dashboard flutter-dashboard bot added the f: material design flutter/packages/flutter/material repository. label Jun 2, 2023
@HenriqueNas HenriqueNas marked this pull request as ready for review June 2, 2023 19:56
@github-actions github-actions bot removed the f: material design flutter/packages/flutter/material repository. label Jun 4, 2023
@goderbauer goderbauer added the f: material design flutter/packages/flutter/material repository. label Jun 6, 2023
@HansMuller HansMuller requested a review from goderbauer June 9, 2023 21:51
/// See also:
///
/// * [AppBar.flexibleSpace], the intended use for the return value of this method.
///
Copy link
Member

Choose a reason for hiding this comment

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

nit: remove blank line.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

@@ -211,6 +211,16 @@ abstract class SearchDelegate<T> {
///
PreferredSizeWidget? buildBottom(BuildContext context) => null;

/// Widget to display in the [AppBar] flexible space.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just:

Suggested change
/// Widget to display in the [AppBar] flexible space.
/// Widget to display in the [AppBar.flexibleSpace].

and then remove the "see also" section?

Copy link
Contributor Author

@HenriqueNas HenriqueNas Jun 14, 2023

Choose a reason for hiding this comment

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

I did this way to keep the pattern of others documentation for build methods in the class.
You can see it in PreferredSizeWidget? buildBottom(BuildContext) and List<Widget>? buildActions(BuildContext).

my changes sounds better ?

  /// Widget to display a flexible space in the [AppBar].
  ///
  /// Returns null by default, i.e. a flexible space widget is not included.
  ///
  /// See also:
  ///
  ///  * [AppBar.flexibleSpace], the intended use for the return value of this method.
  Widget? buildFlexibleSpace(BuildContext context) => null;

Comment on lines 1115 to 1116
// @override
// Widget? buildFlexibleSpace(BuildContext context) => null;
Copy link
Member

Choose a reason for hiding this comment

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

remove commented out code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

@@ -980,6 +1006,7 @@ class _TestSearchDelegate extends SearchDelegate<String> {
this.suggestions = 'Suggestions',
this.result = 'Result',
this.actions = const <Widget>[],
this.flexibleSpace = const Text('FlexibleSpace'),
Copy link
Member

Choose a reason for hiding this comment

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

make this null by default so this change doesn't invalidate all the other tests and make sure everything still works without this set? Then, add specific tests that set this to non-null and check that everything works.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done ✅

set flexibleSpace parameter default value as null (_TestSearchDelegate material search test)
@HenriqueNas HenriqueNas requested a review from goderbauer June 14, 2023 22:16
@HenriqueNas
Copy link
Contributor Author

Hey @goderbauer, I think I did everything that was needed here.
Could you rereview this PR, and let me know if have something more I can do ?

Copy link
Member

@goderbauer goderbauer left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@chunhtai chunhtai left a comment

Choose a reason for hiding this comment

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

LGTM

@goderbauer goderbauer added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 5, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Jul 6, 2023

auto label is removed for flutter/flutter, pr: 128132, due to - The status or check suite Windows build_tests_3_4 has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Jul 6, 2023
@goderbauer goderbauer added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 6, 2023
@auto-submit auto-submit bot merged commit eebb1d6 into flutter:master Jul 6, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 7, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Jul 7, 2023
flutter/flutter@bc49cd1...d55a7d8

2023-07-07 [email protected] Revert "fix a bug when android uses CupertinoPageTransitionsBuilder..." (flutter/flutter#130144)
2023-07-07 [email protected] Roll Packages from 771ec9b to 9bcf4bf (12 revisions) (flutter/flutter#130143)
2023-07-07 [email protected] Roll Flutter Engine from 650ff096488a to 8aa2e6516af1 (1 revision) (flutter/flutter#130116)
2023-07-07 [email protected] Roll Flutter Engine from 1fa222fae283 to 650ff096488a (3 revisions) (flutter/flutter#130114)
2023-07-07 [email protected] Roll Flutter Engine from 491f317978f4 to 1fa222fae283 (1 revision) (flutter/flutter#130110)
2023-07-07 [email protected] Roll Flutter Engine from 48bf7ac59254 to 491f317978f4 (2 revisions) (flutter/flutter#130107)
2023-07-06 [email protected] Roll Flutter Engine from 42df55a9e63e to 48bf7ac59254 (1 revision) (flutter/flutter#130106)
2023-07-06 [email protected] Super tiny code optimization: No need to redundantly check whether value has changed (flutter/flutter#130050)
2023-07-06 [email protected] Roll Flutter Engine from 06c936205d96 to 42df55a9e63e (3 revisions) (flutter/flutter#130100)
2023-07-06 [email protected] Manual roll Flutter Engine from bd2e42b203e1 to 06c936205d96 (27 revisions) (flutter/flutter#130097)
2023-07-06 [email protected] Marks Linux firebase_oriol33_abstract_method_smoke_test to be unflaky (flutter/flutter#128398)
2023-07-06 [email protected] Next attempt to make inspector weakly referencing the inspected objects. (flutter/flutter#129962)
2023-07-06 [email protected] [a11y] CupertinoSwitch On/Off labels (flutter/flutter#127776)
2023-07-06 [email protected] Add option for flexible space on material SearchDelegate (flutter/flutter#128132)
2023-07-06 [email protected] Roll Packages from 7042079 to 771ec9b (12 revisions) (flutter/flutter#130077)
2023-07-06 [email protected] [framework] Add textField OCR support for framework side (flutter/flutter#96637)
2023-07-06 [email protected] [flutter_tools] modify Skeleton template to use ListenableBuilder instead of AnimatedBuilder (flutter/flutter#128810)

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://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
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 17, 2023
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.

3 participants