小编sha*_*har的帖子

控制列表视图中元素的宽度 - flutter

我创建了一个列表视图,包含 3 个 TextFields ,问题是 ofc ,它们扩展到所有屏幕宽度。

我试过,用容器包装它们并设置宽度,然后用 LimitedBox 包装它并设置 maxWidth - 它们都不起作用我如何控制 Listview 内部文本字段的宽度,或者请另一种方式来完成它。我已经添加了文本字段之一,并尝试调整其宽度谢谢

ListView(
          children: <Widget>[
            LimitedBox(
              maxWidth: 50,
              child: Container(
                width: 50,
                child: TextFormField(
                  style: TextStyle(color: Colors.white),
                  decoration: InputDecoration(
                      hintText: 'you@example.com',
                      hintStyle: TextStyle(fontSize: 10, color: Colors.white),
                      labelText: 'E-mail adress',
                      labelStyle: TextStyle(
                        color: Colors.white,
                      )),
                ),
              ),
            ),
Run Code Online (Sandbox Code Playgroud)

),

listview flutter

5
推荐指数
1
解决办法
1434
查看次数

标签 统计

flutter ×1

listview ×1