首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >圆体NestedScrollView的NestedScrollView图像

圆体NestedScrollView的NestedScrollView图像
EN

Stack Overflow用户
提问于 2022-07-21 02:39:15
回答 1查看 152关注 0票数 0

我使用NestedScrollView使可滚动的AppBar类似于图片。问题是,AppBar的背景图片不足以覆盖空白(图片中描述的箭头)。有人能帮我吗?谢谢。

代码语言:javascript
复制
NestedScrollView(
 headerSliverBuilder: (context, innerBoxIsScrolled) {
  return [
    SliverAppBar(
      title: Text(
        "hehe",
        style: TextStyle(color: Colors.white),
      ),
      floating: true,
      expandedHeight: 100,
      forceElevated: innerBoxIsScrolled,
      flexibleSpace: Stack(
        children: <Widget>[
          Positioned.fill(
              child: Image.network(
            "https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350",
            fit: BoxFit.cover,
          ))
        ],
      ),
    )
  ];
},
// Team Dashboard
body: Container(
  width: DataInstance().screenW,
  padding: const EdgeInsets.symmetric(vertical: kDouble_20),
  decoration: BoxDecoration(
      color: Colors.amber,
      borderRadius: BorderRadius.only(
          topLeft: Radius.circular(kDouble_20),
          topRight: Radius.circular(kDouble_20))),
),
)
EN

回答 1

Stack Overflow用户

发布于 2022-07-21 04:33:14

用小部件树顶部的背景图像移动Stack以覆盖整个空间,并为ScaffoldSliverAppBar设置backgroundColor transparent

代码语言:javascript
复制
Stack(
  children: <Widget>[
    Positioned.fill(
        child: Image.network(
      "https://images.pexels.com/photos/396547/pexels-photo-396547.jpeg?auto=compress&cs=tinysrgb&h=350",
      fit: BoxFit.cover,
    )),
    Scaffold(
        backgroundColor: Colors.transparent,
        body: NestedScrollView(
          headerSliverBuilder: (context, innerBoxIsScrolled) {
            return [
              SliverAppBar(
                backgroundColor: Colors.transparent,
...
              )
            ];
          },
          // Team Dashboard
          body: Container(
...
          ),
        ))
  ],
)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73060088

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档