| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- 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.animLoadingPhoto,
- 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.animLoadingPhoto,
- width: width ?? 140.w,
- height: height ?? 140.w,
- repeat: repeat ?? true))));
- };
- }
- }
|