Skip to content

Allow changing of leading width and automatically leading options in search bar delegate #136164

Closed

Description

@VB10

Is there an existing issue for this?

Steps to reproduce

1- In any view, open the search bar delagate
2- Close the back button to only show the text field and action
3- Change the width of the leading

Expected results

Normally Appbar has two options, leading and width, and they can be changed from the client side.

Actual results

Client-side changes are not possible. It just changed AppBarTheme option, but I couldn't have these requirements.

Code sample

Code sample
@override
  ThemeData appBarTheme(BuildContext context) {
    return context.general.appTheme.copyWith(
      appBarTheme: const AppBarTheme(),
    );
  }

Screenshots or Video

AppBar is the current search bar

image

Logs

No response

Flutter Doctor output

Doctor output
[!] Flutter (Channel master, 3.16.0-6.0.pre.22, on macOS 13.4.1 22F770820d darwin-arm64, locale en-TR)
    ! Upstream repository https://github.com/VB10/flutter is not a standard remote.
      Set environment variable "FLUTTER_GIT_URL" to https://github.com/VB10/flutter to dismiss this error.
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0-rc5)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] IntelliJ IDEA Community Edition (version 2022.3.2)
[✓] VS Code (version 1.83.0)
[✓] Connected device (3 available)
[✓] Network resources

Activity

  1. added
    in triagePresently being triaged by the triage team
    on Oct 9, 2023
  2. dam-ease commented on Oct 9, 2023

    @dam-ease

    Hi @VB10. Thanks for filing this. I tried reproducing this with the sample code here but not sure I fully understand the third reproduction step. Please can you provide a minimal complete reproducible code sample that doesn’t include 3rd party plugins or complex production code?
    Thank you.

  3. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 9, 2023
  4. VB10 commented on Oct 9, 2023

    @VB10
    ContributorAuthor

    @dam-ease thank you for response. The sample code shows we only modify AppBarTheme option, but leading width and automatic back button are not implemented in the class. That was the problem. This area cannot be changed directly. There is no support for these properties, so I wasn't able to add the right sample code.

    image

    This problem has also been solved with PR:

    #136165

  5. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 9, 2023
  6. dam-ease commented on Oct 10, 2023

    @dam-ease

    Hi @VB10. Thanks for your response.
    For the issue to be workable, it needs to be reproducible with a minimal complete code sample that doesn’t include 3rd party plugins or complex production code. Please are there any more information or a sample you could help with to reproduce this issue??

  7. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 10, 2023
  8. VB10 commented on Oct 10, 2023

    @VB10
    ContributorAuthor

    @dam-ease It has already been said to you, but I will try to explain it again. The searchbar does not support the leading options, so I couldn't share any code with you. The purpose of my PR can be understood if you look at it.

    By the way, it will be helpful to you

    class HomeDelegate extends SearchDelegate {
      @ override
      ThemeData appBarTheme(BuildContext context) {
        // TODO: implement appBarTheme
        return Theme.of(context).copyWith(appBarTheme: AppBarTheme());
      }
    

    Appbar theme only supports these fields; leadingWidth and auto. are not included.

    const AppBarTheme({
        Color? color,
        Color? backgroundColor,
        this.foregroundColor,
        this.elevation,
        this.scrolledUnderElevation,
        this.shadowColor,
        this.surfaceTintColor,
        this.shape,
        this.iconTheme,
        this.actionsIconTheme,
        this.centerTitle,
        this.titleSpacing,
        this.toolbarHeight,
        this.toolbarTextStyle,
        this.titleTextStyle,
        this.systemOverlayStyle,
      })
    
  9. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 10, 2023
  10. dam-ease commented on Oct 10, 2023

    @dam-ease

    Thanks for your response and patience. I understand you now, I think a proposal would be better in this case. Can you please help with filing a separate detailed proposal, and then link the PR to it as this makes it easier to track?

  11. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 10, 2023
  12. VB10 commented on Oct 10, 2023

    @VB10
    ContributorAuthor

    Certainly, here's my proposal: @dam-ease

    I propose adjusting the leadinWidth. On smaller devices, we encounter spacing issues, particularly when there's a text field. A larger space would rectify this.

    I opt not to display a back button to conserve space. Instead, I'm using a close button, eliminating the need to navigate back.

    The primary rationale behind these requirements is to address spacing constraints. Typically, I can modify the appbar properties to meet these needs. However, when utilizing SearchDelegate, I'm limited in making such adjustments.

  13. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 10, 2023
  14. 1 remaining item

  15. added
    c: new featureNothing broken; request for a new capability
    p: material_uimaterial_ui package in flutter/packages
    c: proposalA detailed proposal for a change to Flutter
    team-designOwned by Design Languages team
    frameworkflutter/packages/flutter repository. See also f: labels.
    and removed
    in triagePresently being triaged by the triage team
    on Oct 11, 2023
  16. added
    P2Important issues not at the top of the work list
    triaged-designTriaged by Design Languages team
    on Oct 11, 2023
  17. added a commit that references this issue on Nov 29, 2023
    c532865
  18. added
    r: fixedIssue is closed as already fixed in a newer version
    on Dec 11, 2023
  19. github-actions commented on Dec 25, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on Dec 25, 2023
  21. added a commit that references this issue on Dec 29, 2023
    9080167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listc: new featureNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to Flutterframeworkflutter/packages/flutter repository. See also f: labels.p: material_uimaterial_ui package in flutter/packagesr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions