首页 > 解决方案 > 如何在颤振应用程序中剪切列表?

问题描述

我想制作一个笔记应用程序,但遇到了一个问题。当我不滚动列表时,它看起来很棒(对我来说)但是当我滚动它时,绿色背景移动到应用程序的顶部,我想剪切它并制作固定大小。我还想让这个列表更加自定义,在元素之间留出更大的边距并将形式更改为圆角矩形


        body: Stack(
          fit: StackFit.expand,
          children: <Widget>[
            Positioned(
              top: 0.0,
              child: Row(
                children: <Widget>[
                  Container(
                    child: Text(
                      "Notes",
                      style: TextStyle(
                        color: Color.fromRGBO(107, 119, 141, 1),
                        fontSize: 72,
                      ),
                    ),
                  ),
                  Container(
                    margin: EdgeInsets.only(top: 50),
                    child: Text(
                      "Never Settle",
                      style: TextStyle(
                        fontSize: 12,
                        color: Color.fromRGBO(107, 119, 141, 0.25),
                      ),
                    ),
                  ),
                  SizedBox(width: 20),
                  Container(
                    child: Image.asset(
                      'assets/images/magnifier.png',
                      height: 44,
                      width: 44,
                    ),
                  ),
                  SizedBox(width: 30),
                  Container(
                    child: Image.asset(
                      'assets/images/3dot.png',
                      height: 44,
                      width: 44,
                    ),
                  ),
                ],
              ),
            ),
            Positioned(
              top: 75.0,
              child: ListView.builder(
                itemCount: dList.length,
                itemBuilder: (context, index) {
                  return Ink(
                      color: Colors.green,
                      child: ListTile(
                        title: Text(
                          dList[index],
                          style: TextStyle(
                            fontSize: 25,
                          ),
                        ),
                      )
                  );
                },
              ),
            ),
            Positioned(
              height: 55,
              width: 55,
              // top:0.0,
              right: 20.0,
              bottom: 20.0,
              child: Image.asset(
                'assets/images/plus.png',
                height: 22,
                width: 22,
              ),
            ),
          ],
        ),
      ),
    );
  }
}

在此处输入图像描述 在此处输入图像描述

标签: flutterdart

解决方案


将背景颜色设置为绿色 ins 脚手架并将透明颜色设置为链接然后尝试


推荐阅读