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

Variable to know if back layer is expanded or collapsed #130

Open
kartikg33 opened this issue Aug 28, 2023 · 1 comment
Open

Variable to know if back layer is expanded or collapsed #130

kartikg33 opened this issue Aug 28, 2023 · 1 comment

Comments

@kartikg33
Copy link

I am creating a mechanism where the back layer displays a list of items, and the front layer shows detailed information about the selected item.

Once an item is selected from the back layer, I want the appbar title to display the name of the selected item, else if the back layer is expanded, I want to set the appbar title to something more generic such as "Items List".

Is there a way to do this natively with backdrop? Or is there a variable that can be checked so that I can at least know the current state of the back layer (either collapsed or expanded)?

@WieFel
Copy link
Collaborator

WieFel commented Aug 28, 2023

Hi @kartikg33, thanks for submitting the issue.

You should be able to achieve what you want using one of these 2 getters:

  • Backdrop.of(context).isBackLayerConcealed (true if the back layer is "not visible")
    /// Whether the back layer is concealed or not.
    bool get isBackLayerConcealed =>
    animationController.status == AnimationStatus.completed ||
    animationController.status == AnimationStatus.forward;
  • Backdrop.of(context).isBackLayerRevealed (true if the back layer is "visible")
    /// Whether the back layer is revealed or not.
    bool get isBackLayerRevealed =>
    animationController.status == AnimationStatus.dismissed ||
    animationController.status == AnimationStatus.reverse;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants