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