WD:map issues resolved:

1. map type added to the screen along with the translation
2. null shown for the arabic name of the fixed to show the actual name.
3. if the user opens the locationBottomsheet and close it without input of the area the screen freezes with no action on the location.
4. Gms And Hms Maps handled.
5. theme handled inside the maps screen.
maptype
Sultan khan 1 month ago
parent c716490b0e
commit 0d4563542a

@ -1653,5 +1653,9 @@
"oneWaySubtitle": "نقل من الموقع إلى المستشفى", "oneWaySubtitle": "نقل من الموقع إلى المستشفى",
"twoWaySubtitle": "نقل من الموقع إلى المستشفى والعودة مرة أخرى", "twoWaySubtitle": "نقل من الموقع إلى المستشفى والعودة مرة أخرى",
"toHospitalSubtitle": "نقل من موقعك الحالي إلى المستشفى", "toHospitalSubtitle": "نقل من موقعك الحالي إلى المستشفى",
"fromHospitalSubtitle": "نقل من المستشفى إلى منزلك" "fromHospitalSubtitle": "نقل من المستشفى إلى منزلك",
"normalMapType": "افتراضي",
"satelliteMapType": "قمر صناعي",
"terrainMapType": "تضاريس",
"hybridMapType": "هجين"
} }

@ -1645,5 +1645,9 @@
"oneWaySubtitle": "Pickup from location to hospital", "oneWaySubtitle": "Pickup from location to hospital",
"twoWaySubtitle": "Round trip from location to hospital and back", "twoWaySubtitle": "Round trip from location to hospital and back",
"toHospitalSubtitle": "Transfer from your current location to the hospital", "toHospitalSubtitle": "Transfer from your current location to the hospital",
"fromHospitalSubtitle": "Transfer from the hospital back to your home" "fromHospitalSubtitle": "Transfer from the hospital back to your home",
"normalMapType": "Default",
"satelliteMapType": "Satellite",
"terrainMapType": "Terrain",
"hybridMapType": "Hybrid"
} }

@ -114,7 +114,8 @@ extension EmailValidator on String {
bool isCenter = false, bool isCenter = false,
double? height, double? height,
double? letterSpacing, double? letterSpacing,
int maxLine = 0}) => int maxLine = 0, String? fontFamily,
}) =>
Text( Text(
this, this,
textAlign: isCenter ? TextAlign.center : textAlignment, textAlign: isCenter ? TextAlign.center : textAlignment,
@ -127,7 +128,7 @@ extension EmailValidator on String {
height: height, height: height,
decorationColor: isUnderLine ? AppColors.blackColor : null, decorationColor: isUnderLine ? AppColors.blackColor : null,
decoration: isUnderLine ? TextDecoration.underline : null, decoration: isUnderLine ? TextDecoration.underline : null,
fontFamily: isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins', fontFamily:fontFamily ??( isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins'),
), ),
); );
@ -284,10 +285,11 @@ extension EmailValidator on String {
style: TextStyle(fontSize: 20.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4), style: TextStyle(fontSize: 20.f, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal), color: color ?? AppColors.blackColor, letterSpacing: -0.4),
); );
Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines}) => Text( Widget toText21({Color? color, bool isBold = false, FontWeight? weight, int? maxlines, bool isEnglishOnly = false}) => Text(
this, this,
maxLines: maxlines, maxLines: maxlines,
style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 21.f, letterSpacing: -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal)), style: TextStyle(color: color ?? AppColors.blackColor, fontSize: 21.f, letterSpacing: -1, fontWeight: weight ?? (isBold ? FontWeight.bold : FontWeight.normal),
fontFamily: (isEnglishOnly ? "Poppins" : getIt.get<AppState>().getLanguageCode() == "ar" ? 'GESSTwo' : 'Poppins')),
); );
Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text( Widget toText22({Color? color, bool isBold = false, bool isCenter = false}) => Text(

@ -75,9 +75,7 @@ class HospitalsModel {
} }
String? getName(bool isArabic) { String? getName(bool isArabic) {
if (isArabic) {
return "$nameN";
}
return name; return name;
} }

@ -1646,5 +1646,9 @@ abstract class LocaleKeys {
static const twoWaySubtitle = 'twoWaySubtitle'; static const twoWaySubtitle = 'twoWaySubtitle';
static const toHospitalSubtitle = 'toHospitalSubtitle'; static const toHospitalSubtitle = 'toHospitalSubtitle';
static const fromHospitalSubtitle = 'fromHospitalSubtitle'; static const fromHospitalSubtitle = 'fromHospitalSubtitle';
static const normalMapType = 'normalMapType';
static const satelliteMapType = 'satelliteMapType';
static const terrainMapType = 'terrainMapType';
static const hybridMapType = 'hybridMapType';
} }

@ -159,10 +159,12 @@ class CallAmbulancePage extends StatelessWidget {
LocaleKeys.selectPickupDetails.tr(context: context).toText21( LocaleKeys.selectPickupDetails.tr(context: context).toText21(
weight: FontWeight.w600, weight: FontWeight.w600,
color: AppColors.textColor, color: AppColors.textColor,
isEnglishOnly: true,
), ),
LocaleKeys.pleaseSelectDetailsOfPickup.tr(context: context).toText12( LocaleKeys.pleaseSelectDetailsOfPickup.tr(context: context).toText12(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: AppColors.greyTextColor, color: AppColors.greyTextColor,
isEnglishOnly: true,
) )
], ],
), ),
@ -385,6 +387,7 @@ class CallAmbulancePage extends StatelessWidget {
title.toText12( title.toText12(
color: AppColors.greyTextColor, color: AppColors.greyTextColor,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
isEnglishOnly: true
), ),
SizedBox(height: 2.h), SizedBox(height: 2.h),
], ],
@ -393,6 +396,7 @@ class CallAmbulancePage extends StatelessWidget {
subTitle.toText14( subTitle.toText14(
color: AppColors.textColor, color: AppColors.textColor,
weight: FontWeight.w500, weight: FontWeight.w500,
isEnglishOnly: true
), ),
], ],
), ),
@ -527,7 +531,7 @@ class CallAmbulancePage extends StatelessWidget {
textPlaceInput(context) { textPlaceInput(context) {
return Consumer<LocationViewModel>(builder: (_, vm, __) { return Consumer<LocationViewModel>(builder: (_, vm, __) {
// print("the data is ${vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description}"); // print("the data is ${vm.geocodeResponse?.results.first.formattedAddress ?? vm.selectedPrediction?.description}");
return (vm.geocodeResponse != null && vm.geocodeResponse!.results.isNotEmpty) ? SizedBox( return SizedBox(
width: MediaQuery.sizeOf(context).width, width: MediaQuery.sizeOf(context).width,
child: TextInputWidget( child: TextInputWidget(
labelText: LocaleKeys.enterPickupLocationManually.tr(context: context), labelText: LocaleKeys.enterPickupLocationManually.tr(context: context),
@ -546,10 +550,11 @@ class CallAmbulancePage extends StatelessWidget {
vertical: ResponsiveExtension(10).h, vertical: ResponsiveExtension(10).h,
horizontal: ResponsiveExtension(15).h, horizontal: ResponsiveExtension(15).h,
), ),
fontFamily: "Poppins",
).onPress(() { ).onPress(() {
openLocationInputBottomSheet(context); openLocationInputBottomSheet(context);
}), }),
) : SizedBox.shrink(); );
}); });
} }
@ -561,7 +566,7 @@ class CallAmbulancePage extends StatelessWidget {
} }
openLocationInputBottomSheet(BuildContext context) { openLocationInputBottomSheet(BuildContext context) {
context.read<LocationViewModel>().flushSearchPredictions(); // context.read<LocationViewModel>().flushSearchPredictions();
showCommonBottomSheetWithoutHeight( showCommonBottomSheetWithoutHeight(
title: "", title: "",
context, context,

@ -4,6 +4,8 @@ import 'package:flutter_staggered_animations/flutter_staggered_animations.dart'
show AnimationConfiguration, SlideAnimation, FadeInAnimation; show AnimationConfiguration, SlideAnimation, FadeInAnimation;
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/core/app_state.dart';
import 'package:hmg_patient_app_new/core/dependencies.dart';
import 'package:hmg_patient_app_new/core/enums.dart'; import 'package:hmg_patient_app_new/core/enums.dart';
import 'package:hmg_patient_app_new/core/utils/debouncer.dart'; import 'package:hmg_patient_app_new/core/utils/debouncer.dart';
import 'package:hmg_patient_app_new/core/utils/utils.dart'; import 'package:hmg_patient_app_new/core/utils/utils.dart';
@ -49,6 +51,7 @@ class LocationInputBottomSheet extends StatelessWidget {
vertical: 10.h, vertical: 10.h,
horizontal: 15.h, horizontal: 15.h,
), ),
fontFamily: "Poppins",
), ),
SizedBox(height: 24.h), SizedBox(height: 24.h),
Selector<LocationViewModel, List<PlacePrediction>>( Selector<LocationViewModel, List<PlacePrediction>>(
@ -82,16 +85,20 @@ class LocationInputBottomSheet extends StatelessWidget {
Expanded( Expanded(
child: prediction.description.toText14( child: prediction.description.toText14(
color: AppColors.textColor, color: AppColors.textColor,
weight: FontWeight.w500), weight: FontWeight.w500,
isEnglishOnly: true,
), ),
),
Utils.buildSvgWithAssets( Transform.flip(
flipX: getIt.get<AppState>().isArabic(),
child: Utils.buildSvgWithAssets(
icon: AppAssets.forward_arrow_icon_small, icon: AppAssets.forward_arrow_icon_small,
iconColor: AppColors.blackColor, iconColor: AppColors.blackColor,
width: 20.h, width: 20.h,
height: 15.h, height: 15.h,
fit: BoxFit.contain, fit: BoxFit.contain,
), ),
)
], ],
).paddingAll(24.h),), ).paddingAll(24.h),),
), ),

@ -290,7 +290,7 @@ class TextInputWidget extends StatelessWidget {
} }
Widget _buildLabelText(Color? labelColor) { Widget _buildLabelText(Color? labelColor) {
return labelText.toText12(fontWeight: FontWeight.w500, color: labelColor ?? AppColors.inputLabelTextColor); return labelText.toText12(fontWeight: FontWeight.w500, color: labelColor ?? AppColors.inputLabelTextColor, fontFamily: fontFamily);
} }
Widget _buildTextField(BuildContext context) { Widget _buildTextField(BuildContext context) {

@ -1,8 +1,10 @@
import 'dart:async'; import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/app_export.dart'; import 'package:hmg_patient_app_new/core/app_export.dart';
import 'package:hmg_patient_app_new/extensions/widget_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'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:huawei_map/huawei_map.dart'; import 'package:huawei_map/huawei_map.dart';
@ -37,9 +39,9 @@ class _HMSMapState extends State<HMSMap> {
late MapType _selectedMapType; late MapType _selectedMapType;
bool _showMapTypeSelector = false; bool _showMapTypeSelector = false;
static const List<_MapTypeOption> _mapTypeOptions = [ final List<_MapTypeOption> _mapTypeOptions = [
_MapTypeOption(type: MapType.normal, label: 'Default', icon: Icons.map_outlined), _MapTypeOption(type: MapType.normal, label: LocaleKeys.normalMapType.tr(), icon: Icons.map_outlined),
_MapTypeOption(type: MapType.terrain, label: 'Terrain', icon: Icons.terrain_outlined), _MapTypeOption(type: MapType.terrain, label: LocaleKeys.terrainMapType.tr(), icon: Icons.terrain_outlined),
]; ];
@override @override
@ -91,9 +93,9 @@ class _HMSMapState extends State<HMSMap> {
), ),
// Map-type toggle + panel // Map-type toggle + panel
Positioned( PositionedDirectional(
top: 16.h, top: 48.h,
right: 16.w, end: 16.w,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -144,16 +146,13 @@ class _MapTypeToggleButton extends StatelessWidget {
width: 42.w, width: 42.w,
height: 42.h, height: 42.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isActive ? AppColors.primaryRedColor : Colors.white, color: isActive ? AppColors.primaryRedColor : AppColors.whiteColor,
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
boxShadow: const [
BoxShadow(color: Colors.black26, blurRadius: 6, offset: Offset(0, 2)),
],
), ),
child: Icon( child: Icon(
Icons.layers, Icons.layers,
size: 22.h, size: 22.h,
color: isActive ? Colors.white : Colors.black87, color: isActive ? AppColors.whiteColor : AppColors.blackBgColor,
), ),
), ),
); );
@ -180,11 +179,9 @@ class _MapTypeSelectorPanel extends StatelessWidget {
margin: EdgeInsets.only(top: 8.h), margin: EdgeInsets.only(top: 8.h),
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 6.w), padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: AppColors.whiteColor,
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
boxShadow: const [
BoxShadow(color: Colors.black26, blurRadius: 8, offset: Offset(0, 3)),
],
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -233,7 +230,7 @@ class _MapTypeItem extends StatelessWidget {
Icon( Icon(
option.icon, option.icon,
size: 18.h, size: 18.h,
color: isSelected ? AppColors.primaryRedColor : Colors.black54, color: isSelected ? AppColors.primaryRedColor : AppColors.blackBgColor,
), ),
SizedBox(width: 8.w), SizedBox(width: 8.w),
Text( Text(
@ -241,7 +238,7 @@ class _MapTypeItem extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontSize: 14.f, fontSize: 14.f,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400, fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400,
color: isSelected ? AppColors.primaryRedColor : Colors.black87, color: isSelected ? AppColors.primaryRedColor :AppColors.blackBgColor,
), ),
), ),
], ],

@ -55,10 +55,12 @@
import 'dart:async'; import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/widget_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'; import 'package:hmg_patient_app_new/theme/colors.dart';
class GMSMap extends StatefulWidget { class GMSMap extends StatefulWidget {
@ -93,25 +95,25 @@ class _GMSMapState extends State<GMSMap> {
bool _showMapTypeSelector = false; bool _showMapTypeSelector = false;
/// All supported map types with display labels and icons /// All supported map types with display labels and icons
static const List<_MapTypeOption> _mapTypeOptions = [ final List<_MapTypeOption> _mapTypeOptions = [
_MapTypeOption( _MapTypeOption(
type: MapType.normal, type: MapType.normal,
label: 'Default', label: LocaleKeys.normalMapType.tr(),
icon: Icons.map_outlined, icon: Icons.map_outlined,
), ),
_MapTypeOption( _MapTypeOption(
type: MapType.satellite, type: MapType.satellite,
label: 'Satellite', label: LocaleKeys.satelliteMapType.tr(),
icon: Icons.satellite_alt_outlined, icon: Icons.satellite_alt_outlined,
), ),
_MapTypeOption( _MapTypeOption(
type: MapType.terrain, type: MapType.terrain,
label: 'Terrain', label: LocaleKeys.terrainMapType.tr(),
icon: Icons.terrain_outlined, icon: Icons.terrain_outlined,
), ),
_MapTypeOption( _MapTypeOption(
type: MapType.hybrid, type: MapType.hybrid,
label: 'Hybrid', label: LocaleKeys.hybridMapType.tr(),
icon: Icons.layers_outlined, icon: Icons.layers_outlined,
), ),
]; ];
@ -165,9 +167,9 @@ class _GMSMapState extends State<GMSMap> {
), ),
// Map-type toggle button // Map-type toggle button
Positioned( PositionedDirectional(
top: 48.h, top: 48.h,
left: 16.w, end: 16.w,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
@ -224,20 +226,13 @@ class _MapTypeToggleButton extends StatelessWidget {
width: 42.w, width: 42.w,
height: 42.h, height: 42.h,
decoration: BoxDecoration( decoration: BoxDecoration(
color: isActive ? AppColors.primaryRedColor : Colors.white, color: isActive ? AppColors.primaryRedColor : AppColors.whiteColor,
borderRadius: BorderRadius.circular(8.r), borderRadius: BorderRadius.circular(8.r),
boxShadow: const [
BoxShadow(
color: Colors.black26,
blurRadius: 6,
offset: Offset(0, 2),
),
],
), ),
child: Icon( child: Icon(
Icons.layers, Icons.layers,
size: 22.h, size: 22.h,
color: isActive ? Colors.white : Colors.black87, color: isActive ? AppColors.whiteColor : AppColors.blackBgColor,
), ),
), ),
); );
@ -264,15 +259,8 @@ class _MapTypeSelectorPanel extends StatelessWidget {
margin: EdgeInsets.only(top: 8.h), margin: EdgeInsets.only(top: 8.h),
padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 6.w), padding: EdgeInsets.symmetric(vertical: 8.h, horizontal: 6.w),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: AppColors.whiteColor,
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
boxShadow: const [
BoxShadow(
color: Colors.black26,
blurRadius: 8,
offset: Offset(0, 3),
),
],
), ),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -333,7 +321,7 @@ class _MapTypeItem extends StatelessWidget {
fontWeight: fontWeight:
isSelected ? FontWeight.w600 : FontWeight.w400, isSelected ? FontWeight.w600 : FontWeight.w400,
color: color:
isSelected ? AppColors.primaryRedColor : Colors.black87, isSelected ? AppColors.primaryRedColor : AppColors.blackBgColor,
), ),
), ),
], ],

Loading…
Cancel
Save