Search code examples
flutteralignment

flutter - how to align at the top and at the bottom (this is the issue) - and column middle part


I would like to align a container at the bottom of the widget (given there is containers already at the top and some column in the middle)

So far I can align in at the top followed by some containers using Alignment.topCenter and column.

  body: Align(
    alignment: Alignment.topCenter,
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [

How can I then put one more container that is right at the bottom of the widget.

reason for this is I want the ad banner to appear at the top and at the bottom. the middle is the real content.


Solution

  • Add Column on top on Align Widget, & add at the bottom of its container with Expanded

      Expanded(
            child: Align(
              alignment: Alignment.bottomCenter,
              child: Container(
                height: 100,  // Give height of banner
                color: Colors.green,
              ),
            ),
          ),