I need an efficient way to put these elements as following:
- a back button on the top left
- some element in the middle wrapped in
Column()
usually I use Row() and Column() widgets but I don't think that's the case here.
CodePudding user response:
For this kind of UI, I prefer using Stack.
@override
Widget build(BuildContext context) {
return Scaffold(
body: LayoutBuilder(
// for future cases
builder: (context, constraints) {
return Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 16,
top: 16,
child: Icon(Icons.arrow_back),// use backButton widget
),
Align(
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [Text("A")],// your widgtes
),
)
],
);
},
),
);
}
Widgets are prioritized bottom to top.

