I’m using the widget Wrap this way:
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 5,
children: [
condition1 ? Container(width: 50, height: 50, color: Colors.blue) : SizedBox(),
condition2 ? Container(width: 50, height: 50, color: Colors.red) : SizedBox(),
condition3 ? Container(width: 50, height: 50, color: Colors.green) : SizedBox()
]
)
How can I apply the spacing only on the Container and not on the SizedBox ?
2
Answers
Try to wrap Padding on Container widget
If
SizedBox
is only there as a placeholder and is not useful in any other way, you don’t need it at all. Check out alternative syntax: