import 'package:flutter/Material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:lottie/lottie.dart'; import '../resource/assets.gen.dart'; class Styles { Styles._(); static ImageFrameBuilder? animFrameBuilder({ double? opacity, double? width, double? height, bool? repeat, }) { return (context, child, frame, wasSynchronouslyLoaded) { if (wasSynchronouslyLoaded) { return child; } return AnimatedSwitcher( duration: const Duration(milliseconds: 0), child: frame != null ? child : Center( child: Opacity( opacity: opacity ?? 0.22, child: Lottie.asset(Assets.anim.animNoPhoto, width: width ?? 140.w, height: height ?? 140.w, repeat: repeat ?? true), ))); }; } static ImageFrameBuilder? customFrameBuilder({ double? opacity, double? width, double? height, bool? repeat, }) { return (context, child, frame, wasSynchronouslyLoaded) { if (wasSynchronouslyLoaded) { return child; } return AnimatedSwitcher( duration: const Duration(milliseconds: 0), child: frame != null ? child : Center( child: Opacity( opacity: opacity ?? 0.22, child: Lottie.asset(Assets.anim.animNoPhoto, width: width ?? 140.w, height: height ?? 140.w, repeat: repeat ?? true)))); }; } }