From 1944bb8f1c591ac0b9f6b999d5ce03af2bafbe0c Mon Sep 17 00:00:00 2001 From: Yoshi Date: Mon, 17 Jul 2023 20:53:23 +0300 Subject: [PATCH] fix --- .../gradle/wrapper/gradle-wrapper.properties | 2 +- lib/app/api/api.dart | 4 +- lib/app/api/city.dart | 12 +- lib/app/api/daily.dart | 32 ++-- lib/app/api/hourly.dart | 34 ++-- lib/app/controller/controller.dart | 11 +- lib/app/modules/home.dart | 41 ++++- lib/app/widgets/desc_container.dart | 148 ++++++++---------- lib/app/widgets/info_daily_card.dart | 135 +++++++--------- lib/app/widgets/sunset_sunrise.dart | 6 +- lib/main.dart | 20 ++- lib/theme/theme.dart | 11 +- lib/translation/translation.dart | 22 +-- linux/my_application.cc | 4 +- pubspec.lock | 50 +++++- pubspec.yaml | 4 +- 16 files changed, 290 insertions(+), 246 deletions(-) diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index cb24abd..3c472b9 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/lib/app/api/api.dart b/lib/app/api/api.dart index 394e452..5957100 100644 --- a/lib/app/api/api.dart +++ b/lib/app/api/api.dart @@ -27,7 +27,7 @@ class WeatherAPI { : urlHourly = baseUrlHourly; String baseUrlDaily = - 'latitude=$lat&longitude=$lon&daily=weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,windspeed_10m_max,windgusts_10m_max,uv_index_max,rain_sum,winddirection_10m_dominant&forecast_days=10&timezone=auto'; + 'latitude=$lat&longitude=$lon&daily=weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,windspeed_10m_max,windgusts_10m_max,uv_index_max,rain_sum,winddirection_10m_dominant&forecast_days=7&timezone=auto'; String urlDaily; settings.degrees == 'fahrenheit' ? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit' @@ -125,7 +125,7 @@ class WeatherAPI { : urlHourly = baseUrlHourly; String baseUrlDaily = - 'latitude=$lat&longitude=$lon&daily=weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,windspeed_10m_max,windgusts_10m_max,uv_index_max,rain_sum,winddirection_10m_dominant&forecast_days=10&timezone=auto'; + 'latitude=$lat&longitude=$lon&daily=weathercode,temperature_2m_max,temperature_2m_min,apparent_temperature_max,apparent_temperature_min,sunrise,sunset,precipitation_sum,precipitation_probability_max,windspeed_10m_max,windgusts_10m_max,uv_index_max,rain_sum,winddirection_10m_dominant&forecast_days=7&timezone=auto'; String urlDaily; settings.degrees == 'fahrenheit' ? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit' diff --git a/lib/app/api/city.dart b/lib/app/api/city.dart index 6238c82..55a3b6a 100644 --- a/lib/app/api/city.dart +++ b/lib/app/api/city.dart @@ -6,9 +6,9 @@ class CityApi { List results; factory CityApi.fromJson(Map json) => CityApi( - results: json["results"] == null + results: json['results'] == null ? List.empty() - : List.from(json["results"].map((x) => Result.fromJson(x))), + : List.from(json['results'].map((x) => Result.fromJson(x))), ); } @@ -26,9 +26,9 @@ class Result { double longitude; factory Result.fromJson(Map json) => Result( - admin1: json["admin1"] ?? '', - name: json["name"], - latitude: json["latitude"], - longitude: json["longitude"], + admin1: json['admin1'] ?? '', + name: json['name'], + latitude: json['latitude'], + longitude: json['longitude'], ); } diff --git a/lib/app/api/daily.dart b/lib/app/api/daily.dart index ae396db..a649cb0 100644 --- a/lib/app/api/daily.dart +++ b/lib/app/api/daily.dart @@ -7,7 +7,7 @@ class WeatherDailyApi { factory WeatherDailyApi.fromJson(Map json) => WeatherDailyApi( - daily: Daily.fromJson(json["daily"]), + daily: Daily.fromJson(json['daily']), ); } @@ -47,29 +47,29 @@ class Daily { List? winddirection10MDominant; factory Daily.fromJson(Map json) => Daily( - time: List.from(json["time"].map((x) => DateTime.parse(x))), - weathercode: List.from(json["weathercode"].map((x) => x)), + time: List.from(json['time'].map((x) => DateTime.parse(x))), + weathercode: List.from(json['weathercode'].map((x) => x)), temperature2MMax: - List.from(json["temperature_2m_max"].map((x) => x)), + List.from(json['temperature_2m_max'].map((x) => x)), temperature2MMin: - List.from(json["temperature_2m_min"].map((x) => x)), + List.from(json['temperature_2m_min'].map((x) => x)), apparentTemperatureMax: - List.from(json["apparent_temperature_max"].map((x) => x)), + List.from(json['apparent_temperature_max'].map((x) => x)), apparentTemperatureMin: - List.from(json["apparent_temperature_min"].map((x) => x)), - sunrise: List.from(json["sunrise"].map((x) => x)), - sunset: List.from(json["sunset"].map((x) => x)), + List.from(json['apparent_temperature_min'].map((x) => x)), + sunrise: List.from(json['sunrise'].map((x) => x)), + sunset: List.from(json['sunset'].map((x) => x)), precipitationSum: - List.from(json["precipitation_sum"].map((x) => x)), + List.from(json['precipitation_sum'].map((x) => x)), precipitationProbabilityMax: - List.from(json["precipitation_probability_max"].map((x) => x)), + List.from(json['precipitation_probability_max'].map((x) => x)), windspeed10MMax: - List.from(json["windspeed_10m_max"].map((x) => x)), + List.from(json['windspeed_10m_max'].map((x) => x)), windgusts10MMax: - List.from(json["windgusts_10m_max"].map((x) => x)), - uvIndexMax: List.from(json["uv_index_max"].map((x) => x)), - rainSum: List.from(json["rain_sum"].map((x) => x)), + List.from(json['windgusts_10m_max'].map((x) => x)), + uvIndexMax: List.from(json['uv_index_max'].map((x) => x)), + rainSum: List.from(json['rain_sum'].map((x) => x)), winddirection10MDominant: - List.from(json["winddirection_10m_dominant"].map((x) => x)), + List.from(json['winddirection_10m_dominant'].map((x) => x)), ); } diff --git a/lib/app/api/hourly.dart b/lib/app/api/hourly.dart index 09b6300..a92a3dd 100644 --- a/lib/app/api/hourly.dart +++ b/lib/app/api/hourly.dart @@ -9,8 +9,8 @@ class WeatherHourlyApi { factory WeatherHourlyApi.fromJson(Map json) => WeatherHourlyApi( - hourly: Hourly.fromJson(json["hourly"]), - timezone: json["timezone"], + hourly: Hourly.fromJson(json['hourly']), + timezone: json['timezone'], ); } @@ -50,25 +50,25 @@ class Hourly { List? uvIndex; factory Hourly.fromJson(Map json) => Hourly( - time: List.from(json["time"].map((x) => x)), - temperature2M: List.from(json["temperature_2m"].map((x) => x)), + time: List.from(json['time'].map((x) => x)), + temperature2M: List.from(json['temperature_2m'].map((x) => x)), relativehumidity2M: - List.from(json["relativehumidity_2m"].map((x) => x)), + List.from(json['relativehumidity_2m'].map((x) => x)), apparentTemperature: - List.from(json["apparent_temperature"].map((x) => x)), - precipitation: List.from(json["precipitation"].map((x) => x)), - rain: List.from(json["rain"].map((x) => x)), - weathercode: List.from(json["weathercode"].map((x) => x)), + List.from(json['apparent_temperature'].map((x) => x)), + precipitation: List.from(json['precipitation'].map((x) => x)), + rain: List.from(json['rain'].map((x) => x)), + weathercode: List.from(json['weathercode'].map((x) => x)), surfacePressure: - List.from(json["surface_pressure"].map((x) => x)), - visibility: List.from(json["visibility"].map((x) => x)), + List.from(json['surface_pressure'].map((x) => x)), + visibility: List.from(json['visibility'].map((x) => x)), evapotranspiration: - List.from(json["evapotranspiration"].map((x) => x)), - windspeed10M: List.from(json["windspeed_10m"].map((x) => x)), + List.from(json['evapotranspiration'].map((x) => x)), + windspeed10M: List.from(json['windspeed_10m'].map((x) => x)), winddirection10M: - List.from(json["winddirection_10m"].map((x) => x)), - windgusts10M: List.from(json["windgusts_10m"].map((x) => x)), - cloudcover: List.from(json["cloudcover"].map((x) => x)), - uvIndex: List.from(json["uv_index"].map((x) => x)), + List.from(json['winddirection_10m'].map((x) => x)), + windgusts10M: List.from(json['windgusts_10m'].map((x) => x)), + cloudcover: List.from(json['cloudcover'].map((x) => x)), + uvIndex: List.from(json['uv_index'].map((x) => x)), ); } diff --git a/lib/app/controller/controller.dart b/lib/app/controller/controller.dart index ac81a46..840c240 100644 --- a/lib/app/controller/controller.dart +++ b/lib/app/controller/controller.dart @@ -157,11 +157,12 @@ class LocationController extends GetxController { _mainWeather.value = await WeatherAPI().getWeatherData(_latitude.value, _longitude.value); - final List pendingNotificationRequests = - await flutterLocalNotificationsPlugin.pendingNotificationRequests(); - - if (settings.notifications && pendingNotificationRequests.isEmpty) { - notlification(_mainWeather.value); + if (settings.notifications) { + final List pendingNotificationRequests = + await flutterLocalNotificationsPlugin.pendingNotificationRequests(); + if (pendingNotificationRequests.isEmpty) { + notlification(_mainWeather.value); + } } await writeCache(); diff --git a/lib/app/modules/home.dart b/lib/app/modules/home.dart index a5e386e..bde4b84 100644 --- a/lib/app/modules/home.dart +++ b/lib/app/modules/home.dart @@ -189,15 +189,48 @@ class _HomePageState extends State with TickerProviderStateMixin { ], ), body: SafeArea( - child: TabBarView( - controller: tabController, - children: pages, + child: Row( + children: [ + // Row( + // children: [ + // NavigationRail( + // selectedIndex: tabIndex, + // labelType: NavigationRailLabelType.all, + // onDestinationSelected: (int index) => changeTabIndex(index), + // destinations: [ + // NavigationRailDestination( + // icon: const Icon(Iconsax.cloud_sunny), + // selectedIcon: const Icon(Iconsax.cloud_sunny5), + // label: Text('name'.tr), + // ), + // NavigationRailDestination( + // icon: const Icon(Iconsax.map_1), + // selectedIcon: const Icon(Iconsax.map5), + // label: Text('city'.tr), + // ), + // NavigationRailDestination( + // icon: const Icon(Iconsax.category), + // selectedIcon: const Icon(Iconsax.category5), + // label: Text('settings'.tr), + // ), + // ], + // ), + // const VerticalDivider(thickness: 1, width: 1), + // ], + // ), + Expanded( + child: TabBarView( + controller: tabController, + children: pages, + ), + ), + ], ), ), bottomNavigationBar: NavigationBar( onDestinationSelected: (int index) => changeTabIndex(index), selectedIndex: tabIndex, - destinations: [ + destinations: [ NavigationDestination( icon: const Icon(Iconsax.cloud_sunny), selectedIcon: const Icon(Iconsax.cloud_sunny5), diff --git a/lib/app/widgets/desc_container.dart b/lib/app/widgets/desc_container.dart index 0ff4268..a27fdcd 100644 --- a/lib/app/widgets/desc_container.dart +++ b/lib/app/widgets/desc_container.dart @@ -41,93 +41,75 @@ class DescContainer extends StatelessWidget { margin: const EdgeInsets.only(bottom: 15), child: Padding( padding: const EdgeInsets.only(top: 22, bottom: 5), - child: Column( + child: Wrap( + alignment: WrapAlignment.center, + crossAxisAlignment: WrapCrossAlignment.center, + runAlignment: WrapAlignment.center, + spacing: 5, + runSpacing: 2, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/humidity.png', - value: '$humidity%', - desc: 'humidity'.tr, - ), - DescWeather( - imageName: 'assets/images/temperature.png', - value: '${feels.round()}°', - desc: 'feels'.tr, - ), - DescWeather( - imageName: 'assets/images/fog.png', - value: statusData.getVisibility(visibility), - desc: 'visibility'.tr, - ), - ], + DescWeather( + imageName: 'assets/images/humidity.png', + value: '$humidity%', + desc: 'humidity'.tr, ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/windsock.png', - value: '$direction°', - desc: 'direction'.tr, - message: message.getDirection(direction), - ), - DescWeather( - imageName: 'assets/images/wind.png', - value: statusData.getSpeed(wind.round()), - desc: 'wind'.tr, - ), - DescWeather( - imageName: 'assets/images/windgusts.png', - value: statusData.getSpeed(windgusts.round()), - desc: 'windgusts'.tr, - ), - ], + DescWeather( + imageName: 'assets/images/temperature.png', + value: '${feels.round()}°', + desc: 'feels'.tr, ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/evaporation.png', - value: statusData.getPrecipitation(evaporation.abs()), - desc: 'evaporation'.tr, - ), - DescWeather( - imageName: 'assets/images/rainfall.png', - value: statusData.getPrecipitation(precipitation), - desc: 'precipitation'.tr, - ), - DescWeather( - imageName: 'assets/images/water.png', - value: statusData.getPrecipitation(rain), - desc: 'rain'.tr, - ), - ], + DescWeather( + imageName: 'assets/images/fog.png', + value: statusData.getVisibility(visibility), + desc: 'visibility'.tr, ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/cloudy.png', - value: '$cloudcover%', - desc: 'cloudcover'.tr, - ), - DescWeather( - imageName: 'assets/images/atmospheric.png', - value: '${pressure.round()} ${'hPa'.tr}', - desc: 'pressure'.tr, - message: message.getPressure(pressure.round()), - ), - DescWeather( - imageName: 'assets/images/uv.png', - value: '${uvIndex.round()}', - desc: 'uvIndex'.tr, - message: message.getUvIndex(uvIndex.round()), - ), - ], + DescWeather( + imageName: 'assets/images/windsock.png', + value: '$direction°', + desc: 'direction'.tr, + message: message.getDirection(direction), + ), + DescWeather( + imageName: 'assets/images/wind.png', + value: statusData.getSpeed(wind.round()), + desc: 'wind'.tr, + ), + DescWeather( + imageName: 'assets/images/windgusts.png', + value: statusData.getSpeed(windgusts.round()), + desc: 'windgusts'.tr, + ), + DescWeather( + imageName: 'assets/images/evaporation.png', + value: statusData.getPrecipitation(evaporation.abs()), + desc: 'evaporation'.tr, + ), + DescWeather( + imageName: 'assets/images/rainfall.png', + value: statusData.getPrecipitation(precipitation), + desc: 'precipitation'.tr, + ), + DescWeather( + imageName: 'assets/images/water.png', + value: statusData.getPrecipitation(rain), + desc: 'rain'.tr, + ), + DescWeather( + imageName: 'assets/images/cloudy.png', + value: '$cloudcover%', + desc: 'cloudcover'.tr, + ), + DescWeather( + imageName: 'assets/images/atmospheric.png', + value: '${pressure.round()} ${'hPa'.tr}', + desc: 'pressure'.tr, + message: message.getPressure(pressure.round()), + ), + DescWeather( + imageName: 'assets/images/uv.png', + value: '${uvIndex.round()}', + desc: 'uvIndex'.tr, + message: message.getUvIndex(uvIndex.round()), ), ], ), diff --git a/lib/app/widgets/info_daily_card.dart b/lib/app/widgets/info_daily_card.dart index 0f47591..324f4e0 100644 --- a/lib/app/widgets/info_daily_card.dart +++ b/lib/app/widgets/info_daily_card.dart @@ -124,7 +124,7 @@ class _InfoDailyCardState extends State { ), const SizedBox(height: 10), GlowText( - '${statusData.getDegree(widget.temperature2MMin[index].round())} / ${statusData.getDegree(widget.temperature2MMax[index].round())}', + '${widget.temperature2MMin[index].round()} / ${widget.temperature2MMax[index].round()}', style: context.textTheme.titleLarge?.copyWith( fontSize: 35, fontWeight: FontWeight.w800, @@ -158,83 +158,68 @@ class _InfoDailyCardState extends State { margin: const EdgeInsets.only(bottom: 15), child: Padding( padding: const EdgeInsets.only(top: 20, bottom: 5), - child: Column( + child: Wrap( + alignment: WrapAlignment.center, + crossAxisAlignment: WrapCrossAlignment.center, + runAlignment: WrapAlignment.center, + spacing: 5, + runSpacing: 2, children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/cold.png', - value: statusData.getDegree(widget - .apparentTemperatureMin[index] - .round()), - desc: 'apparentTemperatureMin'.tr, - ), - DescWeather( - imageName: 'assets/images/hot.png', - value: statusData.getDegree(widget - .apparentTemperatureMax[index] - .round()), - desc: 'apparentTemperatureMax'.tr, - ), - DescWeather( - imageName: 'assets/images/uv.png', - value: '${widget.uvIndexMax[index].round()}', - desc: 'uvIndex'.tr, - message: message.getUvIndex( - widget.uvIndexMax[index].round()), - ), - ], + DescWeather( + imageName: 'assets/images/cold.png', + value: statusData.getDegree( + widget.apparentTemperatureMin[index].round()), + desc: 'apparentTemperatureMin'.tr, ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/windsock.png', - value: - '${widget.winddirection10MDominant[index]}°', - desc: 'direction'.tr, - message: message.getDirection( - widget.winddirection10MDominant[index]), - ), - DescWeather( - imageName: 'assets/images/wind.png', - value: statusData.getSpeed( - widget.windspeed10MMax[index].round()), - desc: 'wind'.tr, - ), - DescWeather( - imageName: 'assets/images/windgusts.png', - value: statusData.getSpeed( - widget.windgusts10MMax[index].round()), - desc: 'windgusts'.tr, - ), - ], + DescWeather( + imageName: 'assets/images/hot.png', + value: statusData.getDegree( + widget.apparentTemperatureMax[index].round()), + desc: 'apparentTemperatureMax'.tr, ), - const SizedBox(height: 5), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - DescWeather( - imageName: 'assets/images/humidity.png', - value: - '${widget.precipitationProbabilityMax[index]}%', - desc: 'precipitationProbabilit'.tr, - ), - DescWeather( - imageName: 'assets/images/water.png', - value: statusData - .getPrecipitation(widget.rainSum[index]), - desc: 'rain'.tr, - ), - DescWeather( - imageName: 'assets/images/rainfall.png', - value: statusData.getPrecipitation( - widget.precipitationSum[index]), - desc: 'precipitation'.tr, - ), - ], + DescWeather( + imageName: 'assets/images/uv.png', + value: '${widget.uvIndexMax[index].round()}', + desc: 'uvIndex'.tr, + message: message + .getUvIndex(widget.uvIndexMax[index].round()), + ), + DescWeather( + imageName: 'assets/images/windsock.png', + value: '${widget.winddirection10MDominant[index]}°', + desc: 'direction'.tr, + message: message.getDirection( + widget.winddirection10MDominant[index]), + ), + DescWeather( + imageName: 'assets/images/wind.png', + value: statusData.getSpeed( + widget.windspeed10MMax[index].round()), + desc: 'wind'.tr, + ), + DescWeather( + imageName: 'assets/images/windgusts.png', + value: statusData.getSpeed( + widget.windgusts10MMax[index].round()), + desc: 'windgusts'.tr, + ), + DescWeather( + imageName: 'assets/images/humidity.png', + value: + '${widget.precipitationProbabilityMax[index]}%', + desc: 'precipitationProbabilit'.tr, + ), + DescWeather( + imageName: 'assets/images/water.png', + value: statusData + .getPrecipitation(widget.rainSum[index]), + desc: 'rain'.tr, + ), + DescWeather( + imageName: 'assets/images/rainfall.png', + value: statusData.getPrecipitation( + widget.precipitationSum[index]), + desc: 'precipitation'.tr, ), ], ), diff --git a/lib/app/widgets/sunset_sunrise.dart b/lib/app/widgets/sunset_sunrise.dart index dcf0a44..184a00e 100644 --- a/lib/app/widgets/sunset_sunrise.dart +++ b/lib/app/widgets/sunset_sunrise.dart @@ -25,7 +25,7 @@ class _SunsetSunriseState extends State { return Card( margin: const EdgeInsets.only(bottom: 15), child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 20), child: Row( children: [ Expanded( @@ -50,7 +50,7 @@ class _SunsetSunriseState extends State { ], ), ), - Expanded( + Flexible( child: Image.asset( 'assets/images/sunrise.png', scale: 10, @@ -81,7 +81,7 @@ class _SunsetSunriseState extends State { ], ), ), - Expanded( + Flexible( child: Image.asset( 'assets/images/sunset.png', scale: 10, diff --git a/lib/main.dart b/lib/main.dart index 943a264..22914b4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart'; import 'package:rain/app/modules/home.dart'; import 'package:rain/app/modules/onboarding.dart'; import 'package:rain/theme/theme.dart'; +import 'package:time_machine/time_machine.dart'; import 'app/data/weather.dart'; import 'translation/translation.dart'; import 'theme/theme_controller.dart'; @@ -48,6 +49,7 @@ final List appLanguages = [ ]; void main() async { + final String timeZoneName; WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setSystemUIOverlayStyle( const SystemUiOverlayStyle( @@ -58,6 +60,13 @@ void main() async { if (Platform.isAndroid) { await setOptimalDisplayMode(); } + if (Platform.isAndroid || Platform.isIOS) { + timeZoneName = await FlutterTimezone.getLocalTimezone(); + } else { + timeZoneName = '${DateTimeZone.local}'; + } + tz.initializeTimeZones(); + tz.setLocalLocation(tz.getLocation(timeZoneName)); Connectivity() .onConnectivityChanged .listen((ConnectivityResult result) async { @@ -68,17 +77,18 @@ void main() async { isDeviceConnectedNotifier.value = Future(() => false); } }); - final String timeZoneName = await FlutterTimezone.getLocalTimezone(); const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('@mipmap/ic_launcher'); const DarwinInitializationSettings initializationSettingsDarwin = DarwinInitializationSettings(); + const LinuxInitializationSettings initializationSettingsLinux = + LinuxInitializationSettings(defaultActionName: 'Rain'); const InitializationSettings initializationSettings = InitializationSettings( - android: initializationSettingsAndroid, - iOS: initializationSettingsDarwin); + android: initializationSettingsAndroid, + iOS: initializationSettingsDarwin, + linux: initializationSettingsLinux, + ); await flutterLocalNotificationsPlugin.initialize(initializationSettings); - tz.initializeTimeZones(); - tz.setLocalLocation(tz.getLocation(timeZoneName)); runApp(const MyApp()); } diff --git a/lib/theme/theme.dart b/lib/theme/theme.dart index 2b1234f..db8ad36 100644 --- a/lib/theme/theme.dart +++ b/lib/theme/theme.dart @@ -23,9 +23,6 @@ class RainTheme { primaryColor: lightColor, canvasColor: lightColor, scaffoldBackgroundColor: lightColor, - drawerTheme: baseLigth.drawerTheme.copyWith( - backgroundColor: lightColor, - ), cardTheme: baseLigth.cardTheme.copyWith( color: lightColor, shape: RoundedRectangleBorder( @@ -37,7 +34,7 @@ class RainTheme { backgroundColor: lightColor, ), colorScheme: baseLigth.colorScheme.copyWith( - brightness: Brightness.dark, + brightness: Brightness.light, background: lightColor, surface: baseLigth.colorScheme.background, ), @@ -83,9 +80,6 @@ class RainTheme { primaryColor: darkColor, canvasColor: darkColor, scaffoldBackgroundColor: darkColor, - drawerTheme: baseDark.drawerTheme.copyWith( - backgroundColor: darkColor, - ), cardTheme: baseDark.cardTheme.copyWith( color: darkColor, shape: RoundedRectangleBorder( @@ -143,9 +137,6 @@ class RainTheme { primaryColor: oledColor, canvasColor: oledColor, scaffoldBackgroundColor: oledColor, - drawerTheme: baseDark.drawerTheme.copyWith( - backgroundColor: oledColor, - ), cardTheme: baseDark.cardTheme.copyWith( color: oledColor, shape: RoundedRectangleBorder( diff --git a/lib/translation/translation.dart b/lib/translation/translation.dart index 9321d0a..204aa42 100644 --- a/lib/translation/translation.dart +++ b/lib/translation/translation.dart @@ -84,7 +84,7 @@ class Translation extends Translations { 'uvHigh': 'Высокий', 'uvVeryHigh': 'Очень высокий', 'uvExtreme': 'Экстремальный', - 'weatherMore': 'Прогноз погоды на 10 дней', + 'weatherMore': 'Прогноз погоды на 7 дней', 'windgusts': 'Шквал', 'north': 'Север', 'northeast': 'Северо-восток', @@ -189,7 +189,7 @@ class Translation extends Translations { 'uvHigh': 'High', 'uvVeryHigh': 'Very high', 'uvExtreme': 'Extreme', - 'weatherMore': '10-day weather forecast', + 'weatherMore': '7-day weather forecast', 'windgusts': 'Gust', 'north': 'North', 'northeast': 'Northeast', @@ -292,7 +292,7 @@ class Translation extends Translations { 'uvHigh': 'Élevé', 'uvVeryHigh': 'Très élevé', 'uvExtreme': 'Extrême', - 'weatherMore': 'Prévisions météo pour 10 jours', + 'weatherMore': 'Prévisions météo pour 7 jours', 'windgusts': 'Rafale', 'north': 'Nord', 'northeast': 'Nord-Est', @@ -395,7 +395,7 @@ class Translation extends Translations { 'uvHigh': 'Alto', 'uvVeryHigh': 'Molto alto', 'uvExtreme': 'Estremo', - 'weatherMore': 'Previsioni del tempo per 10 giorni', + 'weatherMore': 'Previsioni del tempo per 7 giorni', 'windgusts': 'Raffica', 'north': 'Nord', 'northeast': 'Nord-est', @@ -498,7 +498,7 @@ class Translation extends Translations { 'uvHigh': 'Hoch', 'uvVeryHigh': 'Sehr hoch', 'uvExtreme': 'Extrem', - 'weatherMore': '10-Tage-Wettervorhersage', + 'weatherMore': '7-Tage-Wettervorhersage', 'windgusts': 'Böe', 'north': 'Norden', 'northeast': 'Nordosten', @@ -600,7 +600,7 @@ class Translation extends Translations { 'uvHigh': 'Yüksek', 'uvVeryHigh': 'Çok yüksek', 'uvExtreme': 'Aşırı', - 'weatherMore': '10 günlük hava tahmini', + 'weatherMore': '7 günlük hava tahmini', 'windgusts': 'Bir telaş', 'north': 'Kuzey', 'northeast': 'Kuzeydoğu', @@ -702,7 +702,7 @@ class Translation extends Translations { 'uvHigh': 'Alto', 'uvVeryHigh': 'Muito alto', 'uvExtreme': 'Extremo', - 'weatherMore': 'Previsão do tempo para 10 dias', + 'weatherMore': 'Previsão do tempo para 7 dias', 'windgusts': 'Rajadas', 'north': 'Norte', 'northeast': 'Nordeste', @@ -805,7 +805,7 @@ class Translation extends Translations { 'uvHigh': 'Alto', 'uvVeryHigh': 'Muy alto', 'uvExtreme': 'Extremo', - 'weatherMore': 'Pronóstico del tiempo para 10 días', + 'weatherMore': 'Pronóstico del tiempo para 7 días', 'windgusts': 'Ráfagas', 'north': 'Norte', 'northeast': 'Noreste', @@ -907,7 +907,7 @@ class Translation extends Translations { 'uvHigh': 'Vysoký', 'uvVeryHigh': 'Veľmi vysoký', 'uvExtreme': 'Extrémny', - 'weatherMore': 'Predpoveď počasia na 10 dní', + 'weatherMore': 'Predpoveď počasia na 7 dní', 'windgusts': 'Squall', 'north': 'Sever', 'northeast': 'Severo-Východ', @@ -1010,7 +1010,7 @@ class Translation extends Translations { 'uvHigh': 'Hoog', 'uvVeryHigh': 'Erg hoog', 'uvExtreme': 'Extreem', - 'weatherMore': '10-daagse weersverwachting', + 'weatherMore': '7-daagse weersverwachting', 'windgusts': 'Windstoten', 'north': 'Noord', 'northeast': 'Noordoost', @@ -1110,7 +1110,7 @@ class Translation extends Translations { 'uvHigh': 'उच्च', 'uvVeryHigh': 'बहुत उच्च', 'uvExtreme': 'अत्यधिक', - 'weatherMore': '10-दिवसीय मौसम पूर', + 'weatherMore': '7-दिवसीय मौसम पूर', 'windgusts': 'गुस्त', 'north': 'उत्तर', 'northeast': 'उत्तर-पूर्व', diff --git a/linux/my_application.cc b/linux/my_application.cc index 1de1090..c098c0f 100644 --- a/linux/my_application.cc +++ b/linux/my_application.cc @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) { if (use_header_bar) { GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); gtk_widget_show(GTK_WIDGET(header_bar)); - gtk_header_bar_set_title(header_bar, "rain"); + gtk_header_bar_set_title(header_bar, "Rain"); gtk_header_bar_set_show_close_button(header_bar, TRUE); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); } else { - gtk_window_set_title(window, "rain"); + gtk_window_set_title(window, "Rain"); } gtk_window_set_default_size(window, 1280, 720); diff --git a/pubspec.lock b/pubspec.lock index afcd896..af0f907 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: file - sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.0" + version: "6.1.4" fixnum: dependency: transitive description: @@ -373,6 +373,14 @@ packages: url: "https://pub.dev" source: hosted version: "3.2.0" + geoclue: + dependency: transitive + description: + name: geoclue + sha256: c2a998c77474fc57aa00c6baa2928e58f4b267649057a1c76738656e9dbd2a7f + url: "https://pub.dev" + source: hosted + version: "0.1.1" geocoding: dependency: "direct main" description: @@ -429,6 +437,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.7" + geolocator_linux: + dependency: "direct main" + description: + name: geolocator_linux + sha256: dd0f4461577e8b2560b4384a2d182230a7e075d0b193093441355f93728d1920 + url: "https://pub.dev" + source: hosted + version: "0.1.3" geolocator_platform_interface: dependency: transitive description: @@ -485,6 +501,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.3.1" + gsettings: + dependency: transitive + description: + name: gsettings + sha256: fe90d719e09a6f36607021047e642068a0c98839d9633db00b91633420ae8b0d + url: "https://pub.dev" + source: hosted + version: "0.2.7" home_widget: dependency: "direct main" description: @@ -789,6 +813,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" pub_semver: dependency: transitive description: @@ -914,6 +946,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.3" + time_machine: + dependency: "direct main" + description: + name: time_machine + sha256: b39511bf66cc8553d86c1242c43dbf67a17c594d5d7124727c1fdbf331e3989d + url: "https://pub.dev" + source: hosted + version: "0.9.17" timezone: dependency: "direct main" description: @@ -1062,10 +1102,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 url: "https://pub.dev" source: hosted - version: "1.0.1" + version: "0.2.0+3" xml: dependency: transitive description: @@ -1091,5 +1131,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.0.0 <4.0.0" + dart: ">=3.0.6 <4.0.0" flutter: ">=3.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index 4346ee5..d61c7ef 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -6,7 +6,7 @@ publish_to: "none" version: 1.2.0+23 environment: - sdk: ">=3.0.0 <4.0.0" + sdk: ">=3.0.6 <4.0.0" dependencies: flutter: @@ -26,9 +26,11 @@ dependencies: home_widget: ^0.3.0 google_fonts: ^5.1.0 flutter_glow: ^0.3.0 + time_machine: ^0.9.17 url_launcher: ^6.1.12 dynamic_color: ^1.6.6 path_provider: ^2.0.15 + geolocator_linux: ^0.1.0 flutter_timezone: ^1.0.7 package_info_plus: ^4.0.2 connectivity_plus: ^4.0.1