by @kodeazy
How to set space between elements in a row in flutter?
- To set space between elements in a row using flutter follow below steps.
- using
SizedBox
we canset the space between elements in flutter. - Below is the syntax.
SizedBox(width: 150)
- Below is an example code on how to set space between elements using flutter.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Spacing Elements',
home: Scaffold(
body: Row(children: [
Text("data1"),
SizedBox(width: 150),
Text("data2"),
SizedBox(width: 50),
Text("data3"),
]),
));
}
}