Created with <3 with dartpad.dev.
Last active
September 26, 2022 15:54
-
-
Save Chralu/3c6d790d35504cb762dca04fd652e3e7 to your computer and use it in GitHub Desktop.
Flutter101 - Layout column spacer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class ColumnDemo extends StatelessWidget { | |
const ColumnDemo({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
textDirection: TextDirection.ltr, | |
crossAxisAlignment: CrossAxisAlignment.center, // Positionnement horizontal | |
children: [ | |
const Spacer(), | |
Container( | |
color: Colors.red, | |
width: 100, | |
height: 100, | |
), | |
const Spacer( | |
//flex: 4, | |
), | |
Container( | |
color: Colors.green, | |
width: 100, | |
height: 100, | |
), | |
const Spacer(), | |
Container( | |
color: Colors.blue, | |
width: 100, | |
height: 100, | |
), | |
const Spacer(), | |
], | |
); | |
} | |
} | |
void main() { | |
runApp( | |
const ColumnDemo(), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment