0

我正在尝试实现一个布局,其中 Sliver App Bar 在展开时具有圆角底角,但是当它折叠时我不想要那些圆角。

实际行为:

在此处输入图像描述

在此处输入图像描述

在此处输入图像描述

预期行为:

在此处输入图像描述

在此处输入图像描述

这是我的 SliverAppBar 代码:

`SliverAppBar(
          systemOverlayStyle: const SystemUiOverlayStyle(
            statusBarColor: Color(0xFFE0E64B),
          ),
          backgroundColor: Color(0xFFE0E64B),
          expandedHeight: 300.0,
          floating: false,
          pinned: true,
          collapsedHeight: 60.0,
          onStretchTrigger: () async {
            setState(() {});
          },
          title: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: const [
              Text(
                'Pokedex',
                style: TextStyle(
                  color: Colors.white,
                ),
              ),
              Text(
                '#025',
                style: TextStyle(
                  color: Colors.white,
                ),
              ),
            ],
          ),
          flexibleSpace: FlexibleSpaceBar(
            collapseMode: CollapseMode.parallax,
            background: Container(
              decoration: const BoxDecoration(
                color: Color(0xFFE0E64B),
                borderRadius: BorderRadius.only(
                  bottomLeft: Radius.circular(50.0),
                  bottomRight: Radius.circular(50.0),
                ),
              ),
              child: Hero(
                tag: 'pokemon_container$index',
                child: Column(
                  children: [
                    const SizedBox(
                      height: 120.0,
                    ),
                    Expanded(
                      child: ClipRRect(
                        child: Image.network(
                          imageUrl,
                          fit: BoxFit.scaleDown,
                        ),
                      ),
                    ),
                    const SizedBox(
                      height: 30.0,
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),`
4

1 回答 1

0
 shape: ContinuousRectangleBorder(
              borderRadius: BorderRadius.only(
                  bottomLeft: Radius.circular(30),
                  bottomRight: Radius.circular(30))),

这是你的代码。把它放在 sliverAppBar 里面

于 2022-01-22T19:27:17.053 回答