Skip to content

Commit

Permalink
feat: add CatalystImage
Browse files Browse the repository at this point in the history
  • Loading branch information
minikin committed Nov 16, 2023
1 parent 5bafbc2 commit ece7e56
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
3 changes: 1 addition & 2 deletions catalyst_voices/lib/dummy/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,8 @@ final class HomeScreen extends StatelessWidget {
SizedBox(
height: 200,
width: 200,
child: Image.asset(
child: CatalystImage.asset(
VoicesAssets.images.dummyCatalystVoices.path,
package: 'catalyst_voices_assets',
),
),
],
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import 'package:flutter/widgets.dart';

final class CatalystImage {
static Image asset(
String name, {
AssetBundle? bundle,
ImageFrameBuilder? frameBuilder,
ImageErrorWidgetBuilder? errorBuilder,
String? semanticLabel,
bool excludeFromSemantics = false,
double? scale,
double? width,
double? height,
Color? color,
Animation<double>? opacity,
BlendMode? colorBlendMode,
BoxFit? fit,
Alignment alignment = Alignment.center,
ImageRepeat repeat = ImageRepeat.noRepeat,
Rect? centerSlice,
bool matchTextDirection = false,
bool gaplessPlayback = false,
bool isAntiAlias = false,
String package = 'catalyst_voices_assets',
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,
);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export 'package:catalyst_voices_assets/src/assets.gen.dart';
export 'package:catalyst_voices_assets/src/catalyst_image.dart';
export 'package:catalyst_voices_assets/src/colors.gen.dart';
export 'package:catalyst_voices_assets/src/fonts.gen.dart';

0 comments on commit ece7e56

Please sign in to comment.