diff --git a/assets/icons/Search.png b/assets/icons/Search.png deleted file mode 100644 index 5d42616..0000000 Binary files a/assets/icons/Search.png and /dev/null differ diff --git a/lib/app/modules/geolocation.dart b/lib/app/modules/geolocation.dart index 82e6c3a..6e3dc67 100644 --- a/lib/app/modules/geolocation.dart +++ b/lib/app/modules/geolocation.dart @@ -1,9 +1,11 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:flutter_map/flutter_map.dart'; import 'package:gap/gap.dart'; import 'package:geolocator/geolocator.dart'; import 'package:get/get.dart'; import 'package:iconsax_plus/iconsax_plus.dart'; +import 'package:latlong2/latlong.dart'; import 'package:rain/app/api/api.dart'; import 'package:rain/app/api/city_api.dart'; import 'package:rain/app/controller/controller.dart'; @@ -34,6 +36,17 @@ class _SelectGeolocationState extends State { final _controllerCity = TextEditingController(); final _controllerDistrict = TextEditingController(); + static const colorFilter = ColorFilter.matrix([ + -0.2, -0.7, -0.08, 0, 255, // Red channel + -0.2, -0.7, -0.08, 0, 255, // Green channel + -0.2, -0.7, -0.08, 0, 255, // Blue channel + 0, 0, 0, 1, 0, // Alpha channel + ]); + + final bool _isDarkMode = Get.theme.brightness == Brightness.dark; + + final mapController = MapController(); + textTrim(value) { value.text = value.text.trim(); while (value.text.contains(' ')) { @@ -59,6 +72,19 @@ class _SelectGeolocationState extends State { setState(() {}); } + void fillMap(double latitude, double longitude) { + _controllerLat.text = '$latitude'; + _controllerLon.text = '$longitude'; + setState(() {}); + } + + Widget _buildMapTileLayer() { + return TileLayer( + urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', + userAgentPackageName: 'com.darkmoonight.rain', + ); + } + @override Widget build(BuildContext context) { const kTextFieldElevation = 4.0; @@ -103,13 +129,63 @@ class _SelectGeolocationState extends State { child: SingleChildScrollView( child: Column( children: [ - Image.asset( - 'assets/icons/Search.png', - scale: 7, - ), Padding( padding: const EdgeInsets.symmetric( - vertical: 5, horizontal: 10), + horizontal: 10), + child: ClipRRect( + borderRadius: const BorderRadius.all( + Radius.circular(20), + ), + child: SizedBox( + height: Get.size.height * 0.3, + child: FlutterMap( + mapController: mapController, + options: MapOptions( + backgroundColor: + context.theme.colorScheme.surface, + initialCenter: const LatLng( + 55.7522, + 37.6156, + ), + initialZoom: 3, + cameraConstraint: + CameraConstraint.contain( + bounds: LatLngBounds( + const LatLng(-90, -180), + const LatLng(90, 180), + ), + ), + onLongPress: (tapPosition, point) => + fillMap(point.latitude, + point.longitude), + ), + children: [ + if (_isDarkMode) + ColorFiltered( + colorFilter: colorFilter, + child: _buildMapTileLayer(), + ) + else + _buildMapTileLayer(), + RichAttributionWidget( + animationConfig: const ScaleRAWA(), + attributions: [ + TextSourceAttribution( + 'OpenStreetMap contributors', + onTap: () => weatherController + .urlLauncher( + 'https://openstreetmap.org/copyright'), + ), + ], + ), + ], + ), + ), + ), + ), + Padding( + padding: + const EdgeInsets.fromLTRB(10, 15, 10, 5), child: Text( 'searchMethod'.tr, style: context.theme.textTheme.bodyLarge @@ -162,6 +238,7 @@ class _SelectGeolocationState extends State { return Padding( padding: const EdgeInsets.symmetric( horizontal: 10, + vertical: 5, ), child: Align( alignment: Alignment.topCenter, diff --git a/lib/app/modules/map/view/map.dart b/lib/app/modules/map/view/map.dart index 5a0e0fd..ea4561c 100644 --- a/lib/app/modules/map/view/map.dart +++ b/lib/app/modules/map/view/map.dart @@ -218,7 +218,7 @@ class _MapWeatherState extends State with TickerProviderStateMixin { FlutterMap( mapController: _animatedMapController.mapController, options: MapOptions( - backgroundColor: context.theme.scaffoldBackgroundColor, + backgroundColor: context.theme.colorScheme.surface, initialCenter: LatLng(mainLocation.lat!, mainLocation.lon!), initialZoom: 12, cameraConstraint: CameraConstraint.contain( @@ -242,9 +242,9 @@ class _MapWeatherState extends State with TickerProviderStateMixin { if (_isDarkMode) ColorFiltered( colorFilter: const ColorFilter.matrix([ - -0.2126, -0.7152, -0.0722, 0, 255, // Red channel - -0.2126, -0.7152, -0.0722, 0, 255, // Green channel - -0.2126, -0.7152, -0.0722, 0, 255, // Blue channel + -0.2, -0.7, -0.08, 0, 255, // Red channel + -0.2, -0.7, -0.08, 0, 255, // Green channel + -0.2, -0.7, -0.08, 0, 255, // Blue channel 0, 0, 0, 1, 0, // Alpha channel ]), child: _buildMapTileLayer(cacheStore), @@ -320,7 +320,7 @@ class _MapWeatherState extends State with TickerProviderStateMixin { }, onSelected: (Result selection) { _animatedMapController.mapController - .move(LatLng(selection.latitude, selection.longitude), 12); + .move(LatLng(selection.latitude, selection.longitude), 14); _controllerSearch.clear(); _focusNode.unfocus(); }, diff --git a/lib/app/modules/settings/view/settings.dart b/lib/app/modules/settings/view/settings.dart index 609ebfa..d22f027 100644 --- a/lib/app/modules/settings/view/settings.dart +++ b/lib/app/modules/settings/view/settings.dart @@ -1,4 +1,5 @@ import 'dart:io'; +import 'package:dio_cache_interceptor_file_store/dio_cache_interceptor_file_store.dart'; import 'package:flutter/material.dart'; import 'package:flutter_hsvcolor_picker/flutter_hsvcolor_picker.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; @@ -9,6 +10,7 @@ import 'package:iconsax_plus/iconsax_plus.dart'; import 'package:intl/intl.dart'; import 'package:line_awesome_flutter/line_awesome_flutter.dart'; import 'package:package_info_plus/package_info_plus.dart'; +import 'package:path_provider/path_provider.dart'; import 'package:rain/app/controller/controller.dart'; import 'package:rain/app/data/weather.dart'; import 'package:rain/app/modules/settings/widgets/setting_card.dart'; @@ -827,6 +829,49 @@ class _SettingsPageState extends State { ); }, ), + SettingCard( + icon: const Icon(IconsaxPlusLinear.trash_square), + text: 'clearCacheStore'.tr, + onPressed: () => showAdaptiveDialog( + context: context, + builder: (context) => AlertDialog.adaptive( + title: Text( + 'deletedCacheStore'.tr, + style: context.textTheme.titleLarge, + ), + content: Text( + 'deletedCacheStoreQuery'.tr, + style: context.textTheme.titleMedium, + ), + actions: [ + TextButton( + onPressed: () => Get.back(), + child: Text( + 'cancel'.tr, + style: context.textTheme.titleMedium?.copyWith( + color: Colors.blueAccent, + ), + ), + ), + TextButton( + onPressed: () async { + final dir = await getTemporaryDirectory(); + final cacheStoreFuture = FileCacheStore( + '${dir.path}${Platform.pathSeparator}MapTiles'); + cacheStoreFuture.clean(); + Get.back(); + }, + child: Text( + 'delete'.tr, + style: context.textTheme.titleMedium?.copyWith( + color: Colors.red, + ), + ), + ), + ], + ), + ), + ), SettingCard( icon: const Icon(IconsaxPlusLinear.language_square), text: 'language'.tr, diff --git a/lib/translation/bn_in.dart b/lib/translation/bn_in.dart index ef70ac4..156c390 100644 --- a/lib/translation/bn_in.dart +++ b/lib/translation/bn_in.dart @@ -131,5 +131,9 @@ class BnIn { 'hourlyVariables': 'ঘণ্টায় আবহাওয়ার পরিবর্তনশীল', 'dailyVariables': 'দৈনিক আবহাওয়ার পরিবর্তনশীল', 'largeElement': 'বড় আবহাওয়া ডিসপ্লে', + 'map': 'মানচিত্র', + 'clearCacheStore': 'ক্যাশ পরিষ্কার করুন', + 'deletedCacheStore': 'ক্যাশ পরিষ্কার করা হচ্ছে', + 'deletedCacheStoreQuery': 'আপনি কি সত্যিই ক্যাশ পরিষ্কার করতে চান?', }; } diff --git a/lib/translation/cs_cz.dart b/lib/translation/cs_cz.dart index 1dcd7f9..e5cfa93 100644 --- a/lib/translation/cs_cz.dart +++ b/lib/translation/cs_cz.dart @@ -131,5 +131,9 @@ class CsCz { 'hourlyVariables': 'Hodinové meteorologické proměnné', 'dailyVariables': 'Denní meteorologické proměnné', 'largeElement': 'Velké zobrazení počasí', + 'map': 'Mapa', + 'clearCacheStore': 'Vymazat mezipaměť', + 'deletedCacheStore': 'Čištění mezipaměti', + 'deletedCacheStoreQuery': 'Opravdu chcete vymazat mezipaměť?', }; } diff --git a/lib/translation/da_dk.dart b/lib/translation/da_dk.dart index d873cc6..d4e76b7 100644 --- a/lib/translation/da_dk.dart +++ b/lib/translation/da_dk.dart @@ -132,5 +132,9 @@ class DaDk { 'hourlyVariables': 'Timevise vejrfaktorer', 'dailyVariables': 'Daglige vejrfaktorer', 'largeElement': 'Stort vejrdisplay', + 'map': 'Kort', + 'clearCacheStore': 'Ryd cache', + 'deletedCacheStore': 'Rydder cache', + 'deletedCacheStoreQuery': 'Er du sikker på, at du vil rydde cachen?', }; } diff --git a/lib/translation/de_de.dart b/lib/translation/de_de.dart index e983682..a094ada 100644 --- a/lib/translation/de_de.dart +++ b/lib/translation/de_de.dart @@ -133,5 +133,10 @@ class DeDe { 'hourlyVariables': 'Stündliche Wettervariablen', 'dailyVariables': 'Tägliche Wettervariablen', 'largeElement': 'Große Wetteranzeige', + 'map': 'Karte', + 'clearCacheStore': 'Cache leeren', + 'deletedCacheStore': 'Cache wird geleert', + 'deletedCacheStoreQuery': + 'Sind Sie sicher, dass Sie den Cache leeren möchten?', }; } diff --git a/lib/translation/en_us.dart b/lib/translation/en_us.dart index 162001e..469f244 100644 --- a/lib/translation/en_us.dart +++ b/lib/translation/en_us.dart @@ -133,5 +133,8 @@ class EnUs { 'dailyVariables': 'Daily weather variables', 'largeElement': 'Large weather display', 'map': 'Map', + 'clearCacheStore': 'Clear cache', + 'deletedCacheStore': 'Clearing the cache', + 'deletedCacheStoreQuery': 'Are you sure you want to clear the cache?', }; } diff --git a/lib/translation/es_es.dart b/lib/translation/es_es.dart index 2273902..0114a95 100644 --- a/lib/translation/es_es.dart +++ b/lib/translation/es_es.dart @@ -133,5 +133,10 @@ class EsEs { 'hourlyVariables': 'Variables meteorológicas horarias', 'dailyVariables': 'Variables meteorológicas diarias', 'largeElement': 'Visualización grande del clima', + 'map': 'Mapa', + 'clearCacheStore': 'Borrar caché', + 'deletedCacheStore': 'Borrando caché', + 'deletedCacheStoreQuery': + '¿Estás seguro de que quieres borrar el caché?', }; } diff --git a/lib/translation/fa_ir.dart b/lib/translation/fa_ir.dart index e3fbf84..2bb3019 100644 --- a/lib/translation/fa_ir.dart +++ b/lib/translation/fa_ir.dart @@ -132,5 +132,10 @@ class FaIr { 'hourlyVariables': 'متغیرهای ساعتی هواشناسی', 'dailyVariables': 'متغیرهای روزانه هواشناسی', 'largeElement': 'نمایش هواشناسی بزرگ', + 'map': 'نقشه', + 'clearCacheStore': 'پاک کردن حافظه نهان', + 'deletedCacheStore': 'در حال پاک کردن حافظه نهان', + 'deletedCacheStoreQuery': + 'آیا مطمئن هستید که می‌خواهید حافظه نهان را پاک کنید؟', }; } diff --git a/lib/translation/fr_fr.dart b/lib/translation/fr_fr.dart index 9989b5c..76a7461 100644 --- a/lib/translation/fr_fr.dart +++ b/lib/translation/fr_fr.dart @@ -133,5 +133,9 @@ class FrFr { 'hourlyVariables': 'Variables météorologiques horaires', 'dailyVariables': 'Variables météorologiques quotidiennes', 'largeElement': 'Affichage météo grand format', + 'map': 'Carte', + 'clearCacheStore': 'Effacer le cache', + 'deletedCacheStore': 'Effacement du cache', + 'deletedCacheStoreQuery': 'Êtes-vous sûr de vouloir effacer le cache?', }; } diff --git a/lib/translation/ga_ie.dart b/lib/translation/ga_ie.dart index 559972c..92ef8a2 100644 --- a/lib/translation/ga_ie.dart +++ b/lib/translation/ga_ie.dart @@ -133,5 +133,10 @@ class GaIe { 'hourlyVariables': 'Athrógacha aimsire uaireanta', 'dailyVariables': 'Athrógacha aimsire laethúla', 'largeElement': 'Taispeáint mór na haimsire', + 'map': 'Léarscáil', + 'clearCacheStore': 'Glan taisce', + 'deletedCacheStore': 'Ag glanadh an taisce', + 'deletedCacheStoreQuery': + 'An bhfuil tú cinnte gur mian leat an taisce a ghlanadh?', }; } diff --git a/lib/translation/hi_in.dart b/lib/translation/hi_in.dart index a624f6a..a5fc7d5 100644 --- a/lib/translation/hi_in.dart +++ b/lib/translation/hi_in.dart @@ -130,5 +130,9 @@ class HiIn { 'hourlyVariables': 'घंटेवार मौसम चर', 'dailyVariables': 'दैनिक मौसम चर', 'largeElement': 'बड़े मौसम का प्रदर्शन', + 'map': 'मानचित्र', + 'clearCacheStore': 'कैश साफ़ करें', + 'deletedCacheStore': 'कैश साफ़ हो रहा है', + 'deletedCacheStoreQuery': 'क्या आप वाकई कैश साफ़ करना चाहते हैं?', }; } diff --git a/lib/translation/hu_hu.dart b/lib/translation/hu_hu.dart index d54a059..fdc22ca 100644 --- a/lib/translation/hu_hu.dart +++ b/lib/translation/hu_hu.dart @@ -133,5 +133,9 @@ class HuHu { 'hourlyVariables': 'Óránkénti időjárási változók', 'dailyVariables': 'Napi időjárási változók', 'largeElement': 'Nagy méretű időjárás megjelenítése', + 'map': 'Térkép', + 'clearCacheStore': 'Gyorsítótár törlése', + 'deletedCacheStore': 'Gyorsítótár törlése folyamatban', + 'deletedCacheStoreQuery': 'Biztosan törölni szeretné a gyorsítótárat?', }; } diff --git a/lib/translation/it_it.dart b/lib/translation/it_it.dart index 505f4c3..95e5b01 100644 --- a/lib/translation/it_it.dart +++ b/lib/translation/it_it.dart @@ -133,5 +133,9 @@ class ItIt { 'hourlyVariables': 'Variabili meteorologiche orarie', 'dailyVariables': 'Variabili meteorologiche giornaliere', 'largeElement': 'Visualizzazione grande elemento meteo', + 'map': 'Mappa', + 'clearCacheStore': 'Cancella cache', + 'deletedCacheStore': 'Cancellazione della cache', + 'deletedCacheStoreQuery': 'Sei sicuro di voler cancellare la cache?', }; } diff --git a/lib/translation/ka_ge.dart b/lib/translation/ka_ge.dart index 2a8b079..26bed17 100644 --- a/lib/translation/ka_ge.dart +++ b/lib/translation/ka_ge.dart @@ -132,5 +132,10 @@ class KaGe { 'hourlyVariables': 'საათობრივი ამინდის ცვლადები', 'dailyVariables': 'ყოველდღიური ამინდის ცვლადები', 'largeElement': 'გადიდი ამინდის გამოჩენა', + 'map': 'რუკა', + 'clearCacheStore': 'ქეშის გასუფთავება', + 'deletedCacheStore': 'ქეშის გასუფთავება მიმდინარეობს', + 'deletedCacheStoreQuery': + 'დარწმუნებული ხართ, რომ გსურთ ქეშის გასუფთავება?', }; } diff --git a/lib/translation/ko_kr.dart b/lib/translation/ko_kr.dart index 30f3632..7320ab3 100644 --- a/lib/translation/ko_kr.dart +++ b/lib/translation/ko_kr.dart @@ -128,5 +128,9 @@ class KoKr { 'hourlyVariables': '시간별 날씨 변수', 'dailyVariables': '일별 날씨 변수', 'largeElement': '큰 날씨 표시', + 'map': '지도', + 'clearCacheStore': '캐시 지우기', + 'deletedCacheStore': '캐시 삭제 중', + 'deletedCacheStoreQuery': '캐시를 정말로 지우시겠습니까?', }; } diff --git a/lib/translation/nl_nl.dart b/lib/translation/nl_nl.dart index 056e623..0e9fc73 100644 --- a/lib/translation/nl_nl.dart +++ b/lib/translation/nl_nl.dart @@ -133,5 +133,9 @@ class NlNl { 'hourlyVariables': 'Uurlijkse weervariabelen', 'dailyVariables': 'Dagelijkse weervariabelen', 'largeElement': 'Groot weerbericht weergeven', + 'map': 'Kaart', + 'clearCacheStore': 'Cache wissen', + 'deletedCacheStore': 'Cache wissen', + 'deletedCacheStoreQuery': 'Weet je zeker dat je de cache wilt wissen?', }; } diff --git a/lib/translation/pl_pl.dart b/lib/translation/pl_pl.dart index 58a57eb..b3fda09 100644 --- a/lib/translation/pl_pl.dart +++ b/lib/translation/pl_pl.dart @@ -131,5 +131,10 @@ class PlPl { 'hourlyVariables': 'Godzinowe zmienne pogodowe', 'dailyVariables': 'Dzienne zmienne pogodowe', 'largeElement': 'Duże wyświetlanie pogody', + 'map': 'Mapa', + 'clearCacheStore': 'Wyczyść pamięć podręczną', + 'deletedCacheStore': 'Czyszczenie pamięci podręcznej', + 'deletedCacheStoreQuery': + 'Czy na pewno chcesz wyczyścić pamięć podręczną?', }; } diff --git a/lib/translation/pt_br.dart b/lib/translation/pt_br.dart index d36edb6..0661122 100644 --- a/lib/translation/pt_br.dart +++ b/lib/translation/pt_br.dart @@ -132,5 +132,9 @@ class PtBr { 'hourlyVariables': 'Variáveis meteorológicas horárias', 'dailyVariables': 'Variáveis meteorológicas diárias', 'largeElement': 'Exibição grande do clima', + 'map': 'Mapa', + 'clearCacheStore': 'Limpar cache', + 'deletedCacheStore': 'Limpando cache', + 'deletedCacheStoreQuery': 'Tem certeza de que deseja limpar o cache?', }; } diff --git a/lib/translation/ro_ro.dart b/lib/translation/ro_ro.dart index 5dd3d47..3b36ba6 100644 --- a/lib/translation/ro_ro.dart +++ b/lib/translation/ro_ro.dart @@ -131,5 +131,9 @@ class RoRo { 'hourlyVariables': 'Variabile meteorologice orare', 'dailyVariables': 'Variabile meteorologice zilnice', 'largeElement': 'Afișare mare a vremii', + 'map': 'Hartă', + 'clearCacheStore': 'Șterge cache-ul', + 'deletedCacheStore': 'Ștergerea cache-ului', + 'deletedCacheStoreQuery': 'Ești sigur că vrei să ștergi cache-ul?', }; } diff --git a/lib/translation/ru_ru.dart b/lib/translation/ru_ru.dart index 735d825..6118d5f 100644 --- a/lib/translation/ru_ru.dart +++ b/lib/translation/ru_ru.dart @@ -133,5 +133,8 @@ class RuRu { 'dailyVariables': 'Ежедневные погодные условия', 'largeElement': 'Отображение погоды большим элементом', 'map': 'Карта', + 'clearCacheStore': 'Очистить кэш', + 'deletedCacheStore': 'Очистка кэша', + 'deletedCacheStoreQuery': 'Вы уверены, что хотите очистить кэш?', }; } diff --git a/lib/translation/sk_sk.dart b/lib/translation/sk_sk.dart index 26f47b6..5e51dfc 100644 --- a/lib/translation/sk_sk.dart +++ b/lib/translation/sk_sk.dart @@ -131,5 +131,10 @@ class SkSk { 'hourlyVariables': 'Hodinové meteorologické premenné', 'dailyVariables': 'Denné meteorologické premenné', 'largeElement': 'Veľké zobrazenie počasia', + 'map': 'Mapa', + 'clearCacheStore': 'Vymazať vyrovnávaciu pamäť', + 'deletedCacheStore': 'Vymazávanie vyrovnávacej pamäte', + 'deletedCacheStoreQuery': + 'Ste si istí, že chcete vymazať vyrovnávaciu pamäť?', }; } diff --git a/lib/translation/tr_tr.dart b/lib/translation/tr_tr.dart index 19c6a54..1a66ee6 100644 --- a/lib/translation/tr_tr.dart +++ b/lib/translation/tr_tr.dart @@ -131,5 +131,10 @@ class TrTr { 'hourlyVariables': 'Saatlik hava değişkenleri', 'dailyVariables': 'Günlük hava değişkenleri', 'largeElement': 'Büyük hava durumu gösterimi', + 'map': 'Harita', + 'clearCacheStore': 'Önbelleği temizle', + 'deletedCacheStore': 'Önbellek temizleniyor', + 'deletedCacheStoreQuery': + 'Önbelleği temizlemek istediğinizden emin misiniz?', }; } diff --git a/lib/translation/ur_pk.dart b/lib/translation/ur_pk.dart index bfcf872..f5aa70c 100644 --- a/lib/translation/ur_pk.dart +++ b/lib/translation/ur_pk.dart @@ -132,5 +132,9 @@ class UrPk { 'hourlyVariables': 'ہر گھنٹے کے موسمی متغیرات', 'dailyVariables': 'روزانہ کے موسمی متغیرات', 'largeElement': 'بڑے موسم کا ڈسپلے', + 'map': 'نقشہ', + 'clearCacheStore': 'کیچ صاف کریں', + 'deletedCacheStore': 'کیچ صاف کی جارہی ہے', + 'deletedCacheStoreQuery': 'کیا آپ واقعی کیچ صاف کرنا چاہتے ہیں؟', }; } diff --git a/lib/translation/zh_ch.dart b/lib/translation/zh_ch.dart index 6678b68..39c9d63 100644 --- a/lib/translation/zh_ch.dart +++ b/lib/translation/zh_ch.dart @@ -127,5 +127,9 @@ class ZhCh { 'hourlyVariables': '每小时天气变量', 'dailyVariables': '每日天气变量', 'largeElement': '大天气显示', + 'map': '地图', + 'clearCacheStore': '清除缓存', + 'deletedCacheStore': '正在清除缓存', + 'deletedCacheStoreQuery': '您确定要清除缓存吗?', }; } diff --git a/lib/translation/zh_tw.dart b/lib/translation/zh_tw.dart index 68c6948..db52241 100644 --- a/lib/translation/zh_tw.dart +++ b/lib/translation/zh_tw.dart @@ -128,5 +128,9 @@ class ZhTw { 'hourlyVariables': '每小時天氣變量', 'dailyVariables': '每日天氣變量', 'largeElement': '大型天氣顯示', + 'map': '地圖', + 'clearCacheStore': '清除快取', + 'deletedCacheStore': '正在清除快取', + 'deletedCacheStoreQuery': '您確定要清除快取嗎?', }; }