android - flutter 问题 : overflowed by 61 pixels on the right?

标签 android flutter

我想在 Flutter 中实现一个行 ListView ,或多或少是这样的。 enter image description here

我找到了一个示例代码,并将其修改为:

body: Container(
        child: ListView(
          children: <Widget>[
            Container(
              padding: EdgeInsets.all(10),
              child: Row(
                children: <Widget>[
                  Expanded(
                    child: Container(
                      padding: EdgeInsets.all(15.0),
                      height: 100.0,
                      color: Colors.blue[200],
                      child: Row (
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("Artikel 1", style: TextStyle(color: Colors.white, fontSize: 15.0)),
                          Text("Ini adalah contoh artikel pada listview dengan versi custom", style: TextStyle(color: Colors.white),)
                        ],
                      ),
                    ),
                  )
                ],
              ),
            ),

可以找到完整代码here .

结果如下:

enter image description here

如何修复“右侧溢出 61 像素”错误?

最佳答案

您的问题是 CTRL+C 和 CTRL+V。

第一个容器有一行,应该有一列。

                     child: Row (
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("Artikel 1", style: TextStyle(color: Colors.white, fontSize: 15.0)),
                          Text("Ini adalah contoh artikel pada listview dengan versi custom", style: TextStyle(color: Colors.white),)
                        ],
                      ),

应该是:

                     child: Column (
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          Text("Artikel 1", style: TextStyle(color: Colors.white, fontSize: 15.0)),
                          Text("Ini adalah contoh artikel pada listview dengan versi custom", style: TextStyle(color: Colors.white),)
                        ],
                      ),

关于android - flutter 问题 : overflowed by 61 pixels on the right?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56933671/

相关文章:

android - 在 Android 上进行一键登录和注册时获取 "16: Cannot find a matching credential"

android - 从 URL Google Map API 或 SDK 从搜索区域的特征 ID 获取位置?

javascript - 不使用 jQuery 在 Android WebView 中过滤 DOM 元素

java - 填充 ListView 时 LinearLayout 为 'pushed'

firebase - 如何从Firebase排序数据?在Flutter应用内

android - Android 2.2 和 2.3 之间的内存使用情况

firebase - Firebase实时数据库检查有两个值?

flutter - 遍历列表并使用它初始化另一个变量

ios - flutter ITMS-90809 : Deprecated API Usage - Apple will stop accepting submissions of apps that use UIWebView APIs

plugins - 在 Flutter 中添加蓝牙插件