【发布时间】:2021-02-02 01:13:04
【问题描述】:
我已经定制了具有弯曲形状的 Appbar,但是我如何为该区域赋予渐变颜色?
这是我的应用条码
appBar: AppBar(
elevation: 5.0,
backgroundColor: Colors.blue,
centerTitle: true,
shape: Cuvedshape(curveheights),
title: Container(
margin: EdgeInsets.only(top: 25),
child: Text("text",
textAlign: TextAlign.end,
style: TextStyle(
letterSpacing: 2,
fontSize: SizeConfig.safeBlockHorizontal * 8,
color: Colors.white,
fontFamily: Constants.FONT_ROBOTO,
fontWeight: FontWeight.bold))),
),
这是我的形状代码
class Cuvedshape extends ContinuousRectangleBorder {
const Cuvedshape(this.curveheights);
final double curveheights;
@override
Path getOuterPath(Rect rect, {TextDirection textDirection}) => Path()
..lineTo(0, rect.size.height)
..quadraticBezierTo(rect.size.width / 2,
rect.size.height + curveheights * 2, rect.size.width, rect.size.height)
..lineTo(rect.size.width, 0)
..close();
}
【问题讨论】:
标签: android ios flutter dart flutter-layout