flutterdartuser-interfaceeffect

How to create a "Layer Blur" effect figma on circle shaped container in Flutter?


How to replicate Figma layer blur effect on a container with a circle shaped in Flutter?

I have a design in Figma that has a layer blur effect applied on a circle. Please refer to the image below for more details. [image]

I tried using the Blur widget from the blur package in Flutter, but it doesn't create the same effect as in Figma. Here's the code that I'm using:

  @override
  Widget build(BuildContext context) {
    var height = MediaQuery.of(context).size.height;
    return Scaffold(
      body: Stack(
        children: [
          Blur(
            blur: 10,
            borderRadius: BorderRadius.circular(180),
            blurColor: Color.fromARGB(255, 10, 14, 81),
            child: Container(
              width: 302,
              height: 302,
              decoration: const BoxDecoration(
                shape: BoxShape.circle,
              ),
            ),
          ),
        ],
      ),
    );
  }

Here is the result of my code: enter image description here


Solution

  • U don't need to use Blur package if u have the color *(Blur package works better as img background ). What u r trying to achieve can be done in 2 ways

    1: Container(
          height:80,
          width:80,
          decoration: const BoxDecoration(
            shape:BoxShape.circle,
            boxShadow:  [
              BoxShadow(blurRadius: 30, spreadRadius: 2, color: Colors.red)
            ],
          ),
        )
    2. Container(
          height:80,
          width:80,
          decoration: const BoxDecoration(
            shape:BoxShape.circle,
            gradient: const RadialGradient(colors: [
                 Colors.red,
                 Colors.red.withOpacity(.5),
                 Colors.red.withOpacity(.1),
             ]),
          ),
        )