I use Expanded() to tell the Widgets in my Row to use the available space. I want to have 4px space between elements in my Row. I don't want to have the same space towards elements outside of the Row. Given that Flutter doesn't support negative Padding I therefore can't add Padding in a way that gives the first item no left Padding and the last item no right Padding.
Is there pattern to easily define spacing with a specific width? I want a solution that works with an arbitrary number of Widgets. For 4 Widgets I want something that produces the equivalent of:
Row(children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 8, 0),
child: Expanded(Text("Alice"))),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: Expanded(Text("Alice"))),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: Expanded(Text("Alice"))),
Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 0, 0),
child: Expanded(Text("Alice")))
]);
cant understand what you want to achieve exactly but try Use
SizedBox
widget very easy and simple check it herehttps://api.flutter.dev/flutter/widgets/SizedBox-class.html
example