|
|
|
@ -1,9 +1,15 @@
|
|
|
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/dependencies.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/location_util.dart';
|
|
|
|
import 'package:hmg_patient_app_new/core/location_util.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/core/utils/utils.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/weather/models/waether_cities_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/weather/models/waether_cities_model.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/weather/weather_repo.dart';
|
|
|
|
import 'package:hmg_patient_app_new/features/weather/weather_repo.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
|
|
|
|
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
|
|
|
import 'package:hmg_patient_app_new/services/error_handler_service.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/services/navigation_service.dart';
|
|
|
|
|
|
|
|
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
|
|
|
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart' show openAppSettings;
|
|
|
|
|
|
|
|
|
|
|
|
import '../../core/app_state.dart' show AppState;
|
|
|
|
import '../../core/app_state.dart' show AppState;
|
|
|
|
|
|
|
|
|
|
|
|
@ -24,8 +30,30 @@ class WeatherMonitorViewModel extends ChangeNotifier {
|
|
|
|
isLoading = true;
|
|
|
|
isLoading = true;
|
|
|
|
notifyListeners();
|
|
|
|
notifyListeners();
|
|
|
|
_cityInfoList.clear();
|
|
|
|
_cityInfoList.clear();
|
|
|
|
|
|
|
|
locationUtils.isShowConfirmDialog = true;
|
|
|
|
locationUtils.getLocation(
|
|
|
|
locationUtils.getLocation(
|
|
|
|
isShowConfirmDialog: true,
|
|
|
|
isShowConfirmDialog: true,
|
|
|
|
|
|
|
|
onFailure: (){
|
|
|
|
|
|
|
|
isLoading = false;
|
|
|
|
|
|
|
|
notifyListeners();
|
|
|
|
|
|
|
|
showCommonBottomSheetWithoutHeight(
|
|
|
|
|
|
|
|
title: LocaleKeys.notice.tr(),
|
|
|
|
|
|
|
|
getIt.get<NavigationService>().navigatorKey.currentContext!,
|
|
|
|
|
|
|
|
child: Utils.getWarningWidget(
|
|
|
|
|
|
|
|
loadingText: LocaleKeys.grantLocationPermission.tr(),
|
|
|
|
|
|
|
|
isShowActionButtons: true,
|
|
|
|
|
|
|
|
onCancelTap: () {
|
|
|
|
|
|
|
|
getIt.get<NavigationService>().pop();
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
onConfirmTap: () async {
|
|
|
|
|
|
|
|
getIt.get<NavigationService>().pop();
|
|
|
|
|
|
|
|
openAppSettings();
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
callBackFunc: () {},
|
|
|
|
|
|
|
|
isFullScreen: false,
|
|
|
|
|
|
|
|
isCloseButtonVisible: true,
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
},
|
|
|
|
onSuccess: (position) async {
|
|
|
|
onSuccess: (position) async {
|
|
|
|
isLocationAvailable = true;
|
|
|
|
isLocationAvailable = true;
|
|
|
|
final result = await weatherRepo.getCityInfo();
|
|
|
|
final result = await weatherRepo.getCityInfo();
|
|
|
|
|