Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter animated BackDropFilter

I wanted to know if it was possible to add blur on a screen with fade in and fade out. Do you have any idea ? I'm currently using BackDropFilter to blur my screen but it doesn't fade when appear...

like image 991
Simon B Avatar asked Aug 01 '26 07:08

Simon B


1 Answers

You can animate the sigma values for blur,

TweenAnimationBuilder<double>(
  tween: Tween<double>(begin: 0.0, end: 15.0),
  duration: const Duration(milliseconds: 500),
  builder: (_, value, child) {
    return BackdropFilter(
      filter: ImageFilter.blur(sigmaX: value, sigmaY: value),
      child: child,
    );
  },
  child: DecoratedBox(
  decoration: BoxDecoration(
    color: Colors.white.withOpacity(0.5),
  ),
),

https://api.flutter.dev/flutter/widgets/TweenAnimationBuilder-class.html

like image 110
Damon Avatar answered Aug 03 '26 15:08

Damon