So i like to figure out how to make Card widget become full width in flutter, basically it only expand its width based on its child, i want it to fit the screen, the task fairly simple but im having a really hard time achieving that, in my scaffold basically it contain two card, and have some text in it, the card only expand to the size of the end of the text, i want the card to be full width, how do i achieve this?
I expect it the card to be full width of the screen, but the card only wrap the children text widget
Wrap the Column
in a Container
widget and set it's width to double.infinity
This way you'll save some lines of code.
Example Code:
Container(
width : double.infinity,
child: Column([...])
)
Try this.
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
width: double.infinity,
child: new Card(child: Text("This Card is Expanded to full width"),),
)
],
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With