29 lines
691 B
Dart
29 lines
691 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
|
class AnimatedBlur extends StatelessWidget {
|
|
final Animation animation;
|
|
final double multiplier;
|
|
final Widget? child;
|
|
const AnimatedBlur({
|
|
Key? key,
|
|
required this.animation,
|
|
required this.multiplier,
|
|
this.child,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedBuilder(
|
|
animation: animation,
|
|
child: child,
|
|
builder: (context, child) {
|
|
final sigma = animation.value * multiplier;
|
|
return BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: sigma, sigmaY: sigma),
|
|
child: child);
|
|
});
|
|
}
|
|
}
|