How do I get the Widget of a Column to expand to the maximum width of the parent (Column)?

4
Form(
    child: Column(
    children: <Widget>[
    CustomTextFormField("E-mail"),
    CustomTextFormField('Senha'),
       Expanded(
          child: FittedBox(
            fit: BoxFit.fitWidth,
            child: RaisedButton(
              onPressed: () {},
              color: Colors.redAccent,
              child: Text(
                'Entrar',
                style: TextStyle(color: Colors.white),
              ),
              shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(50)),
            ),
          ),
        )
      ],
    ))

This is my code, when I use Expanded the Widget simply disappear. I'm following the exact example I found in Flutter documentation

What am I doing wrong?

    
asked by anonymous 12.12.2018 / 01:31

1 answer

3

Using Expanded in the Column child should be enough, however, you can always try to add as a property of the column: crossAxisAlignment: CrossAxisAlignment.stretch to make all children of that column fill the full width.

The SizedBox here with BoxFit.fitWidth is not necessary to achieve this, in fact, it is ambiguous not bringing anything new.

    
13.12.2018 / 12:14