Reputation: 35
With this code:
return Scaffold(
bottomNavigationBar: KrigliBottomNavigation(
selectedIndex: 0,
),
body: Column(
children: [
Container(
width: double.infinity,
height: 500,
child: Text("TEST"),
),
Stack(
clipBehavior: Clip.none,
children:[
//FloatingActionButton
],
),
Stack(
children: [
Text("TEST"),
],
),
],
),
);
But I want something like this: FAB over another elements, without taking space
Upvotes: 0
Views: 174
Reputation: 2285
Almost there!! Your stack should be above column and the second child of the stack can be a align widget containing the FAB.
Like so:
return Stack(
fit: StackFit.expand,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Container(
color: Colors.red,
)
),
Expanded(
child: Container(
color: Colors.green,
)
),
],
),
Align(
alignment: Alignment(0.9, 0), // Goes from -1 to 1 for both axes
child: FloatingActionButton(
onPressed: () { },
child: Icon(Icons.phone),
)
),
]
);
The structure basically goes like a stack of two widgets. The background column having those containers and a right-aligned floating action button drawn on top of the column.
Upvotes: 2