So from what i see people have answered you use the spacer that can one solution. But Just from my thinking I would suggest you.
- So initially what you do is Add the container as a parent to this widget and give a color and check if the color is just covering the child widget. It means that the space between parameter would not work because it is expanding as max as parent widget.
- So to use the max width you can use a MediaQuery or use the Layoutbuilder widget to get the device width and height
I have Added an Example below how this works.
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Sample',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key}) : super(key: key);
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String label = "NVD";
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40,
),
// this is when the parent has a full width
Container(// consider container as parent
width: MediaQuery.of(context).size.height,
color: Colors.red,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: Theme.of(context).textTheme.headline4),
Checkbox(
activeColor: Colors.grey,
checkColor: Colors.white,
value: true,
onChanged: (value) {},
),
],
),
Container(
color: Colors.blue,
height: 10,
)
],
),
),
),
SizedBox(
height: 40,
),
// this is when the below container which is parent and has
// specific width due to which child is will adjust accordingly.
Container(
width: 200,
color: Colors.blue,
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(label, style: Theme.of(context).textTheme.headline4),
Checkbox(
activeColor: Colors.grey,
checkColor: Colors.white,
value: true,
onChanged: (value) {},
),
],
),
Container(
color: Colors.red,
height: 10,
)
],
),
),
),
],
),
);
}
}
Image for the code implentation

Let me know if it works
Thanks.