Skip to content
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

[flutter_adaptive_scaffold] - Display an AppBar on bigger screen than mobile #130117

Closed
2 tasks done
wer-mathurin opened this issue Jul 7, 2023 · 4 comments
Closed
2 tasks done
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: flutter_adaptive_scaffold The flutter_adaptive_scaffold package P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team

Comments

@wer-mathurin
Copy link

Is there an existing issue for this?

Use case

This can be common to display on Desktop and table an AppBar to show widget (eg. Search field) like in Gmail.

Today this is impossible because the logic prevent that in the AdaptiveScaffold

appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer
        ? widget.appBar ?? AppBar()
        : null,

Proposal

This can be fixed by adding a new property to the Widget => Breakpoint? appBarBreakpoint
This way we are not breaking the API and can display an AppBar is needed on defined breakpoints. It also not relying on the useDrawer flag!

 appBar: widget.drawerBreakpoint.isActive(context) && widget.useDrawer ||
              (widget.appBarBreakpoint?.isActive(context) ?? false)
          ? widget.appBar ?? AppBar()
          : null,

This way we can use the AdaptiveScaffold

   final double leadingWidth =
            Breakpoints.large.isActive(context) ? 192 : 72;

        return Theme(
          data: Theme.of(context).copyWith(
              appBarTheme: AppBarTheme.of(context).copyWith(
                  backgroundColor: Colors.grey.shade200,
                  iconTheme:
                      IconTheme.of(context).copyWith(color: Colors.grey))),
          child: AdaptiveScaffold(
            appBar: MyCustomAppBar(leadingWidth: leadingWidth),
            appBarBreakpoint: Breakpoints.smallAndUp,
...

With this setup we can achieve this in
mobile
image

tablet
image

desktop
image

@darshankawar darshankawar added the in triage Presently being triaged by the triage team label Jul 7, 2023
@darshankawar darshankawar changed the title [flutter_adaptive_scaffold] - Display an AppBar on bigger screen that mobile [flutter_adaptive_scaffold] - Display an AppBar on bigger screen than mobile Jul 7, 2023
@darshankawar darshankawar added c: new feature Nothing broken; request for a new capability package flutter/packages repository. See also p: labels. c: proposal A detailed proposal for a change to Flutter p: flutter_adaptive_scaffold The flutter_adaptive_scaffold package and removed in triage Presently being triaged by the triage team labels Jul 7, 2023
@flutter-triage-bot flutter-triage-bot bot added the team-ecosystem Owned by Ecosystem team label Jul 8, 2023
@wer-mathurin
Copy link
Author

@darshankawar Just to let you know I did a PR for this:
flutter/packages#4434

Just need someone to review it.

@darshankawar darshankawar added the fyi-ecosystem For the attention of Ecosystem team label Jul 12, 2023
@flutter-triage-bot
Copy link

The fyi-ecosystem label is redundant with the team-ecosystem label.

@flutter-triage-bot flutter-triage-bot bot removed the fyi-ecosystem For the attention of Ecosystem team label Jul 12, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this issue Jul 12, 2023
Thsi PR add the ability to display an AppBar on any desired Breakpoint.  It can be usefull to display an AppBar even on a desktop application. 

related to : flutter/flutter#130117
@stuartmorgan stuartmorgan added P2 Important issues not at the top of the work list triaged-ecosystem Triaged by Ecosystem team labels Jul 13, 2023
@wer-mathurin
Copy link
Author

@stuartmorgan the PR have been merged and plugin have been published. You can close this issue !

@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label Aug 14, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter p: flutter_adaptive_scaffold The flutter_adaptive_scaffold package P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. r: fixed Issue is closed as already fixed in a newer version team-ecosystem Owned by Ecosystem team triaged-ecosystem Triaged by Ecosystem team
Projects
None yet
Development

No branches or pull requests

3 participants