Search code examples
fluttercontainersrow

How much cost by using Container, Column, Row? ( in Flutter)


How much cost by using Container and Column, or Row? I use one of these three for a trivial things, I want to know how much it costs.


Solution

  • First of all you need to know the purpose of using above three widgets.

    Container

    • Takes exactly one child widget
    • Rich alignment and styling options available
    • Flexible width (e.g. child width, available width, …)
    • Perfect for custom styling and alignment

    Row/Column

    • Takes multiple (unlimited) child widgets
    • Alignment options available, but there are no
    • Always takes full available height (column) /width (row)
    • Must-use if widgets sit next to/above each other

    Conclussion
    If you can solve same problem with Container or Row/Column then I would suggest you to use Container. It takes less time/cost to render comparing to Row/Column.