Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter Grid view with dynamic width and height

My issue is that I want to display Text widget in my grid view and each one of these widgets has its own content and can have different width, I am facing trouble with achieving that…

enter image description here

this is widgets don't show the content of its child

like image 426
Mouayad Avatar asked Jun 08 '26 15:06

Mouayad


1 Answers

For this case, you can use Wrap widget.

Padding( //outer spacing
  padding: const EdgeInsets.all(8.0),
  child: Wrap(
    spacing: 8, // space between items
    children: ["Java", "Nodejs"]
        .map((e) => Container(
              padding: EdgeInsets.all(8),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(4),
              ),
              child: Text(e),
            ))
        .toList(),
  ),
)

More about Wrap widget.

like image 103
Yeasin Sheikh Avatar answered Jun 11 '26 07:06

Yeasin Sheikh