From d3b6bc5b38b51b75733044a77a239fcd48222a92 Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Tue, 4 Mar 2025 18:49:40 +0200 Subject: [PATCH] [0.1.3] --- CHANGELOG.md | 1 + lib/src/Widgets/src/image.widget.dart | 17 ++++++++--------- lib/src/Widgets/widgets.astromic.dart | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3edbe0..313d204 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.1.3 - **FIX**: Added export for `ImageSizingMaster`. - **FIX**: Removed `placeholderBuilder` Error because I was supplying it along with `progressIndicatorBuilder`. +- **FIX**: Fixed height wasn't constrained in Image widget. ## 0.1.2 - **FIX**: Updated Switcher toggle not recognizing disabled mode. diff --git a/lib/src/Widgets/src/image.widget.dart b/lib/src/Widgets/src/image.widget.dart index 69d3de5..94e55a8 100644 --- a/lib/src/Widgets/src/image.widget.dart +++ b/lib/src/Widgets/src/image.widget.dart @@ -112,7 +112,7 @@ class AstromicImage extends StatelessWidget { /// Used when the height is Master and want to set fixed height OR if width is Master and want to constraint the height final double? fixedHeight; //S1 -- STYLING - final bool? isCircular; + final bool isCircular; final double? borderWidth; final Color? borderColor; final EdgeInsetsGeometry? borderPadding; @@ -181,14 +181,14 @@ class AstromicImage extends StatelessWidget { ) : null; - Widget buildImage(Size size) { + Widget buildImage(Size size) { return Stack( children: [ OctoImage( key: ValueKey(assetType == _DeclaredAssetType.bytes ? (assetRef as Uint8List).length.toString() : assetRef), // width: size.width, - height: size.height, + height: size.height == double.infinity? null : size.height, fit: fit, alignment: alignment, filterQuality: FilterQuality.none, @@ -196,7 +196,6 @@ class AstromicImage extends StatelessWidget { colorBlendMode: blendMode ?? (isSVG ? BlendMode.srcATop : null), // errorBuilder: (BuildContext context, Object error, StackTrace? stackTrace) { - debugPrint('AstromicImage Error: $error'); return errorWidget != null ? errorWidget!(error, stackTrace) : assetFallback != null @@ -206,7 +205,7 @@ class AstromicImage extends StatelessWidget { // progressIndicatorBuilder: (_, ImageChunkEvent? bytes) => SizedBox( width: size.width, - height: size.height, + height: size.height == double.infinity? null : size.height, child: loadingWidget != null ? loadingWidget!(bytes?.cumulativeBytesLoaded, bytes?.expectedTotalBytes) : defaultLoadingWidget, ), // placeholderBuilder: (BuildContext context) => loadingWidget != null ? loadingWidget!(null, null) : defaultLoadingWidget, @@ -214,7 +213,7 @@ class AstromicImage extends StatelessWidget { fadeInDuration: fadeInDuration, imageBuilder: (BuildContext context, Widget image) => Container( width: size.width, - height: size.height, + height: size.height == double.infinity? null : size.height, padding: borderPadding ?? EdgeInsets.zero, margin: EdgeInsets.zero, decoration: BoxDecoration( @@ -224,15 +223,15 @@ class AstromicImage extends StatelessWidget { color: borderColor ?? const Color(0xff000000), ) : null, - borderRadius: isCircular! ? BorderRadius.circular(10000000) : radius, + borderRadius: isCircular ? BorderRadius.circular(10000000) : radius, boxShadow: shadow, ), - child: isCircular! + child: isCircular ? ClipOval( child: isSVG ? finalSVGWidget(size, loadingWidget != null ? loadingWidget!(null, null) : defaultLoadingWidget) : image, ) : ClipRRect( - borderRadius: isCircular! ? BorderRadius.circular(10000000) : radius!, + borderRadius: isCircular ? BorderRadius.circular(10000000) : radius!, child: isSVG ? finalSVGWidget(size, loadingWidget != null ? loadingWidget!(null, null) : defaultLoadingWidget) : image, ), ), diff --git a/lib/src/Widgets/widgets.astromic.dart b/lib/src/Widgets/widgets.astromic.dart index fe98e06..520ff48 100644 --- a/lib/src/Widgets/widgets.astromic.dart +++ b/lib/src/Widgets/widgets.astromic.dart @@ -61,7 +61,7 @@ class AstromicWidgets { /// Used when the height is Master and want to set fixed height OR if width is Master and want to constraint the height fixedHeight: fixedHeight, - isCircular: isCircular, + isCircular: isCircular ?? false, borderWidth: borderWidth, borderColor: borderColor, borderPadding: borderPadding,