Flutter - Right overflowed

357 Views Asked by At

When I put a Text widget just for test, the program shows "A RenderFlex overflowed by 34 pixels on the right.". I tried to put the Text in a Container, but it isn't works too. Look the print:

CupertinoPageScaffold(
    navigationBar: CupertinoNavigationBar(
      middle: Row(
        children: <Widget>[
          Expanded(
            child: Padding(
              padding: EdgeInsets.fromLTRB(10.0, 0.0, 0.0, 0.0),
              child: CupertinoTextField(
                prefix: Padding(
                  padding: EdgeInsets.fromLTRB(5.0, 0.0, 0.0, 0.0),
                  child: Icon(
                    IconData(0xF4A4,
                        fontFamily: "CupertinoIcons",
                        fontPackage: CupertinoIcons.iconFontPackage),
                    color: CupertinoColors.darkBackgroundGray,
                  ),
                ),
                placeholder: 'O que você procura?',
              ),
            ),
          ),
          Padding(
            padding: EdgeInsets.fromLTRB(5.0, 0.0, 5.0, 0.0),
            child: FittedBox(
              fit: BoxFit.contain,
              child: CupertinoButton(
                child: Icon(
                    IconData(0xF370,
                        fontFamily: "CupertinoIcons",
                        fontPackage: CupertinoIcons.iconFontPackage),
                    size: 80.0,
                    color: CupertinoColors.black),
                onPressed: () {},
              ),
            ),
          ),
        ],
      ),
      backgroundColor: CupertinoColors.systemGroupedBackground,
    ),
    child: Text("Teste"),
  );

look

1

There are 1 best solutions below

0
On BEST ANSWER

It compiled allright for me. But consider placing the text in a Column or Expanded widget, something will try to take all the space available. (Text widgets only become as big as they need to be, maybe something goes wrong popping that directly into the CupertinoPageScaffold)