Flutter-SliverAppBar中的圆角 [英] Flutter - Rounded corners in SliverAppBar

查看:299
本文介绍了Flutter-SliverAppBar中的圆角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Flutter中,您可以使用 shape 属性在 AppBar 小部件中自定义形状,但是 SliverAppBar 小部件

In Flutter you can have custom shape in AppBar widget with shape property, but this property is missing in SliverAppBar widget

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

SliverAppBar 中如何圆角

推荐答案

这是更改SliverAppBar形状的正确且简单的方法(如Flutter文档中所述)。无需您使用任何技巧。

This is the right and easy way to change the shape of a SliverAppBar (As mentioned in Flutter docs). No need you use any tricks. Even you can shape it as any shape you want.

SliverAppBar(
  shape: ContinuousRectangleBorder(
      borderRadius: BorderRadius.only(
          bottomLeft: Radius.circular(30), bottomRight: Radius.circular(30))),
  title: Text('Sliver AppBar'),
);

这篇关于Flutter-SliverAppBar中的圆角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆