颤振-右溢出

时间:2020-09-11 19:23:22

标签: flutter dart flutter-cupertino

当我将文本小部件仅用于测试时,程序显示“ RenderFlex的右侧溢出了34个像素”。我试图将文本放入容器中,但是它也不起作用。看一下照片:

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 个答案:

答案 0 :(得分:0)

它为我编译了。但是考虑将文本放在ColumnExpanded小部件中,某些方法会尝试占用所有可用空间。 (Text窗口小部件只会变得足够大,可能会弹出一些错误,直接将其弹出到CupertinoPageScaffold中)