首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sliverAppBar的圆角底部

sliverAppBar的圆角底部
EN

Stack Overflow用户
提问于 2020-07-05 22:55:54
回答 2查看 445关注 0票数 1

我想像这样舍入我的sliverAppBar的底部:

但是我不能..。这是我的代码:

代码语言:javascript
复制
Scaffold(
    body: NestedScrollView(
        controller: _scrollController,
        headerSliverBuilder: (BuildContext context, bool boxIsControlled) {
          return <Widget>[
            SliverAppBar(
              
              title: null,
              expandedHeight: MediaQuery.of(context).size.height*0.35,
              floating: true,
              pinned: false,
              snap: true,
              flexibleSpace: Stack(
                children: <Widget>[
                  Positioned.fill(
                      child: Image(
                    image: AssetImage('assets/cafe1.png'),
                    fit: BoxFit.cover,
                  ))
                ],
              ),
            ),
          ];
        },
        body: SingleChildScrollView(
          child: Container(
               ...
        ))));

这是我现在的结果:

:(

EN

回答 2

Stack Overflow用户

发布于 2020-07-06 00:34:15

将此代码添加到SliverAppBar。

代码语言:javascript
复制
 shape: ContinuousRectangleBorder(
      borderRadius: BorderRadius.only(
          topLeft: Radius.circular(30), topRight: Radius.circular(30))),
票数 0
EN

Stack Overflow用户

发布于 2020-09-13 04:08:18

您可以在堆栈中使用DraggableScrollableSheet来获得类似的结果。Example as gif

代码语言:javascript
复制
Stack(
        children: [
          Image(
            width: double.infinity,
            image: NetworkImage("https://picsum.photos/200/300"),
            fit: BoxFit.contain,
          ),
          DraggableScrollableSheet(
              maxChildSize: 0.75,
              minChildSize: 0.2,
              builder: (context, scrollController) {
                return Container(
                  padding: EdgeInsets.symmetric(horizontal: 20),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.vertical(
                          top: Radius.circular(30))),
                  child: SingleChildScrollView(
                    controller: scrollController,
                    child: Column(
                      children: [
                        MovieTitle(),
                        BadgesList(),
                        RatingContainer(),
                        DirectorText(),
                        SizedBox(height: 30),
                        ActorContianer(),
                        Introduction(),
                      ],
                    ),
                  ),
                );
              })
        ],
      ),
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62742320

复制
相关文章

相似问题

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