I have widget:
Scaffold(
appBar: ...,
body: Form(
child: ListView(
children: [
...
ElevatedButton() // Save button
]
)
)
);
So, I want to place it to the bottom of the screen. I tried to place it inside Align
widget but it doesn't work. Another thing is that I have ExpansionTile
above and it can overflow the screen. In this case, there mustn't be any additional space between Activate
and Save
buttons. How to do it?
Use MainAxisAlignment.spaceBetween. Documentation:
Place the free space evenly between the children.
bool _hasExpansionTile = false;
Scaffold(
appBar: ...,
body: Column(mainAxisAlignment: _hasExpansionTile ? MainAxisAlignment.start : MainAxisAlignment.spaceBetween, /// Checking that the expansion tile is visible
children: [
Flexible(
child: Form(
child: Column(
children: [
...
],
),
),
),
ElevatedButton(onPressed: (){}, child: Text("Send")),
],
),
);
Of course you must use setState(), when you changing the value of the _hasExpansionTile
property.
You can use Spacer()
Scaffold( appBar: ...,
body: Form(
child: ListView(
children: [
...
Spacer(),
ElevatedButton() // Save button
]
)
) );
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.