This commit is contained in:
2025-03-05 12:27:00 +02:00
parent 7654acd887
commit 0f99ba21a7

View File

@@ -57,23 +57,23 @@ class AstromicImage extends StatelessWidget {
this.assetBytes,
this.assetFallback,
//
this.sizingMaster ,
this.sizingMaster = ImageSizingMaster.w,
this.widthSizing,
this.heightSizing,
this.fixedWidth,
this.fixedHeight,
//
this.isCircular,
this.isCircular = false,
this.borderWidth,
this.borderColor,
this.borderPadding,
this.radius,
this.radius = BorderRadius.zero,
this.shadow,
this.overlayColor,
this.overlayGradient,
//
this.fit,
this.alignment,
this.fit = BoxFit.contain,
this.alignment = Alignment.center,
this.blendMode,
this.fadeInCurve,
this.fadeInDuration,
@@ -83,18 +83,23 @@ class AstromicImage extends StatelessWidget {
this.loadingWidget,
this.errorWidget,
}) :
// Assert that a source is provided, or provide a fallback source..
assert(((assetPath?.isNotEmpty ?? false) || (assetURL?.isNotEmpty ?? false) || (assetBytes?.isNotEmpty ?? false)) || (assetFallback?.isNotEmpty ?? false),
'Please specify a source or provide a fallback.'),
// Assert that only ONE source is provided...
// Assert that a source is provided, or provide a fallback source.
assert(
((assetPath?.isNotEmpty ?? false) || (assetURL?.isNotEmpty ?? false) || (assetBytes?.isNotEmpty ?? false)) || (assetFallback?.isNotEmpty ?? false),
'Please specify a source or provide a fallback.',
),
// Assert that only ONE source is provided.
assert(
(assetPath != null && assetBytes == null && assetURL == null) ||
(assetPath == null && assetBytes != null && assetURL == null) ||
(assetPath == null && assetBytes == null && assetURL != null),
'Please specify only ONE Asset Source'),
// Assert that correct sizing plan is provided...
assert((sizingMaster == ImageSizingMaster.w && (widthSizing != null || fixedWidth != null)) || (sizingMaster == ImageSizingMaster.h && (heightSizing != null || fixedHeight != null)),
'Please provide the correct sizing configurations based on the SizingMaster choosen');
'Please specify only ONE Asset Source.',
),
// Assert that correct sizing plan is provided.
assert(
(sizingMaster == ImageSizingMaster.w && (widthSizing != null || fixedWidth != null)) || (sizingMaster == ImageSizingMaster.h && (heightSizing != null || fixedHeight != null)),
'Please provide the correct sizing configurations based on the SizingMaster chosen.',
);
//SECTION - Widget Arguments
//S1 -- Assets
final String? assetPath;
@@ -250,7 +255,7 @@ class AstromicImage extends StatelessWidget {
//SECTION - Build Return
return LayoutBuilder(builder: (BuildContext context, BoxConstraints constraints) {
Size size = _calculateSize(constraints);
return SizedBox(width: size.width, height: size.height, child: buildImage(size));
return SizedBox(width: size.width == double.infinity? null : size.width, height: size.height == double.infinity? null : size.height, child: buildImage(size));
});
//!SECTION
}