Flutter Make Card and its content scale differently

17 Views Asked by At

If you look at the sample app for Material 3, sample. You can see that the cards that surround the component groups scale with the screen but the actauly component groups content stays the same. I can not get this to recreate. I have tried wrapping my card in expanded and then placing a container in side of it like below. But the card seems to stick to the container width and will not expand past it.

[Narrow][1] [Expanded][2]

You can see from the photos that the content stays the same width but as the screen is made wider or narrower the card behind them expands and contracts.



Expanded( child: Card( child: Container( width: 400, child: Column(), ), ), )



  [1]: https://i.stack.imgur.com/wocIr.png
  [2]: https://i.stack.imgur.com/BsdzC.png
1

There are 1 best solutions below

2
mkiziltay On

What do you want to do? Expanded widgets enlarges the size but not the container size. if you put expanded widget in a Row widget, row space increases. But the widget inside row not increase if it has constant size.

Support your question with images