Home > Mobile >  How can i make border blur
How can i make border blur

Time:10-19

i have the following simple full code

import 'package:flutter/material.dart';

class A2 extends StatefulWidget {
  const A2({Key? key}) : super(key: key);
  @override
  State<A2> createState() => _A2State();
}

class _A2State extends State<A2> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: ShaderMask(
          shaderCallback: ( bounds) {
            return LinearGradient(
                colors: [Colors.white.withOpacity(0.05),Colors.white],
                stops: const [0.0, 0.09],
                tileMode: TileMode.mirror,
                begin: Alignment.center,
                end: Alignment.center
            ).createShader(bounds);
          },
          child: Container(
            decoration: BoxDecoration(
              border: Border.all(color: Colors.red, width: 100),
            ),
          ),
        )

    );
  }
}

Question : how could i make the borders blur .

i tried to use ShaderMask but the problem i cannot align the blur direction into the required area as shown in the following image

enter image description here

Note: i need only the border who get blur

CodePudding user response:

Not sure if I understood the question correct.

Alternative (imitate a border) is to create a parent container with padding (ex. 2px) and make it blur and in the child container you can put whatever content you like.

Check this package. https://pub.dev/packages/blurrycontainer

CodePudding user response:

Please check this url. I think answer is already there. why didnt check stackoverflaw before add new quection. reffer this

I can't make blurred item with sharp border

  • Related