flutterdartflutter-layout

what is differencebetween spacing and runSpacing in Flutter Wrap() Widget?


this is the image

what is difference between spacing and run space named parameter Flutter Wrap() Widget and also run alignment property please explain that


Solution

  • spacing is the space between the children in the main axis and runSpacing is the space in the cross axis.

    Consider this example (for default alignment)

    enter image description here

    SizedBox(
      width: 300,
      child: Wrap(
        spacing: 20.0, // Horizontal space.
        runSpacing: 30.0, // Vertical space.
        children: <Widget>[
          apple,
          ball,
          champion,
          destructor,
          eagle,
        ],
      ),
    )