diff --git a/lib/core/utils/utils.dart b/lib/core/utils/utils.dart index e5761203..d3107d72 100644 --- a/lib/core/utils/utils.dart +++ b/lib/core/utils/utils.dart @@ -859,15 +859,15 @@ class Utils { BoxFit fit = BoxFit.cover, ImageErrorWidgetBuilder? errorBuilder, }) { + final double? iconW = (width == null && height == null) ? 24.w : width; + final double? iconH = (width == null && height == null) ? 24.h : height; if (url == null || url.isEmpty) { return Utils.buildSvgWithAssets( - width: width ?? 24.w, - height: height ?? 24.h, + width: iconW ?? 24.w, + height: iconH ?? 24.h, icon: AppAssets.noImageFound, ); } - final iconH = height ?? 24.h; - final iconW = width ?? 24.w; return PreserveImageColors( child: Image.network( url, @@ -877,7 +877,7 @@ class Utils { errorBuilder: errorBuilder ?? (_, __, ___) { //todo_section change the error builder icon that it is returning - return Utils.buildSvgWithAssets(width: iconW, height: iconH, icon: AppAssets.noImageFound); + return Utils.buildSvgWithAssets(width: iconW ?? 24.w, height: iconH ?? 24.h, icon: AppAssets.noImageFound); }, ), ); diff --git a/lib/widgets/map/location_map_widget.dart b/lib/widgets/map/location_map_widget.dart index f3b57aa3..044b3b76 100644 --- a/lib/widgets/map/location_map_widget.dart +++ b/lib/widgets/map/location_map_widget.dart @@ -5,7 +5,6 @@ import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/api_consts.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; -import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; @@ -131,11 +130,14 @@ class LocationMapWidget extends StatelessWidget { borderRadius: BorderRadius.circular(24.r), child: Utils.buildImgWithNetwork( url: staticMapUrl, + width: double.infinity, + height: 165.h, iconColor: AppColors.transparent, - fit: BoxFit.contain, + fit: BoxFit.cover, errorBuilder: (context, error, stackTrace) { return Container( height: 165.h, + width: double.infinity, decoration: BoxDecoration( color: AppColors.bgScaffoldColor, borderRadius: BorderRadius.circular(24.r), @@ -153,24 +155,23 @@ class LocationMapWidget extends StatelessWidget { ), Positioned( bottom: 0, - child: SizedBox( - width: MediaQuery.of(context).size.width * 0.785, - child: CustomButton( - text: LocaleKeys.getDirections.tr(context: context), - onPressed: onDirectionsTap ?? _defaultLaunchDirections, - backgroundColor: AppColors.textColor.withValues(alpha: 0.8), - borderColor: AppColors.textColor.withValues(alpha: 0.01), - textColor: AppColors.whiteColor, - fontSize: 14.f, - fontWeight: FontWeight.w600, - borderRadius: 12.r, - padding: EdgeInsets.symmetric(horizontal: 10.w), - height: 40.h, - icon: AppAssets.directions_icon, - iconColor: AppColors.whiteColor, - iconSize: 14.h, - ).paddingAll(12.h), - ), + left: 0, + right: 0, + child: CustomButton( + text: LocaleKeys.getDirections.tr(context: context), + onPressed: onDirectionsTap ?? _defaultLaunchDirections, + backgroundColor: AppColors.textColor.withValues(alpha: 0.8), + borderColor: AppColors.textColor.withValues(alpha: 0.01), + textColor: AppColors.whiteColor, + fontSize: 14.f, + fontWeight: FontWeight.w600, + borderRadius: 12.r, + padding: EdgeInsets.symmetric(horizontal: 10.w), + height: 40.h, + icon: AppAssets.directions_icon, + iconColor: AppColors.whiteColor, + iconSize: 14.h, + ).paddingAll(12.h), ), ], ),