Ricko Tiaka
Ricko Tiaka

Reputation: 67

Flutter : Error after add Spacer() in my row Children

I do a row for many button that can do scroll vertical, but i need some space between button, so i add Spacer() for create a space

            SingleChildScrollView(
              .....
              child: Column(
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      TextButton(
                        ....
                      ),
                      Spacer(),
                      TextButton(
                        ....
                      ),
                    ],
                  )
                ],
              ),
            )

After I add syntax Spacer() there, I got this Error Error screenshot,

Upvotes: 1

Views: 2939

Answers (2)

Ricko Tiaka
Ricko Tiaka

Reputation: 67

I change my Row() to Wrap(), then I add spacing: from wrap widget

Wrap(
  spacing: 100,
  ....
)

and Done, Thx everyone

Upvotes: 2

Muhammet
Muhammet

Reputation: 89

Try to wràp your SingleChildScrollView with Container that has a preferred size, e.g. Container(width: 400, height 400, child: SingleChilScrollView....). If it doesn't work, use SizedBox or Divider instead of Spacer.

Upvotes: 0

Related Questions