refactor: Update CakeImageWidget to allow nullable BoxFit

This commit is contained in:
Blazebrain 2025-06-17 13:20:18 +01:00
parent 65402ba1eb
commit c2ebf1d42a
2 changed files with 5 additions and 8 deletions

View file

@ -1,6 +1,5 @@
import 'package:cake_wallet/src/widgets/cake_image_widget.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:cake_wallet/themes/core/material_base_theme.dart';
import 'package:cake_wallet/utils/responsive_layout_util.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/routes.dart';

View file

@ -7,7 +7,7 @@ class CakeImageWidget extends StatelessWidget {
this.imageUrl,
this.height,
this.width,
this.fit = BoxFit.cover,
this.fit,
this.loadingWidget,
this.errorWidget,
this.color,
@ -16,7 +16,7 @@ class CakeImageWidget extends StatelessWidget {
final String? imageUrl;
final double? height;
final double? width;
final BoxFit fit;
final BoxFit? fit;
final Widget? loadingWidget;
final Widget? errorWidget;
final Color? color;
@ -37,8 +37,7 @@ class CakeImageWidget extends StatelessWidget {
imageUrl!,
height: height,
width: width,
fit: fit,
color: color,
fit: fit ?? BoxFit.contain,
)
: Image.asset(
imageUrl!,
@ -53,8 +52,7 @@ class CakeImageWidget extends StatelessWidget {
imageUrl!,
height: height,
width: width,
fit: fit,
color: color,
fit: fit ?? BoxFit.contain,
placeholderBuilder: (_) {
return loadingWidget ?? const Center(child: CircularProgressIndicator());
},
@ -64,7 +62,7 @@ class CakeImageWidget extends StatelessWidget {
imageUrl!,
height: height,
width: width,
fit: fit,
fit: fit ?? BoxFit.cover,
color: color,
loadingBuilder: (_, Widget child, ImageChunkEvent? progress) {
if (progress == null) return child;