Reputation: 173
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…
this is widgets don't show the content of its child
Upvotes: 2
Views: 7694
Reputation: 63604
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
.
Upvotes: 11