小编Ran*_*ndy的帖子

颤动中的自动扩展容器——适用于所有设备

我需要一个带有一些文本的容器来自动展开。我有一个 API 调用,可以是 5 个字到 500 个字。我不想只有 1 个很大的固定大小,但包含 10 个单词。

我试过 Expanded() 和 SizedBox.Expand(),但我可能用错了它们

Card( 
 elevation: defaultTargetPlatform ==
      TargetPlatform.android ? 5.0 : 0.0,
  child: Column(
    children: <Widget>[
      Container(
        margin: const EdgeInsets.all(0.0),
        padding: const EdgeInsets.all(2.0),
        decoration: BoxDecoration(color: Colors.black),
        width: _screenSize.width,
        height: 250,
        child: Column(
          children: <Widget>[
            Container(
              color: Colors.black,
              width: _screenSize.width,
              height: 35,
              child: Padding(
                padding: const EdgeInsets.only(
                    left: 15, top: 11),
                child: Text("Title".toUpperCase(),
                  style: TextStyle(
                      color: Colors.white
                  ),
                ),
              ),
            ),
            Container(
              color: Colors.white,
              width: _screenSize.width,
              height: 210,
              child: …
Run Code Online (Sandbox Code Playgroud)

expand containers flutter

10
推荐指数
4
解决办法
5万
查看次数

标签 统计

containers ×1

expand ×1

flutter ×1