1

i have customised Appbar with curved shape but how can i give gradient color to that area?

enter image description here

this is my Appbar code

    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))),
  ),

this is my shape code

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();
}
Marzook
  • 371
  • 1
  • 5
  • 20

1 Answers1

-1

You can not apply gradient color to appbar. Either you can create a custom widget which can be placed as appBar. Refer this anwser

[link]Adding a Gradient Background to Appbar on Flutter