Search code examples
flutterdartalignment

Flutter: how to place forgot password button at the bottom of the screen


`

      child: Wrap(
        alignment: WrapAlignment.spaceAround,
        children: [
          const SizedBox(height: 16),
          _EmailInput(),
          const SizedBox(height: 8),
          _ForgotPasswordButton()
        ],
      ),

`With the given setup what should I do to place forgot password button at the bottom of the page eg: https://drive.google.com/file/d/1Iyqy8u4gwWXaRj6SLey3qzgvdICDor2Z/view?usp=sharing

I tried wrapping them in a Container and Column but it doesn't work


Solution

  • Put you widgets in a Column and wrap your _EmailInput() in an Expanded(). That will make your _EmailInput() expand to fill the available space along the main axis and push the _ForgetPasswordButton() to the bottom

    Column(
      children: [
        Expanded(
          child: Center(
            child: _EmailInput(),
          )
        ),
        _ForgotPasswordButton()
      ],
    )