ThorMJ
ThorMJ

Reputation: 89

Flutter position row at bottom of screen inside a SingleChildScrollView?

I have a screen with a graph and some buttons and then some nav buttons... in portrait, everything fits on the screen, but I want the nav buttons to be at the bottom of the screen, and the graph to be at the top of the screen

in landscape-phone, there's not enough room...

So I put the whole thing into a SingleChildScrollView(child:column(child: [stuff, navbuttons]), but that resulted in everything being close together and centered.

I tried SingleChildScrollView(child:column(child: [stuff, Spacer, navbuttons]), but that makes a RenderFlex children have non-zero flex but incoming height constraints are unbounded error.

What's the way to make a "SpacerBigEnough" class?

Upvotes: 1

Views: 268

Answers (1)

Jared Anderton
Jared Anderton

Reputation: 1026

I've accomplished similar UI by using a CustomScrollView, like so:

    CustomScrollView(
     slivers: <Widget>[
       SliverToBoxAdapter(
         child: Column(
           children: [stuff],
         ),
       ),
       SliverFillRemaining(
         hasScrollBody: false,
         child: Align(
           alignment: Alignment.bottomCenter,
           child: navbuttons,
         ),
       )
     ],
   )

Upvotes: 1

Related Questions