简体   繁体   English

flutter 中 SliverAppBar 上的圆形边框

[英]Rounded borders on SliverAppBar in flutter

How do you make rounded bottom-corners on a SliverAppBar?如何在 SliverAppBar 上制作圆角底角? I know of 2 ways, but they just don't quite cut it.我知道 2 种方法,但他们只是不完全削减它。

1: To use "shape: ContinuousRectangleBorder". 1:使用“形状:ContinuousRectangleBorder”。 The reason this doesn't cut it, is because it's not Circular, but this weird square-circle thing, so it doesn't look the right way.之所以没有剪掉它,是因为它不是圆形的,而是这个奇怪的方形圆形东西,所以它看起来不正确。 If it's possible to make it with this, and still retain the roundness to it, then please comment that:)如果可以做到这一点,并且仍然保持圆度,那么请评论:)

2: To make a container with rounded corners in the SliverAppBar. 2:在 SliverAppBar 中制作一个圆角的容器。 This is not quite it, because then when you scroll it disappears really early, and you just left with this empty white space in the top of the screen.这不完全是,因为当你滚动它时它很早就消失了,你只是在屏幕顶部留下了这个空白区域。

If you have any idea, please help.如果您有任何想法,请提供帮助。 And remember this is a SliverAppBar, not a normal AppBar, there it would be easy.请记住,这是一个 SliverAppBar,而不是普通的 AppBar,这很容易。

The first way is the better and recommended way.第一种方法是更好和推荐的方法。 You can use RoundedRectangleBorder instead of ContinuousRectangleBorder您可以使用RoundedRectangleBorder代替ContinuousRectangleBorder

You can also visit: https://api.flutter.dev/flutter/painting/RoundedRectangleBorder-class.html也可以访问: https://api.flutter.dev/flutter/painting/RoundedRectangleBorder-class.html

You can also check: https://api.flutter.dev/flutter/painting/CircleBorder-class.html for CircleBorder您还可以查看: https://api.flutter.dev/flutter/painting/CircleBorder-class.html for CircleBorder

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM