【问题标题】:Row: a RenderFlex overflowed on the right行:右侧溢出的 RenderFlex
【发布时间】:2020-07-25 07:34:31
【问题描述】:

使用以下小部件时出现错误

一个 RenderFlex 在右侧溢出了 3.0 像素。

body: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0),
    child: Column(
      mainAxisAlignment: MainAxisAlignment.center,
      crossAxisAlignment: CrossAxisAlignment.stretch,
      children: <Widget>[
        Row(
          children: <Widget>[
            Container(
              child: Image.asset('images/logo.png'),
              height: 60.0,
            ),
            Text(
              'Flash Chat',
              style: TextStyle(
                fontSize: 35.0,
                fontWeight: FontWeight.w900,
              ),
            ),
          ],
        ),
      ],
    ),
),

我试图用 Expanded 包裹该行,但它似乎不起作用。除了减小文本的大小,我们在这里还能做什么?

【问题讨论】:

  • 是固定宽度小部件内的行吗?
  • 也包括该行的父项
  • @Henok 包括
  • 尝试用 IntrinsicWidth 小部件包装您的列
  • 尝试使用 FittedBox

标签: flutter


【解决方案1】:

您可以将 FontWeight 减少到 fontWeight: FontWeight.w700. 不仅是 700,还可以尝试值 100,200,300 等任何合适的值。

【讨论】:

    猜你喜欢
    • 2019-06-08
    • 2021-09-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-27
    • 2020-09-18
    • 1970-01-01
    相关资源
    最近更新 更多