颤动 - SliverAppBar中的圆角

问题描述 投票:1回答:1

在Flutter中,您可以在具有shape属性的AppBar小部件中使用自定义形状,但SliverAppBar小部件中缺少此属性

  AppBar(
    title: Text('Hello'),
    shape: RoundedRectangleBorder(
      borderRadius: BorderRadius.vertical(
        bottom: Radius.circular(30),
      ),
    ),
  ),

如何在SliverAppBar中使用圆角?

enter image description here

dart flutter
1个回答
0
投票

我使用BorderRadius小部件实现了这种设计。

Container(
        height: 75.0,
        child: Center(child: new Text("Hello",
          textAlign: TextAlign.center,
          style: TextStyle(
            height: 2.5,
            color: Colors.white,
            fontSize: 18.0,
          ),
        )),
        decoration: new BoxDecoration(
          color: Colors.blue,
          boxShadow: [new BoxShadow(blurRadius: 3.0)],
          borderRadius: BorderRadius.vertical(bottom: Radius.circular(19.0)),
        ),
      ),

enter image description here

这不会给你视差滚动功能

© www.soinside.com 2019 - 2024. All rights reserved.