Define small widgets
Do
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: const [
Widget(),
Widget(),
Widget()
]
)
);
}
Don't
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: const [
Row(
children: const [
Text(),
Text()
]
),
Padding(
padding: EdgeInsets.all(16.0),
child: Column(
children: [
Row(
children: const [
Text(),
Text()
]
),
Text()
]
)
)
]
)
);
}
Conclusion: Leads to code that is more readable and easier to reason about.