【问题标题】:constraints structure in the container class容器类中的约束结构
【发布时间】:2021-02-03 10:00:18
【问题描述】:

朋友们,我无法在容器类中使用约束结构。现在,根据我的文本孩子,在等待形成最小值、最大值时,我总是输出 maxwidth、maxheight 值,即使文本内容很少。正如我观看的培训视频中所预期的那样,它根据文本内容给出的最大值增长。但我不能。我的代码并退出:

    body: Center(
      child: Container(
          alignment: AlignmentDirectional.centerStart,
          color: Colors.yellow,
          child: Text(
            "Merhaba",
            style: TextStyle(color: Colors.red, fontSize: 25),
          ),
          constraints: BoxConstraints(
              maxHeight: 300.0,
              maxWidth: 200.0,
              minWidth: 150.0,
              minHeight: 150.0)
      ),
    ),

文本大小为25,结果为: https://i.stack.imgur.com/ZHNTG.png

我试过字体大小为250,结果是:

https://i.stack.imgur.com/W5qWK.png

【问题讨论】:

  • 请输入代码。截图效率不高。
  • 谢谢,我编辑了。

标签: flutter


【解决方案1】:

这取决于文本的字体大小。现在是 25。请设置大于 25 的值以查看您的预期。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-18
  • 2019-08-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多