This commit is contained in:
Yoshi 2023-07-17 20:53:23 +03:00
parent 8a47668bad
commit 1944bb8f1c
16 changed files with 290 additions and 246 deletions

View file

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

View file

@ -27,7 +27,7 @@ class WeatherAPI {
: urlHourly = baseUrlHourly; : urlHourly = baseUrlHourly;
String baseUrlDaily = 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; String urlDaily;
settings.degrees == 'fahrenheit' settings.degrees == 'fahrenheit'
? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit' ? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit'
@ -125,7 +125,7 @@ class WeatherAPI {
: urlHourly = baseUrlHourly; : urlHourly = baseUrlHourly;
String baseUrlDaily = 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; String urlDaily;
settings.degrees == 'fahrenheit' settings.degrees == 'fahrenheit'
? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit' ? urlDaily = '$baseUrlDaily&temperature_unit=fahrenheit'

View file

@ -6,9 +6,9 @@ class CityApi {
List<Result> results; List<Result> results;
factory CityApi.fromJson(Map<String, dynamic> json) => CityApi( factory CityApi.fromJson(Map<String, dynamic> json) => CityApi(
results: json["results"] == null results: json['results'] == null
? List<Result>.empty() ? List<Result>.empty()
: List<Result>.from(json["results"].map((x) => Result.fromJson(x))), : List<Result>.from(json['results'].map((x) => Result.fromJson(x))),
); );
} }
@ -26,9 +26,9 @@ class Result {
double longitude; double longitude;
factory Result.fromJson(Map<String, dynamic> json) => Result( factory Result.fromJson(Map<String, dynamic> json) => Result(
admin1: json["admin1"] ?? '', admin1: json['admin1'] ?? '',
name: json["name"], name: json['name'],
latitude: json["latitude"], latitude: json['latitude'],
longitude: json["longitude"], longitude: json['longitude'],
); );
} }

View file

@ -7,7 +7,7 @@ class WeatherDailyApi {
factory WeatherDailyApi.fromJson(Map<String, dynamic> json) => factory WeatherDailyApi.fromJson(Map<String, dynamic> json) =>
WeatherDailyApi( WeatherDailyApi(
daily: Daily.fromJson(json["daily"]), daily: Daily.fromJson(json['daily']),
); );
} }
@ -47,29 +47,29 @@ class Daily {
List<int>? winddirection10MDominant; List<int>? winddirection10MDominant;
factory Daily.fromJson(Map<String, dynamic> json) => Daily( factory Daily.fromJson(Map<String, dynamic> json) => Daily(
time: List<DateTime>.from(json["time"].map((x) => DateTime.parse(x))), time: List<DateTime>.from(json['time'].map((x) => DateTime.parse(x))),
weathercode: List<int>.from(json["weathercode"].map((x) => x)), weathercode: List<int>.from(json['weathercode'].map((x) => x)),
temperature2MMax: temperature2MMax:
List<double>.from(json["temperature_2m_max"].map((x) => x)), List<double>.from(json['temperature_2m_max'].map((x) => x)),
temperature2MMin: temperature2MMin:
List<double>.from(json["temperature_2m_min"].map((x) => x)), List<double>.from(json['temperature_2m_min'].map((x) => x)),
apparentTemperatureMax: apparentTemperatureMax:
List<double>.from(json["apparent_temperature_max"].map((x) => x)), List<double>.from(json['apparent_temperature_max'].map((x) => x)),
apparentTemperatureMin: apparentTemperatureMin:
List<double>.from(json["apparent_temperature_min"].map((x) => x)), List<double>.from(json['apparent_temperature_min'].map((x) => x)),
sunrise: List<String>.from(json["sunrise"].map((x) => x)), sunrise: List<String>.from(json['sunrise'].map((x) => x)),
sunset: List<String>.from(json["sunset"].map((x) => x)), sunset: List<String>.from(json['sunset'].map((x) => x)),
precipitationSum: precipitationSum:
List<double>.from(json["precipitation_sum"].map((x) => x)), List<double>.from(json['precipitation_sum'].map((x) => x)),
precipitationProbabilityMax: precipitationProbabilityMax:
List<int>.from(json["precipitation_probability_max"].map((x) => x)), List<int>.from(json['precipitation_probability_max'].map((x) => x)),
windspeed10MMax: windspeed10MMax:
List<double>.from(json["windspeed_10m_max"].map((x) => x)), List<double>.from(json['windspeed_10m_max'].map((x) => x)),
windgusts10MMax: windgusts10MMax:
List<double>.from(json["windgusts_10m_max"].map((x) => x)), List<double>.from(json['windgusts_10m_max'].map((x) => x)),
uvIndexMax: List<double>.from(json["uv_index_max"].map((x) => x)), uvIndexMax: List<double>.from(json['uv_index_max'].map((x) => x)),
rainSum: List<double>.from(json["rain_sum"].map((x) => x)), rainSum: List<double>.from(json['rain_sum'].map((x) => x)),
winddirection10MDominant: winddirection10MDominant:
List<int>.from(json["winddirection_10m_dominant"].map((x) => x)), List<int>.from(json['winddirection_10m_dominant'].map((x) => x)),
); );
} }

View file

@ -9,8 +9,8 @@ class WeatherHourlyApi {
factory WeatherHourlyApi.fromJson(Map<String, dynamic> json) => factory WeatherHourlyApi.fromJson(Map<String, dynamic> json) =>
WeatherHourlyApi( WeatherHourlyApi(
hourly: Hourly.fromJson(json["hourly"]), hourly: Hourly.fromJson(json['hourly']),
timezone: json["timezone"], timezone: json['timezone'],
); );
} }
@ -50,25 +50,25 @@ class Hourly {
List<double>? uvIndex; List<double>? uvIndex;
factory Hourly.fromJson(Map<String, dynamic> json) => Hourly( factory Hourly.fromJson(Map<String, dynamic> json) => Hourly(
time: List<String>.from(json["time"].map((x) => x)), time: List<String>.from(json['time'].map((x) => x)),
temperature2M: List<double>.from(json["temperature_2m"].map((x) => x)), temperature2M: List<double>.from(json['temperature_2m'].map((x) => x)),
relativehumidity2M: relativehumidity2M:
List<int>.from(json["relativehumidity_2m"].map((x) => x)), List<int>.from(json['relativehumidity_2m'].map((x) => x)),
apparentTemperature: apparentTemperature:
List<double>.from(json["apparent_temperature"].map((x) => x)), List<double>.from(json['apparent_temperature'].map((x) => x)),
precipitation: List<double>.from(json["precipitation"].map((x) => x)), precipitation: List<double>.from(json['precipitation'].map((x) => x)),
rain: List<double>.from(json["rain"].map((x) => x)), rain: List<double>.from(json['rain'].map((x) => x)),
weathercode: List<int>.from(json["weathercode"].map((x) => x)), weathercode: List<int>.from(json['weathercode'].map((x) => x)),
surfacePressure: surfacePressure:
List<double>.from(json["surface_pressure"].map((x) => x)), List<double>.from(json['surface_pressure'].map((x) => x)),
visibility: List<double>.from(json["visibility"].map((x) => x)), visibility: List<double>.from(json['visibility'].map((x) => x)),
evapotranspiration: evapotranspiration:
List<double>.from(json["evapotranspiration"].map((x) => x)), List<double>.from(json['evapotranspiration'].map((x) => x)),
windspeed10M: List<double>.from(json["windspeed_10m"].map((x) => x)), windspeed10M: List<double>.from(json['windspeed_10m'].map((x) => x)),
winddirection10M: winddirection10M:
List<int>.from(json["winddirection_10m"].map((x) => x)), List<int>.from(json['winddirection_10m'].map((x) => x)),
windgusts10M: List<double>.from(json["windgusts_10m"].map((x) => x)), windgusts10M: List<double>.from(json['windgusts_10m'].map((x) => x)),
cloudcover: List<int>.from(json["cloudcover"].map((x) => x)), cloudcover: List<int>.from(json['cloudcover'].map((x) => x)),
uvIndex: List<double>.from(json["uv_index"].map((x) => x)), uvIndex: List<double>.from(json['uv_index'].map((x) => x)),
); );
} }

View file

@ -157,11 +157,12 @@ class LocationController extends GetxController {
_mainWeather.value = _mainWeather.value =
await WeatherAPI().getWeatherData(_latitude.value, _longitude.value); await WeatherAPI().getWeatherData(_latitude.value, _longitude.value);
final List<PendingNotificationRequest> pendingNotificationRequests = if (settings.notifications) {
await flutterLocalNotificationsPlugin.pendingNotificationRequests(); final List<PendingNotificationRequest> pendingNotificationRequests =
await flutterLocalNotificationsPlugin.pendingNotificationRequests();
if (settings.notifications && pendingNotificationRequests.isEmpty) { if (pendingNotificationRequests.isEmpty) {
notlification(_mainWeather.value); notlification(_mainWeather.value);
}
} }
await writeCache(); await writeCache();

View file

@ -189,15 +189,48 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
], ],
), ),
body: SafeArea( body: SafeArea(
child: TabBarView( child: Row(
controller: tabController, children: [
children: pages, // 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( bottomNavigationBar: NavigationBar(
onDestinationSelected: (int index) => changeTabIndex(index), onDestinationSelected: (int index) => changeTabIndex(index),
selectedIndex: tabIndex, selectedIndex: tabIndex,
destinations: <Widget>[ destinations: [
NavigationDestination( NavigationDestination(
icon: const Icon(Iconsax.cloud_sunny), icon: const Icon(Iconsax.cloud_sunny),
selectedIcon: const Icon(Iconsax.cloud_sunny5), selectedIcon: const Icon(Iconsax.cloud_sunny5),

View file

@ -41,93 +41,75 @@ class DescContainer extends StatelessWidget {
margin: const EdgeInsets.only(bottom: 15), margin: const EdgeInsets.only(bottom: 15),
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 22, bottom: 5), 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: [ children: [
Row( DescWeather(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, imageName: 'assets/images/humidity.png',
children: [ value: '$humidity%',
DescWeather( desc: 'humidity'.tr,
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,
),
],
), ),
const SizedBox(height: 5), DescWeather(
Row( imageName: 'assets/images/temperature.png',
mainAxisAlignment: MainAxisAlignment.spaceEvenly, value: '${feels.round()}°',
children: [ desc: 'feels'.tr,
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,
),
],
), ),
const SizedBox(height: 5), DescWeather(
Row( imageName: 'assets/images/fog.png',
mainAxisAlignment: MainAxisAlignment.spaceEvenly, value: statusData.getVisibility(visibility),
children: [ desc: 'visibility'.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,
),
],
), ),
const SizedBox(height: 5), DescWeather(
Row( imageName: 'assets/images/windsock.png',
mainAxisAlignment: MainAxisAlignment.spaceEvenly, value: '$direction°',
children: [ desc: 'direction'.tr,
DescWeather( message: message.getDirection(direction),
imageName: 'assets/images/cloudy.png', ),
value: '$cloudcover%', DescWeather(
desc: 'cloudcover'.tr, imageName: 'assets/images/wind.png',
), value: statusData.getSpeed(wind.round()),
DescWeather( desc: 'wind'.tr,
imageName: 'assets/images/atmospheric.png', ),
value: '${pressure.round()} ${'hPa'.tr}', DescWeather(
desc: 'pressure'.tr, imageName: 'assets/images/windgusts.png',
message: message.getPressure(pressure.round()), value: statusData.getSpeed(windgusts.round()),
), desc: 'windgusts'.tr,
DescWeather( ),
imageName: 'assets/images/uv.png', DescWeather(
value: '${uvIndex.round()}', imageName: 'assets/images/evaporation.png',
desc: 'uvIndex'.tr, value: statusData.getPrecipitation(evaporation.abs()),
message: message.getUvIndex(uvIndex.round()), 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()),
), ),
], ],
), ),

View file

@ -124,7 +124,7 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
GlowText( 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( style: context.textTheme.titleLarge?.copyWith(
fontSize: 35, fontSize: 35,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
@ -158,83 +158,68 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
margin: const EdgeInsets.only(bottom: 15), margin: const EdgeInsets.only(bottom: 15),
child: Padding( child: Padding(
padding: const EdgeInsets.only(top: 20, bottom: 5), 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: [ children: [
Row( DescWeather(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, imageName: 'assets/images/cold.png',
children: [ value: statusData.getDegree(
DescWeather( widget.apparentTemperatureMin[index].round()),
imageName: 'assets/images/cold.png', desc: 'apparentTemperatureMin'.tr,
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()),
),
],
), ),
const SizedBox(height: 5), DescWeather(
Row( imageName: 'assets/images/hot.png',
mainAxisAlignment: MainAxisAlignment.spaceEvenly, value: statusData.getDegree(
children: [ widget.apparentTemperatureMax[index].round()),
DescWeather( desc: 'apparentTemperatureMax'.tr,
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,
),
],
), ),
const SizedBox(height: 5), DescWeather(
Row( imageName: 'assets/images/uv.png',
mainAxisAlignment: MainAxisAlignment.spaceEvenly, value: '${widget.uvIndexMax[index].round()}',
children: [ desc: 'uvIndex'.tr,
DescWeather( message: message
imageName: 'assets/images/humidity.png', .getUvIndex(widget.uvIndexMax[index].round()),
value: ),
'${widget.precipitationProbabilityMax[index]}%', DescWeather(
desc: 'precipitationProbabilit'.tr, imageName: 'assets/images/windsock.png',
), value: '${widget.winddirection10MDominant[index]}°',
DescWeather( desc: 'direction'.tr,
imageName: 'assets/images/water.png', message: message.getDirection(
value: statusData widget.winddirection10MDominant[index]),
.getPrecipitation(widget.rainSum[index]), ),
desc: 'rain'.tr, DescWeather(
), imageName: 'assets/images/wind.png',
DescWeather( value: statusData.getSpeed(
imageName: 'assets/images/rainfall.png', widget.windspeed10MMax[index].round()),
value: statusData.getPrecipitation( desc: 'wind'.tr,
widget.precipitationSum[index]), ),
desc: 'precipitation'.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,
), ),
], ],
), ),

View file

@ -25,7 +25,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
return Card( return Card(
margin: const EdgeInsets.only(bottom: 15), margin: const EdgeInsets.only(bottom: 15),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5), padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 20),
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
@ -50,7 +50,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
], ],
), ),
), ),
Expanded( Flexible(
child: Image.asset( child: Image.asset(
'assets/images/sunrise.png', 'assets/images/sunrise.png',
scale: 10, scale: 10,
@ -81,7 +81,7 @@ class _SunsetSunriseState extends State<SunsetSunrise> {
], ],
), ),
), ),
Expanded( Flexible(
child: Image.asset( child: Image.asset(
'assets/images/sunset.png', 'assets/images/sunset.png',
scale: 10, scale: 10,

View file

@ -14,6 +14,7 @@ import 'package:path_provider/path_provider.dart';
import 'package:rain/app/modules/home.dart'; import 'package:rain/app/modules/home.dart';
import 'package:rain/app/modules/onboarding.dart'; import 'package:rain/app/modules/onboarding.dart';
import 'package:rain/theme/theme.dart'; import 'package:rain/theme/theme.dart';
import 'package:time_machine/time_machine.dart';
import 'app/data/weather.dart'; import 'app/data/weather.dart';
import 'translation/translation.dart'; import 'translation/translation.dart';
import 'theme/theme_controller.dart'; import 'theme/theme_controller.dart';
@ -48,6 +49,7 @@ final List appLanguages = [
]; ];
void main() async { void main() async {
final String timeZoneName;
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle( SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle( const SystemUiOverlayStyle(
@ -58,6 +60,13 @@ void main() async {
if (Platform.isAndroid) { if (Platform.isAndroid) {
await setOptimalDisplayMode(); await setOptimalDisplayMode();
} }
if (Platform.isAndroid || Platform.isIOS) {
timeZoneName = await FlutterTimezone.getLocalTimezone();
} else {
timeZoneName = '${DateTimeZone.local}';
}
tz.initializeTimeZones();
tz.setLocalLocation(tz.getLocation(timeZoneName));
Connectivity() Connectivity()
.onConnectivityChanged .onConnectivityChanged
.listen((ConnectivityResult result) async { .listen((ConnectivityResult result) async {
@ -68,17 +77,18 @@ void main() async {
isDeviceConnectedNotifier.value = Future(() => false); isDeviceConnectedNotifier.value = Future(() => false);
} }
}); });
final String timeZoneName = await FlutterTimezone.getLocalTimezone();
const AndroidInitializationSettings initializationSettingsAndroid = const AndroidInitializationSettings initializationSettingsAndroid =
AndroidInitializationSettings('@mipmap/ic_launcher'); AndroidInitializationSettings('@mipmap/ic_launcher');
const DarwinInitializationSettings initializationSettingsDarwin = const DarwinInitializationSettings initializationSettingsDarwin =
DarwinInitializationSettings(); DarwinInitializationSettings();
const LinuxInitializationSettings initializationSettingsLinux =
LinuxInitializationSettings(defaultActionName: 'Rain');
const InitializationSettings initializationSettings = InitializationSettings( const InitializationSettings initializationSettings = InitializationSettings(
android: initializationSettingsAndroid, android: initializationSettingsAndroid,
iOS: initializationSettingsDarwin); iOS: initializationSettingsDarwin,
linux: initializationSettingsLinux,
);
await flutterLocalNotificationsPlugin.initialize(initializationSettings); await flutterLocalNotificationsPlugin.initialize(initializationSettings);
tz.initializeTimeZones();
tz.setLocalLocation(tz.getLocation(timeZoneName));
runApp(const MyApp()); runApp(const MyApp());
} }

View file

@ -23,9 +23,6 @@ class RainTheme {
primaryColor: lightColor, primaryColor: lightColor,
canvasColor: lightColor, canvasColor: lightColor,
scaffoldBackgroundColor: lightColor, scaffoldBackgroundColor: lightColor,
drawerTheme: baseLigth.drawerTheme.copyWith(
backgroundColor: lightColor,
),
cardTheme: baseLigth.cardTheme.copyWith( cardTheme: baseLigth.cardTheme.copyWith(
color: lightColor, color: lightColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -37,7 +34,7 @@ class RainTheme {
backgroundColor: lightColor, backgroundColor: lightColor,
), ),
colorScheme: baseLigth.colorScheme.copyWith( colorScheme: baseLigth.colorScheme.copyWith(
brightness: Brightness.dark, brightness: Brightness.light,
background: lightColor, background: lightColor,
surface: baseLigth.colorScheme.background, surface: baseLigth.colorScheme.background,
), ),
@ -83,9 +80,6 @@ class RainTheme {
primaryColor: darkColor, primaryColor: darkColor,
canvasColor: darkColor, canvasColor: darkColor,
scaffoldBackgroundColor: darkColor, scaffoldBackgroundColor: darkColor,
drawerTheme: baseDark.drawerTheme.copyWith(
backgroundColor: darkColor,
),
cardTheme: baseDark.cardTheme.copyWith( cardTheme: baseDark.cardTheme.copyWith(
color: darkColor, color: darkColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
@ -143,9 +137,6 @@ class RainTheme {
primaryColor: oledColor, primaryColor: oledColor,
canvasColor: oledColor, canvasColor: oledColor,
scaffoldBackgroundColor: oledColor, scaffoldBackgroundColor: oledColor,
drawerTheme: baseDark.drawerTheme.copyWith(
backgroundColor: oledColor,
),
cardTheme: baseDark.cardTheme.copyWith( cardTheme: baseDark.cardTheme.copyWith(
color: oledColor, color: oledColor,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

View file

@ -84,7 +84,7 @@ class Translation extends Translations {
'uvHigh': 'Высокий', 'uvHigh': 'Высокий',
'uvVeryHigh': 'Очень высокий', 'uvVeryHigh': 'Очень высокий',
'uvExtreme': 'Экстремальный', 'uvExtreme': 'Экстремальный',
'weatherMore': 'Прогноз погоды на 10 дней', 'weatherMore': 'Прогноз погоды на 7 дней',
'windgusts': 'Шквал', 'windgusts': 'Шквал',
'north': 'Север', 'north': 'Север',
'northeast': 'Северо-восток', 'northeast': 'Северо-восток',
@ -189,7 +189,7 @@ class Translation extends Translations {
'uvHigh': 'High', 'uvHigh': 'High',
'uvVeryHigh': 'Very high', 'uvVeryHigh': 'Very high',
'uvExtreme': 'Extreme', 'uvExtreme': 'Extreme',
'weatherMore': '10-day weather forecast', 'weatherMore': '7-day weather forecast',
'windgusts': 'Gust', 'windgusts': 'Gust',
'north': 'North', 'north': 'North',
'northeast': 'Northeast', 'northeast': 'Northeast',
@ -292,7 +292,7 @@ class Translation extends Translations {
'uvHigh': 'Élevé', 'uvHigh': 'Élevé',
'uvVeryHigh': 'Très élevé', 'uvVeryHigh': 'Très élevé',
'uvExtreme': 'Extrême', 'uvExtreme': 'Extrême',
'weatherMore': 'Prévisions météo pour 10 jours', 'weatherMore': 'Prévisions météo pour 7 jours',
'windgusts': 'Rafale', 'windgusts': 'Rafale',
'north': 'Nord', 'north': 'Nord',
'northeast': 'Nord-Est', 'northeast': 'Nord-Est',
@ -395,7 +395,7 @@ class Translation extends Translations {
'uvHigh': 'Alto', 'uvHigh': 'Alto',
'uvVeryHigh': 'Molto alto', 'uvVeryHigh': 'Molto alto',
'uvExtreme': 'Estremo', 'uvExtreme': 'Estremo',
'weatherMore': 'Previsioni del tempo per 10 giorni', 'weatherMore': 'Previsioni del tempo per 7 giorni',
'windgusts': 'Raffica', 'windgusts': 'Raffica',
'north': 'Nord', 'north': 'Nord',
'northeast': 'Nord-est', 'northeast': 'Nord-est',
@ -498,7 +498,7 @@ class Translation extends Translations {
'uvHigh': 'Hoch', 'uvHigh': 'Hoch',
'uvVeryHigh': 'Sehr hoch', 'uvVeryHigh': 'Sehr hoch',
'uvExtreme': 'Extrem', 'uvExtreme': 'Extrem',
'weatherMore': '10-Tage-Wettervorhersage', 'weatherMore': '7-Tage-Wettervorhersage',
'windgusts': 'Böe', 'windgusts': 'Böe',
'north': 'Norden', 'north': 'Norden',
'northeast': 'Nordosten', 'northeast': 'Nordosten',
@ -600,7 +600,7 @@ class Translation extends Translations {
'uvHigh': 'Yüksek', 'uvHigh': 'Yüksek',
'uvVeryHigh': 'Çok yüksek', 'uvVeryHigh': 'Çok yüksek',
'uvExtreme': 'ırı', 'uvExtreme': 'ırı',
'weatherMore': '10 günlük hava tahmini', 'weatherMore': '7 günlük hava tahmini',
'windgusts': 'Bir telaş', 'windgusts': 'Bir telaş',
'north': 'Kuzey', 'north': 'Kuzey',
'northeast': 'Kuzeydoğu', 'northeast': 'Kuzeydoğu',
@ -702,7 +702,7 @@ class Translation extends Translations {
'uvHigh': 'Alto', 'uvHigh': 'Alto',
'uvVeryHigh': 'Muito alto', 'uvVeryHigh': 'Muito alto',
'uvExtreme': 'Extremo', 'uvExtreme': 'Extremo',
'weatherMore': 'Previsão do tempo para 10 dias', 'weatherMore': 'Previsão do tempo para 7 dias',
'windgusts': 'Rajadas', 'windgusts': 'Rajadas',
'north': 'Norte', 'north': 'Norte',
'northeast': 'Nordeste', 'northeast': 'Nordeste',
@ -805,7 +805,7 @@ class Translation extends Translations {
'uvHigh': 'Alto', 'uvHigh': 'Alto',
'uvVeryHigh': 'Muy alto', 'uvVeryHigh': 'Muy alto',
'uvExtreme': 'Extremo', 'uvExtreme': 'Extremo',
'weatherMore': 'Pronóstico del tiempo para 10 días', 'weatherMore': 'Pronóstico del tiempo para 7 días',
'windgusts': 'Ráfagas', 'windgusts': 'Ráfagas',
'north': 'Norte', 'north': 'Norte',
'northeast': 'Noreste', 'northeast': 'Noreste',
@ -907,7 +907,7 @@ class Translation extends Translations {
'uvHigh': 'Vysoký', 'uvHigh': 'Vysoký',
'uvVeryHigh': 'Veľmi vysoký', 'uvVeryHigh': 'Veľmi vysoký',
'uvExtreme': 'Extrémny', 'uvExtreme': 'Extrémny',
'weatherMore': 'Predpoveď počasia na 10 dní', 'weatherMore': 'Predpoveď počasia na 7 dní',
'windgusts': 'Squall', 'windgusts': 'Squall',
'north': 'Sever', 'north': 'Sever',
'northeast': 'Severo-Východ', 'northeast': 'Severo-Východ',
@ -1010,7 +1010,7 @@ class Translation extends Translations {
'uvHigh': 'Hoog', 'uvHigh': 'Hoog',
'uvVeryHigh': 'Erg hoog', 'uvVeryHigh': 'Erg hoog',
'uvExtreme': 'Extreem', 'uvExtreme': 'Extreem',
'weatherMore': '10-daagse weersverwachting', 'weatherMore': '7-daagse weersverwachting',
'windgusts': 'Windstoten', 'windgusts': 'Windstoten',
'north': 'Noord', 'north': 'Noord',
'northeast': 'Noordoost', 'northeast': 'Noordoost',
@ -1110,7 +1110,7 @@ class Translation extends Translations {
'uvHigh': 'उच्च', 'uvHigh': 'उच्च',
'uvVeryHigh': 'बहुत उच्च', 'uvVeryHigh': 'बहुत उच्च',
'uvExtreme': 'अत्यधिक', 'uvExtreme': 'अत्यधिक',
'weatherMore': '10-दिवसीय मौसम पूर', 'weatherMore': '7-दिवसीय मौसम पूर',
'windgusts': 'गुस्त', 'windgusts': 'गुस्त',
'north': 'उत्तर', 'north': 'उत्तर',
'northeast': 'उत्तर-पूर्व', 'northeast': 'उत्तर-पूर्व',

View file

@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) { if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar)); 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_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else { } else {
gtk_window_set_title(window, "rain"); gtk_window_set_title(window, "Rain");
} }
gtk_window_set_default_size(window, 1280, 720); gtk_window_set_default_size(window, 1280, 720);

View file

@ -261,10 +261,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: file name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "7.0.0" version: "6.1.4"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
@ -373,6 +373,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
geoclue:
dependency: transitive
description:
name: geoclue
sha256: c2a998c77474fc57aa00c6baa2928e58f4b267649057a1c76738656e9dbd2a7f
url: "https://pub.dev"
source: hosted
version: "0.1.1"
geocoding: geocoding:
dependency: "direct main" dependency: "direct main"
description: description:
@ -429,6 +437,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.7" 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: geolocator_platform_interface:
dependency: transitive dependency: transitive
description: description:
@ -485,6 +501,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.1" version: "2.3.1"
gsettings:
dependency: transitive
description:
name: gsettings
sha256: fe90d719e09a6f36607021047e642068a0c98839d9633db00b91633420ae8b0d
url: "https://pub.dev"
source: hosted
version: "0.2.7"
home_widget: home_widget:
dependency: "direct main" dependency: "direct main"
description: description:
@ -789,6 +813,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.5.1" version: "1.5.1"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
pub_semver: pub_semver:
dependency: transitive dependency: transitive
description: description:
@ -914,6 +946,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.3" 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: timezone:
dependency: "direct main" dependency: "direct main"
description: description:
@ -1062,10 +1102,10 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: xdg_directories name: xdg_directories
sha256: e0b1147eec179d3911f1f19b59206448f78195ca1d20514134e10641b7d7fbff sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.1" version: "0.2.0+3"
xml: xml:
dependency: transitive dependency: transitive
description: description:
@ -1091,5 +1131,5 @@ packages:
source: hosted source: hosted
version: "3.1.2" version: "3.1.2"
sdks: sdks:
dart: ">=3.0.0 <4.0.0" dart: ">=3.0.6 <4.0.0"
flutter: ">=3.10.0" flutter: ">=3.10.0"

View file

@ -6,7 +6,7 @@ publish_to: "none"
version: 1.2.0+23 version: 1.2.0+23
environment: environment:
sdk: ">=3.0.0 <4.0.0" sdk: ">=3.0.6 <4.0.0"
dependencies: dependencies:
flutter: flutter:
@ -26,9 +26,11 @@ dependencies:
home_widget: ^0.3.0 home_widget: ^0.3.0
google_fonts: ^5.1.0 google_fonts: ^5.1.0
flutter_glow: ^0.3.0 flutter_glow: ^0.3.0
time_machine: ^0.9.17
url_launcher: ^6.1.12 url_launcher: ^6.1.12
dynamic_color: ^1.6.6 dynamic_color: ^1.6.6
path_provider: ^2.0.15 path_provider: ^2.0.15
geolocator_linux: ^0.1.0
flutter_timezone: ^1.0.7 flutter_timezone: ^1.0.7
package_info_plus: ^4.0.2 package_info_plus: ^4.0.2
connectivity_plus: ^4.0.1 connectivity_plus: ^4.0.1