Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter make simple gradient shadow

Tags:

flutter

dart

I want to build a gradient shadow widget as shown below.

enter image description here

This gradient starts from black and end at white, how can I design this type of widget?

like image 627
DolDurma Avatar asked Apr 07 '26 19:04

DolDurma


2 Answers

It can be done like this,

Container(
        height:100,
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: [Colors.black, Colors.white],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter
          )
        ),
      ),

The result is : enter image description here

Are You looking for that result?

like image 62
NoobN3rd Avatar answered Apr 10 '26 07:04

NoobN3rd


You can also try this:

Container(
  height: 200,
  width: 200,
  decoration: BoxDecoration(
    color: Colors.blue,
    boxShadow: [
      BoxShadow(
        color: Colors.black,
        offset: Offset(0, 10),
        blurRadius: 10,
        spreadRadius: 0.5,
      ),
    ],
  ),
)

Output

enter image description here

like image 41
CopsOnRoad Avatar answered Apr 10 '26 09:04

CopsOnRoad



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!