How to add a neon glow effect to an widget border / shadow?

后端 未结 2 1580
無奈伤痛
無奈伤痛 2021-01-13 05:51

Is there any way to create effects like these using flutter (a CustomPaint with a special shadder or something like this)?

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 06:22

    use boxShadow property twice inside Container widget decoration. for outer glow use spreadRadius positive value and for inner glow use negetive value. sample code is given below..

    Container(
        decoration: BoxDecoration(
            borderRadius: BorderRadius.all(
              Radius.circular(18.0),
            ),
            color: Colors.white,
            boxShadow: [
              BoxShadow(
                color: Colors.pink,
                spreadRadius: 4,
                blurRadius: 10,
                offset: Offset(0, 0),
              ),
               BoxShadow(
                color: Colors.pink,
                spreadRadius: -4,
                blurRadius: 5,
                offset: Offset(0, 0),
              )
            ]),
        child: FlatButton(
          onPressed:(){},
          child: Text("submit"),
          
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(18.0),
          ),
        ),
      ),
    

提交回复
热议问题