feat(app): Вынести инициализацию приложения за splash (#4)

Co-authored-by: PetrovY <y.petrov@friflex.com>
This commit is contained in:
Yuri Petrov
2025-02-12 10:53:38 +03:00
committed by GitHub
parent 0a7452e1eb
commit af3b941711
18 changed files with 503 additions and 155 deletions

View File

@@ -10,6 +10,7 @@
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart' as _svg;
import 'package:lottie/lottie.dart' as _lottie;
import 'package:vector_graphics/vector_graphics.dart' as _vg;
class $AssetsFontsGen {
@@ -50,11 +51,23 @@ class $AssetsIconsGen {
List<SvgGenImage> get values => [home];
}
class $AssetsLottieGen {
const $AssetsLottieGen();
/// File path: assets/lottie/splash.json
LottieGenImage get splash =>
const LottieGenImage('assets/lottie/splash.json');
/// List of all assets
List<LottieGenImage> get values => [splash];
}
class Assets {
Assets._();
static const $AssetsFontsGen fonts = $AssetsFontsGen();
static const $AssetsIconsGen icons = $AssetsIconsGen();
static const $AssetsLottieGen lottie = $AssetsLottieGen();
}
class SvgGenImage {
@@ -133,3 +146,70 @@ class SvgGenImage {
String get keyName => _assetName;
}
class LottieGenImage {
const LottieGenImage(
this._assetName, {
this.flavors = const {},
});
final String _assetName;
final Set<String> flavors;
_lottie.LottieBuilder lottie({
Animation<double>? controller,
bool? animate,
_lottie.FrameRate? frameRate,
bool? repeat,
bool? reverse,
_lottie.LottieDelegates? delegates,
_lottie.LottieOptions? options,
void Function(_lottie.LottieComposition)? onLoaded,
_lottie.LottieImageProviderFactory? imageProviderFactory,
Key? key,
AssetBundle? bundle,
Widget Function(
BuildContext,
Widget,
_lottie.LottieComposition?,
)? frameBuilder,
ImageErrorWidgetBuilder? errorBuilder,
double? width,
double? height,
BoxFit? fit,
AlignmentGeometry? alignment,
String? package,
bool? addRepaintBoundary,
FilterQuality? filterQuality,
void Function(String)? onWarning,
}) {
return _lottie.Lottie.asset(
_assetName,
controller: controller,
animate: animate,
frameRate: frameRate,
repeat: repeat,
reverse: reverse,
delegates: delegates,
options: options,
onLoaded: onLoaded,
imageProviderFactory: imageProviderFactory,
key: key,
bundle: bundle,
frameBuilder: frameBuilder,
errorBuilder: errorBuilder,
width: width,
height: height,
fit: fit,
alignment: alignment,
package: package,
addRepaintBoundary: addRepaintBoundary,
filterQuality: filterQuality,
onWarning: onWarning,
);
}
String get path => _assetName;
String get keyName => _assetName;
}