I have a curved AppBar using the following code.
I want to add a shadow right beneath the curve.
Any help would be much appreciated!
image of curved AppBar
Code:
appBar: PreferredSize(
preferredSize: const Size.fromHeight(85.0),
child: AppBar(
title: const Text("Services"),
flexibleSpace: ClipPath(
clipper: Customshape(),
child: Container(
height: 250,
width: MediaQuery.of(context).size.width,
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
stops: [0.1, 0.55],
colors: <Color>[Color(0xff21CDAF), Color(0xff1093BC)],
),
),
),
),
),
),
class Customshape extends CustomClipper<Path> {
@override
Path getClip(Size size) {
double height = size.height;
double width = size.width;
var path = Path();
path.lineTo(0, height - 50);
path.quadraticBezierTo(width / 2, height, width, height - 50);
path.lineTo(width, 0);
path.close();
return path;
}
@override
bool shouldReclip(covariant CustomClipper<Path> oldClipper) {
return true;
}
}
I tried wrapping the container with a material widget and adding a box shadow to box decoration but neither worked.
2
Answers
to achieve the shadow you can use
you can also modify the toolbarHeight and toolbarOpacity to achieve the shadow effect
if you need further assistance i will be happy to help more!
You can use this
Custom Widget
:And use it as:
Output: