I am developing a Flutter app and would like to keep my button always in the bottom of the screen UNLESS what is in top of it is high enough to make the screen scroll. Examples:
Example A (what is on top of the button does not have height enough to scroll the screen)
Example B (what is on top of the button has height enough to scroll the screen, so the button will just go offscreen and allow the screen to scroll)
So summarizing: the button should be forced to stay at the bottom of the screen when the rest of the list is shorter than the device height, but if the list height is greater than the device height the button should behave normally and stay below the list.
What I tried:
- Using a ListView, which will normally scroll if necessary, but I couldn't find a way to send the button to the botton of the screen;
- Using a Column. With the help of a
SpacerI could make the button go to the bottom of the screen, but a Column will not scroll, and if I add aSingleChildScrollViewto wrap it, theSpacerwill no longer work because SingleChildScrollView has the potential to have infinite height;
Thanks.