1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Shrink container to smaller child rather than expanding to fill parent

Discussão em 'Mobile' iniciado por Stack, Outubro 17, 2024 às 11:42.

  1. Stack

    Stack Membro Participativo

    I'm creating a custom widget for a segment control.

    return Padding(
    padding: const EdgeInsets.symmetric(vertical: 20.0),
    child: Container(
    decoration: BoxDecoration(border: Border.all(color: Colors.blue)),
    child: Row(
    mainAxisSize: MainAxisSize.min,
    children: buttons,
    ),
    ),
    );


    I want the container to shrink to the minimum size to contain its children. However when I include the widget in a parent, it expands to fill the parent. This is visible because the border from the decoration is larger than the buttons.

    How do I force the container to shrink?

    Continue reading...

Compartilhe esta Página