Spacer in Flutter : How to put spaces between widgets?
Have you ever used Spacer in Flutter? If not then you will definitely use it after reading this blog. [Above image make no sense for spacer ;)]
Question: What is Spacer in flutter?
Answer: Spacer creates an adjustable, empty spacer that can be used to tune the spacing between widgets in a Flex container, like Row or Column.
In short, If you want to fill space between widgets then use the spacer().
For example, In a row, if we want to put space between two widgets such that it occupies all remaining space.
Looks confusing. Have a look at this video by flutter team
Row(
children: <Widget>[
Container(color: Colors.red, child: Text("Left")),
Spacer(),
Container(color: Colors.red, child: Text("Right")),
],
),
Look at its output
Now we know that spacer add lots of space that could be possible.
Try Spacer with column too and post it on twitter by tagging https://twitter.com/viveky259259
If you have any tips then do add here.
Read this too: https://api.flutter.dev/flutter/widgets/Spacer-class.html
Let me know if you find difficult to understand this. I would love to solve your problems.
Github Link : https://github.com/viveky259259/flutter_for_people/
#HappyCoding #flutter #widgets #hive #database