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

Only expand as much as needed to reveal the back layer #35

Closed
heath3n opened this issue Jun 4, 2020 · 9 comments
Closed

Only expand as much as needed to reveal the back layer #35

heath3n opened this issue Jun 4, 2020 · 9 comments
Labels
question Further information is requested

Comments

@heath3n
Copy link

heath3n commented Jun 4, 2020

Currently the back layer expands fully; it should only expand as much as needed to fully show its contents.

@WieFel
Copy link
Collaborator

WieFel commented Jun 4, 2020

This is implemented by the property stickyFrontLayer which defaults to false. You can set it to true and it will adapt to the back layer's height.

BackdropScaffold(
    appBar: BackdropAppBar(
        title: Text("Backdrop Example"),
        actions: <Widget>[
        BackdropToggleButton(
            icon: AnimatedIcons.list_view,
        )
        ],
    ),
    backLayer: Container(
        height: 200.0,
        child: Center(child: Text("Back Layer")),
    ),
    frontLayer: Center(
        child: Text("Front Layer"),
    ),
    stickyFrontLayer: true,
)

@WieFel WieFel closed this as completed Jun 4, 2020
@daadu
Copy link
Member

daadu commented Jun 5, 2020

@heath3n This only works if the height of the back layer widget is bounded. If you are using ListView or something similar set shrinkWrap to true

@PembaTamang
Copy link

@daadu using a ListView and shrinkWrap did not work for me. What else can I do?

@daadu
Copy link
Member

daadu commented Sep 6, 2020

@PembaTamang Please provide us with minimum code that can reproduce the issue. We will look into it.

@daadu daadu reopened this Sep 6, 2020
@daadu daadu added the question Further information is requested label Sep 6, 2020
@amanv8060
Copy link

amanv8060 commented Sep 8, 2020

class BackLayer extends StatefulWidget {
  @override
  _BackLayerState createState() => _BackLayerState();
}

class _BackLayerState extends State<BackLayer> {
  @override
  Widget build(BuildContext context) {
    return  ListView(
        shrinkWrap: true,
        children:  <Widget>[
ListTile(title:Text("hey")),
ListTile(title:Text("hey")),
ListTile(title:Text("hey")),
ListTile(title:Text("hey")),
         
        ],
 
    );
  }
}

use this as Your Backlayer
and dont give header height

@WieFel
Copy link
Collaborator

WieFel commented Sep 8, 2020

I could not reproduce the problem. For me it works fine using your BackLayer and stickyFrontLayer: true.
Maybe take a look at

return ListView.separated(
shrinkWrap: true,
itemCount: items.length,
itemBuilder: (context, position) => InkWell(
child: items[position],
onTap: () {
// fling backdrop
Backdrop.of(context).fling();
// call onTap function and pass new selected index
onTap?.call(position);
},
),
separatorBuilder:
separatorBuilder ?? (builder, position) => separator ?? Container(),
);
which implements basically the same thing.

Which flutter channel are you using and do you use the newest version of it?

@daadu
Copy link
Member

daadu commented Sep 9, 2020

@amanv8060 Just to confirm, did you set stickyFrontLayer to true for BackdropScaffold?

@amanv8060
Copy link

@amanv8060 Just to confirm, did you set stickyFrontLayer to true for BackdropScaffold?

this was causing issue . Close this , if the issue author has no problem

@WieFel WieFel closed this as completed Sep 9, 2020
@Ravimgr
Copy link

Ravimgr commented Feb 16, 2022

i want to show some part of the backlayer while opening frontlayer is this possible?

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

No branches or pull requests

6 participants