backdrop
backdrop copied to clipboard
Variable to know if back layer is expanded or collapsed
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)?
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") https://github.com/fluttercommunity/backdrop/blob/d21cfaaeae8e3b173fc596f34ac2971897394945/lib/src/scaffold.dart#L440-L443 -
Backdrop.of(context).isBackLayerRevealed
(true if the back layer is "visible") https://github.com/fluttercommunity/backdrop/blob/d21cfaaeae8e3b173fc596f34ac2971897394945/lib/src/scaffold.dart#L445-L448