diff --git a/packages/core/lib/generators/assets_generator.dart b/packages/core/lib/generators/assets_generator.dart index 81365ab3..e3322bd8 100644 --- a/packages/core/lib/generators/assets_generator.dart +++ b/packages/core/lib/generators/assets_generator.dart @@ -6,6 +6,7 @@ import 'package:dart_style/dart_style.dart'; import 'package:dartx/dartx.dart'; import 'package:flutter_gen_core/generators/generator_helper.dart'; import 'package:flutter_gen_core/generators/integrations/flare_integration.dart'; +import 'package:flutter_gen_core/generators/integrations/image_integration.dart'; import 'package:flutter_gen_core/generators/integrations/integration.dart'; import 'package:flutter_gen_core/generators/integrations/lottie_integration.dart'; import 'package:flutter_gen_core/generators/integrations/rive_integration.dart'; @@ -60,6 +61,7 @@ String generateAssets( final classesBuffer = StringBuffer(); final integrations = [ + ImageIntegration(config.packageParameterLiteral), if (config.flutterGen.integrations.flutterSvg) SvgIntegration(config.packageParameterLiteral), if (config.flutterGen.integrations.flareFlutter) @@ -162,11 +164,7 @@ String generateAssets( throw 'The value of "flutter_gen/assets/style." is incorrect.'; } - classesBuffer.writeln(_assetGenImageClassDefinition( - config.packageParameterLiteral, - )); - - final imports = {'package:flutter/widgets.dart'}; + final imports = {}; integrations .where((integration) => integration.isEnabled) .forEach((integration) { @@ -254,17 +252,7 @@ _Statement? _createAssetTypeStatement( String name, ) { final childAssetAbsolutePath = join(config.rootPath, assetType.path); - if (assetType.isSupportedImage) { - return _Statement( - type: 'AssetGenImage', - filePath: assetType.path, - name: name, - value: 'AssetGenImage(\'${posixStyle(assetType.path)}\')', - isConstConstructor: true, - isDirectory: false, - needDartDoc: true, - ); - } else if (FileSystemEntity.isDirectorySync(childAssetAbsolutePath)) { + if (FileSystemEntity.isDirectorySync(childAssetAbsolutePath)) { final childClassName = '\$${assetType.path.camelCase().capitalize()}Gen'; return _Statement( type: childClassName, @@ -535,95 +523,6 @@ class $className { '''; } -String _assetGenImageClassDefinition(String packageName) { - final bool isPackage = packageName.isNotEmpty; - final packageParameter = isPackage ? ' = package' : ''; - - final keyName = packageName.isEmpty - ? '_assetName' - : "'packages/$packageName/\$_assetName'"; - - return ''' - -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; -${isPackage ? "\n static const String package = '$packageName';" : ''} - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - ${isPackage ? deprecationMessagePackage : ''} - String? package$packageParameter, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - ${isPackage ? deprecationMessagePackage : ''} - String? package$packageParameter, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => $keyName; -} -'''; -} - class _Statement { const _Statement({ required this.type, diff --git a/packages/core/lib/generators/integrations/flare_integration.dart b/packages/core/lib/generators/integrations/flare_integration.dart index 993734ee..9a85f7f4 100644 --- a/packages/core/lib/generators/integrations/flare_integration.dart +++ b/packages/core/lib/generators/integrations/flare_integration.dart @@ -2,14 +2,13 @@ import 'package:flutter_gen_core/generators/integrations/integration.dart'; import 'package:flutter_gen_core/settings/asset_type.dart'; class FlareIntegration extends Integration { - FlareIntegration(String packageParameterLiteral) - : super(packageParameterLiteral); + FlareIntegration(String packageName) : super(packageName); - String? get packageExpression => - isPackage ? 'packages/$packageParameterLiteral/' : null; + String? get packageExpression => isPackage ? 'packages/$packageName/' : null; @override List get requiredImports => [ + 'package:flutter/widgets.dart', 'package:flare_flutter/flare_actor.dart', 'package:flare_flutter/flare_controller.dart', ]; @@ -21,7 +20,7 @@ class FlareIntegration extends Integration { const FlareGenImage(this._assetName); final String _assetName; -${isPackage ? "\n static const String package = '$packageParameterLiteral';" : ''} +${isPackage ? "\n static const String package = '$packageName';" : ''} FlareActor flare({ String? boundsNode, diff --git a/packages/core/lib/generators/integrations/image_integration.dart b/packages/core/lib/generators/integrations/image_integration.dart new file mode 100644 index 00000000..3afbce2a --- /dev/null +++ b/packages/core/lib/generators/integrations/image_integration.dart @@ -0,0 +1,125 @@ +import 'package:flutter_gen_core/generators/integrations/integration.dart'; +import 'package:flutter_gen_core/settings/asset_type.dart'; + +/// The main image integration, supporting all image asset types. See +/// [isSupport] for the exact supported mime types. +/// +/// This integration is by enabled by default. +class ImageIntegration extends Integration { + ImageIntegration(String packageName) : super(packageName); + + String get packageParameter => isPackage ? ' = package' : ''; + + String get keyName => + isPackage ? "'packages/$packageName/\$_assetName'" : '_assetName'; + + @override + List get requiredImports => ['package:flutter/widgets.dart']; + + @override + String get classOutput => _classDefinition; + + String get _classDefinition => '''class AssetGenImage { + const AssetGenImage(this._assetName); + + final String _assetName; +${isPackage ? "\n static const String package = '$packageName';" : ''} + + Image image({ + Key? key, + AssetBundle? bundle, + ImageFrameBuilder? frameBuilder, + ImageErrorWidgetBuilder? errorBuilder, + String? semanticLabel, + bool excludeFromSemantics = false, + double? scale, + double? width, + double? height, + Color? color, + Animation? opacity, + BlendMode? colorBlendMode, + BoxFit? fit, + AlignmentGeometry alignment = Alignment.center, + ImageRepeat repeat = ImageRepeat.noRepeat, + Rect? centerSlice, + bool matchTextDirection = false, + bool gaplessPlayback = false, + bool isAntiAlias = false, + ${isPackage ? deprecationMessagePackage : ''} + String? package$packageParameter, + FilterQuality filterQuality = FilterQuality.low, + int? cacheWidth, + int? cacheHeight, + }) { + return Image.asset( + _assetName, + key: key, + bundle: bundle, + frameBuilder: frameBuilder, + errorBuilder: errorBuilder, + semanticLabel: semanticLabel, + excludeFromSemantics: excludeFromSemantics, + scale: scale, + width: width, + height: height, + color: color, + opacity: opacity, + colorBlendMode: colorBlendMode, + fit: fit, + alignment: alignment, + repeat: repeat, + centerSlice: centerSlice, + matchTextDirection: matchTextDirection, + gaplessPlayback: gaplessPlayback, + isAntiAlias: isAntiAlias, + package: package, + filterQuality: filterQuality, + cacheWidth: cacheWidth, + cacheHeight: cacheHeight, + ); + } + + ImageProvider provider({ + AssetBundle? bundle, + ${isPackage ? deprecationMessagePackage : ''} + String? package$packageParameter, + }) { + return AssetImage( + _assetName, + bundle: bundle, + package: package, + ); + } + + String get path => _assetName; + + String get keyName => $keyName; +} +'''; + + @override + String get className => 'AssetGenImage'; + + @override + String classInstantiate(String path) => 'AssetGenImage(\'$path\')'; + + @override + bool isSupport(AssetType type) { + /// Flutter official supported image types. See + /// https://api.flutter.dev/flutter/widgets/Image-class.html + switch (type.mime) { + case 'image/jpeg': + case 'image/png': + case 'image/gif': + case 'image/bmp': + case 'image/vnd.wap.wbmp': + case 'image/webp': + return true; + default: + return false; + } + } + + @override + bool get isConstConstructor => true; +} diff --git a/packages/core/lib/generators/integrations/integration.dart b/packages/core/lib/generators/integrations/integration.dart index 6ccd283f..9776e5b4 100644 --- a/packages/core/lib/generators/integrations/integration.dart +++ b/packages/core/lib/generators/integrations/integration.dart @@ -1,10 +1,13 @@ import 'package:flutter_gen_core/settings/asset_type.dart'; +/// A base class for all integrations. An integration is a class that +/// generates code for a specific asset type. abstract class Integration { - Integration(this.packageParameterLiteral); + Integration(this.packageName); - final String packageParameterLiteral; - late final bool isPackage = packageParameterLiteral.isNotEmpty; + /// The package name for this asset. If empty, the asset is not in a package. + final String packageName; + late final bool isPackage = packageName.isNotEmpty; bool isEnabled = false; @@ -16,6 +19,7 @@ abstract class Integration { String classInstantiate(String path); + /// Is this asset type supported by this integration? bool isSupport(AssetType type); bool get isConstConstructor; diff --git a/packages/core/lib/generators/integrations/lottie_integration.dart b/packages/core/lib/generators/integrations/lottie_integration.dart index 7d8fa4db..1238c5bd 100644 --- a/packages/core/lib/generators/integrations/lottie_integration.dart +++ b/packages/core/lib/generators/integrations/lottie_integration.dart @@ -7,8 +7,7 @@ import 'package:path/path.dart' as p; import 'package:pub_semver/pub_semver.dart'; class LottieIntegration extends Integration { - LottieIntegration(String packageParameterLiteral) - : super(packageParameterLiteral); + LottieIntegration(String packageName) : super(packageName); // These are required keys for this integration. static const lottieKeys = [ @@ -25,6 +24,7 @@ class LottieIntegration extends Integration { @override List get requiredImports => [ + 'package:flutter/widgets.dart', 'package:lottie/lottie.dart', ]; @@ -35,7 +35,7 @@ class LottieIntegration extends Integration { const LottieGenImage(this._assetName); final String _assetName; -${isPackage ? "\n static const String package = '$packageParameterLiteral';" : ''} +${isPackage ? "\n static const String package = '$packageName';" : ''} LottieBuilder lottie({ Animation? controller, @@ -89,7 +89,7 @@ ${isPackage ? "\n static const String package = '$packageParameterLiteral';" : String get path => _assetName; - String get keyName => ${isPackage ? '\'packages/$packageParameterLiteral/\$_assetName\'' : '_assetName'}; + String get keyName => ${isPackage ? '\'packages/$packageName/\$_assetName\'' : '_assetName'}; }'''; @override diff --git a/packages/core/lib/generators/integrations/rive_integration.dart b/packages/core/lib/generators/integrations/rive_integration.dart index 7280e9b6..ebd982a7 100644 --- a/packages/core/lib/generators/integrations/rive_integration.dart +++ b/packages/core/lib/generators/integrations/rive_integration.dart @@ -2,14 +2,13 @@ import 'package:flutter_gen_core/generators/integrations/integration.dart'; import 'package:flutter_gen_core/settings/asset_type.dart'; class RiveIntegration extends Integration { - RiveIntegration(String packageParameterLiteral) - : super(packageParameterLiteral); + RiveIntegration(String packageName) : super(packageName); - String? get packageExpression => - isPackage ? 'packages/$packageParameterLiteral/' : null; + String? get packageExpression => isPackage ? 'packages/$packageName/' : null; @override List get requiredImports => [ + 'package:flutter/widgets.dart', 'package:rive/rive.dart', ]; @@ -20,7 +19,7 @@ class RiveIntegration extends Integration { const RiveGenImage(this._assetName); final String _assetName; -${isPackage ? "\n static const String package = '$packageParameterLiteral';" : ''} +${isPackage ? "\n static const String package = '$packageName';" : ''} RiveAnimation rive({ String? artboard, diff --git a/packages/core/lib/generators/integrations/svg_integration.dart b/packages/core/lib/generators/integrations/svg_integration.dart index 9a97bf6c..a9fd1438 100644 --- a/packages/core/lib/generators/integrations/svg_integration.dart +++ b/packages/core/lib/generators/integrations/svg_integration.dart @@ -2,13 +2,13 @@ import 'package:flutter_gen_core/generators/integrations/integration.dart'; import 'package:flutter_gen_core/settings/asset_type.dart'; class SvgIntegration extends Integration { - SvgIntegration(String packageParameterLiteral) - : super(packageParameterLiteral); + SvgIntegration(String packageName) : super(packageName); String get packageExpression => isPackage ? ' = package' : ''; @override List get requiredImports => [ + 'package:flutter/widgets.dart', 'package:flutter_svg/flutter_svg.dart', 'package:flutter/services.dart', ]; @@ -21,7 +21,7 @@ class SvgIntegration extends Integration { final String _assetName; - ${isPackage ? "static const String package = '$packageParameterLiteral';" : ''} + ${isPackage ? "static const String package = '$packageName';" : ''} SvgPicture svg({ Key? key, @@ -69,7 +69,7 @@ class SvgIntegration extends Integration { String get path => _assetName; - String get keyName => ${isPackage ? '\'packages/$packageParameterLiteral/\$_assetName\'' : '_assetName'}; + String get keyName => ${isPackage ? '\'packages/$packageName/\$_assetName\'' : '_assetName'}; }'''; @override diff --git a/packages/core/lib/settings/asset_type.dart b/packages/core/lib/settings/asset_type.dart index 17418173..a2345467 100644 --- a/packages/core/lib/settings/asset_type.dart +++ b/packages/core/lib/settings/asset_type.dart @@ -15,21 +15,6 @@ class AssetType { String? get mime => lookupMimeType(path); - /// https://api.flutter.dev/flutter/widgets/Image-class.html - bool get isSupportedImage { - switch (mime) { - case 'image/jpeg': - case 'image/png': - case 'image/gif': - case 'image/bmp': - case 'image/vnd.wap.wbmp': - case 'image/webp': - return true; - default: - return false; - } - } - bool get isIgnoreFile { switch (baseName) { case '.DS_Store': diff --git a/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart index 094bb4b2..231614e7 100644 --- a/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_flare_integrations.gen.dart @@ -27,80 +27,6 @@ class Assets { static const $AssetsFlareGen flare = $AssetsFlareGen(); } -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} - class FlareGenImage { const FlareGenImage(this._assetName); diff --git a/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart b/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart index 37597e2e..7c3a0bd0 100644 --- a/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart +++ b/packages/core/test_resources/actual_data/assets_ignore_files.gen.dart @@ -7,8 +7,6 @@ // ignore_for_file: type=lint // ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use -import 'package:flutter/widgets.dart'; - class $AssetsUnknownGen { const $AssetsUnknownGen(); } @@ -18,77 +16,3 @@ class Assets { static const $AssetsUnknownGen unknown = $AssetsUnknownGen(); } - -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} diff --git a/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart index 6a12a9bd..abde7ee9 100644 --- a/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_lottie_integrations.gen.dart @@ -27,80 +27,6 @@ class Assets { static const $AssetsLottieGen lottie = $AssetsLottieGen(); } -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} - class LottieGenImage { const LottieGenImage(this._assetName); diff --git a/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart index 52672c15..fca1aba4 100644 --- a/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_rive_integrations.gen.dart @@ -26,80 +26,6 @@ class Assets { static const $AssetsRiveGen rive = $AssetsRiveGen(); } -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} - class RiveGenImage { const RiveGenImage(this._assetName); diff --git a/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart b/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart index 1ae7a916..35fb44d8 100644 --- a/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart +++ b/packages/core/test_resources/actual_data/assets_svg_integrations.gen.dart @@ -38,80 +38,6 @@ class Assets { static const $AssetsImagesGen images = $AssetsImagesGen(); } -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -} - class SvgGenImage { const SvgGenImage(this._assetName); diff --git a/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart b/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart index 194ad81f..1d37ae2a 100644 --- a/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart +++ b/packages/core/test_resources/actual_data/assets_unknown_mime_type.gen.dart @@ -7,8 +7,6 @@ // ignore_for_file: type=lint // ignore_for_file: directives_ordering,unnecessary_import,implicit_dynamic_list_literal,deprecated_member_use -import 'package:flutter/widgets.dart'; - class $AssetsUnknownGen { const $AssetsUnknownGen(); @@ -24,77 +22,3 @@ class Assets { static const $AssetsUnknownGen unknown = $AssetsUnknownGen(); } - -class AssetGenImage { - const AssetGenImage(this._assetName); - - final String _assetName; - - Image image({ - Key? key, - AssetBundle? bundle, - ImageFrameBuilder? frameBuilder, - ImageErrorWidgetBuilder? errorBuilder, - String? semanticLabel, - bool excludeFromSemantics = false, - double? scale, - double? width, - double? height, - Color? color, - Animation? opacity, - BlendMode? colorBlendMode, - BoxFit? fit, - AlignmentGeometry alignment = Alignment.center, - ImageRepeat repeat = ImageRepeat.noRepeat, - Rect? centerSlice, - bool matchTextDirection = false, - bool gaplessPlayback = false, - bool isAntiAlias = false, - String? package, - FilterQuality filterQuality = FilterQuality.low, - int? cacheWidth, - int? cacheHeight, - }) { - return Image.asset( - _assetName, - key: key, - bundle: bundle, - frameBuilder: frameBuilder, - errorBuilder: errorBuilder, - semanticLabel: semanticLabel, - excludeFromSemantics: excludeFromSemantics, - scale: scale, - width: width, - height: height, - color: color, - opacity: opacity, - colorBlendMode: colorBlendMode, - fit: fit, - alignment: alignment, - repeat: repeat, - centerSlice: centerSlice, - matchTextDirection: matchTextDirection, - gaplessPlayback: gaplessPlayback, - isAntiAlias: isAntiAlias, - package: package, - filterQuality: filterQuality, - cacheWidth: cacheWidth, - cacheHeight: cacheHeight, - ); - } - - ImageProvider provider({ - AssetBundle? bundle, - String? package, - }) { - return AssetImage( - _assetName, - bundle: bundle, - package: package, - ); - } - - String get path => _assetName; - - String get keyName => _assetName; -}