Skip to content

Commit

Permalink
chore: Replace static asset method for CatalystSvgPicture and Catal…
Browse files Browse the repository at this point in the history
…ystImage.
  • Loading branch information
coire1 committed May 17, 2024
1 parent 28e4025 commit 6f249e0
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:flutter/widgets.dart';

/// [CatalystImage] is a wrapper around [Image.asset] that sets the package
/// property to `catalyst_voices_assets` by default.
/// This allows the package to be used without having to specify
/// the package name every time.
/// [CatalystImage] extends [Image] to have an asset constructor
/// tat sets the package property to `catalyst_voices_assets` by default.
/// This allows to use the asset without having to specify the package name
/// every time.
/// For more information, see [Image.asset].
final class CatalystImage {
static Image asset(
final class CatalystImage extends Image {
CatalystImage.asset(
String name, {
AssetBundle? bundle,
ImageFrameBuilder? frameBuilder,
Expand All @@ -30,31 +30,29 @@ final class CatalystImage {
FilterQuality filterQuality = FilterQuality.low,
int? cacheWidth,
int? cacheHeight,
}) {
return Image.asset(
name,
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,
filterQuality: filterQuality,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
package: package,
);
}
}) : super.asset(
name,
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,
filterQuality: filterQuality,
cacheWidth: cacheWidth,
cacheHeight: cacheHeight,
package: package,
);
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_svg/flutter_svg.dart';

/// [CatalystSvgPicture] is a wrapper around [SvgPicture.asset] that sets the
/// package property to `catalyst_voices_assets` by default.
/// [CatalystSvgPicture] extends [SvgPicture] to have an asset constructor
/// tat sets the package property to `catalyst_voices_assets` by default.
/// This allows to use the asset without having to specify the package name
/// every time.
/// For more information, see [SvgPicture.asset].
final class CatalystSvgPicture {
static SvgPicture asset(
final class CatalystSvgPicture extends SvgPicture {
CatalystSvgPicture.asset(
String name, {
AssetBundle? bundle,
String? semanticsLabel,
Expand All @@ -23,23 +23,21 @@ final class CatalystSvgPicture {
Clip clipBehavior = Clip.hardEdge,
SvgTheme? theme,
ColorFilter? colorFilter,
}) {
return SvgPicture.asset(
name,
bundle: bundle,
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
width: width,
height: height,
fit: fit,
alignment: alignment,
matchTextDirection: matchTextDirection,
package: package,
allowDrawingOutsideViewBox: allowDrawingOutsideViewBox,
placeholderBuilder: placeholderBuilder,
clipBehavior: clipBehavior,
theme: theme,
colorFilter: colorFilter,
);
}
}) : super.asset(
name,
bundle: bundle,
semanticsLabel: semanticsLabel,
excludeFromSemantics: excludeFromSemantics,
width: width,
height: height,
fit: fit,
alignment: alignment,
matchTextDirection: matchTextDirection,
package: package,
allowDrawingOutsideViewBox: allowDrawingOutsideViewBox,
placeholderBuilder: placeholderBuilder,
clipBehavior: clipBehavior,
theme: theme,
colorFilter: colorFilter,
);
}

0 comments on commit 6f249e0

Please sign in to comment.