mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 20:19:58 +00:00
Update dependencies
This commit is contained in:
parent
6d249bd7a6
commit
c7798bc4d6
15 changed files with 436 additions and 276 deletions
|
@ -29,7 +29,7 @@ if (keystorePropertiesFile.exists()) {
|
|||
}
|
||||
|
||||
android {
|
||||
compileSdk 34
|
||||
compileSdkVersion 34
|
||||
ndkVersion flutter.ndkVersion
|
||||
|
||||
compileOptions {
|
||||
|
@ -78,7 +78,7 @@ android {
|
|||
}
|
||||
|
||||
namespace 'com.yoshi.rain'
|
||||
}
|
||||
}
|
||||
|
||||
flutter {
|
||||
source '../..'
|
||||
|
|
|
@ -7,7 +7,8 @@ import 'package:rain/app/data/weather.dart';
|
|||
import 'package:rain/main.dart';
|
||||
|
||||
class WeatherAPI {
|
||||
final Dio dio = Dio()..options.baseUrl = 'https://api.open-meteo.com/v1/forecast?';
|
||||
final Dio dio = Dio()
|
||||
..options.baseUrl = 'https://api.open-meteo.com/v1/forecast?';
|
||||
final Dio dioLocation = Dio();
|
||||
|
||||
Future<MainWeatherCache> getWeatherData(double? lat, double? lon) async {
|
||||
|
@ -15,7 +16,8 @@ class WeatherAPI {
|
|||
'latitude=$lat&longitude=$lon&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,precipitation,rain,weathercode,surface_pressure,visibility,evapotranspiration,windspeed_10m,winddirection_10m,windgusts_10m,cloudcover,uv_index,dewpoint_2m,precipitation_probability,shortwave_radiation&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=12&timezone=auto';
|
||||
String urlWeather;
|
||||
settings.measurements == 'imperial' && settings.degrees == 'fahrenheit'
|
||||
? urlWeather = '$url&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch'
|
||||
? urlWeather =
|
||||
'$url&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch'
|
||||
: settings.measurements == 'imperial'
|
||||
? urlWeather = '$url&windspeed_unit=mph&precipitation_unit=inch'
|
||||
: settings.degrees == 'fahrenheit'
|
||||
|
@ -52,7 +54,8 @@ class WeatherAPI {
|
|||
sunrise: weatherData.daily.sunrise,
|
||||
sunset: weatherData.daily.sunset,
|
||||
precipitationSum: weatherData.daily.precipitationSum,
|
||||
precipitationProbabilityMax: weatherData.daily.precipitationProbabilityMax,
|
||||
precipitationProbabilityMax:
|
||||
weatherData.daily.precipitationProbabilityMax,
|
||||
windspeed10MMax: weatherData.daily.windSpeed10MMax,
|
||||
windgusts10MMax: weatherData.daily.windGusts10MMax,
|
||||
uvIndexMax: weatherData.daily.uvIndexMax,
|
||||
|
@ -69,12 +72,14 @@ class WeatherAPI {
|
|||
}
|
||||
}
|
||||
|
||||
Future<WeatherCard> getWeatherCard(double? lat, double? lon, String city, String district, String timezone) async {
|
||||
Future<WeatherCard> getWeatherCard(double? lat, double? lon, String city,
|
||||
String district, String timezone) async {
|
||||
String url =
|
||||
'latitude=$lat&longitude=$lon&hourly=temperature_2m,relativehumidity_2m,apparent_temperature,precipitation,rain,weathercode,surface_pressure,visibility,evapotranspiration,windspeed_10m,winddirection_10m,windgusts_10m,cloudcover,uv_index,dewpoint_2m,precipitation_probability,shortwave_radiation&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=12&timezone=auto';
|
||||
String urlWeather;
|
||||
settings.measurements == 'imperial' && settings.degrees == 'fahrenheit'
|
||||
? urlWeather = '$url&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch'
|
||||
? urlWeather =
|
||||
'$url&temperature_unit=fahrenheit&windspeed_unit=mph&precipitation_unit=inch'
|
||||
: settings.measurements == 'imperial'
|
||||
? urlWeather = '$url&windspeed_unit=mph&precipitation_unit=inch'
|
||||
: settings.degrees == 'fahrenheit'
|
||||
|
@ -111,7 +116,8 @@ class WeatherAPI {
|
|||
sunrise: weatherData.daily.sunrise,
|
||||
sunset: weatherData.daily.sunset,
|
||||
precipitationSum: weatherData.daily.precipitationSum,
|
||||
precipitationProbabilityMax: weatherData.daily.precipitationProbabilityMax,
|
||||
precipitationProbabilityMax:
|
||||
weatherData.daily.precipitationProbabilityMax,
|
||||
windspeed10MMax: weatherData.daily.windSpeed10MMax,
|
||||
windgusts10MMax: weatherData.daily.windGusts10MMax,
|
||||
uvIndexMax: weatherData.daily.uvIndexMax,
|
||||
|
|
|
@ -13,7 +13,8 @@ class WeatherDataApi with _$WeatherDataApi {
|
|||
required String timezone,
|
||||
}) = _WeatherDataApi;
|
||||
|
||||
factory WeatherDataApi.fromJson(Map<String, dynamic> json) => _$WeatherDataApiFromJson(json);
|
||||
factory WeatherDataApi.fromJson(Map<String, dynamic> json) =>
|
||||
_$WeatherDataApiFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
|
@ -35,14 +36,16 @@ class Hourly with _$Hourly {
|
|||
@JsonKey(name: 'cloudcover') List<int?>? cloudCover,
|
||||
@JsonKey(name: 'uv_index') List<double?>? uvIndex,
|
||||
@JsonKey(name: 'dewpoint_2m') List<double?>? dewpoint2M,
|
||||
@JsonKey(name: 'precipitation_probability') List<int?>? precipitationProbability,
|
||||
@JsonKey(name: 'precipitation_probability')
|
||||
List<int?>? precipitationProbability,
|
||||
@JsonKey(name: 'shortwave_radiation') List<double?>? shortwaveRadiation,
|
||||
}) = _Hourly;
|
||||
|
||||
factory Hourly.fromJson(Map<String, dynamic> json) => _$HourlyFromJson(json);
|
||||
}
|
||||
|
||||
List<DateTime> _dateTimeFromJson(List<dynamic>? json) => json?.map((x) => DateTime.parse(x)).toList() ?? [];
|
||||
List<DateTime> _dateTimeFromJson(List<dynamic>? json) =>
|
||||
json?.map((x) => DateTime.parse(x)).toList() ?? [];
|
||||
|
||||
@freezed
|
||||
class Daily with _$Daily {
|
||||
|
@ -51,17 +54,21 @@ class Daily with _$Daily {
|
|||
@JsonKey(name: 'weathercode') List<int?>? weatherCode,
|
||||
@JsonKey(name: 'temperature_2m_max') List<double?>? temperature2MMax,
|
||||
@JsonKey(name: 'temperature_2m_min') List<double?>? temperature2MMin,
|
||||
@JsonKey(name: 'apparent_temperature_max') List<double?>? apparentTemperatureMax,
|
||||
@JsonKey(name: 'apparent_temperature_min') List<double?>? apparentTemperatureMin,
|
||||
@JsonKey(name: 'apparent_temperature_max')
|
||||
List<double?>? apparentTemperatureMax,
|
||||
@JsonKey(name: 'apparent_temperature_min')
|
||||
List<double?>? apparentTemperatureMin,
|
||||
@JsonKey(name: 'precipitation_sum') List<double?>? precipitationSum,
|
||||
List<String>? sunrise,
|
||||
List<String>? sunset,
|
||||
@JsonKey(name: 'precipitation_probability_max') List<int?>? precipitationProbabilityMax,
|
||||
@JsonKey(name: 'precipitation_probability_max')
|
||||
List<int?>? precipitationProbabilityMax,
|
||||
@JsonKey(name: 'windspeed_10m_max') List<double?>? windSpeed10MMax,
|
||||
@JsonKey(name: 'windgusts_10m_max') List<double?>? windGusts10MMax,
|
||||
@JsonKey(name: 'uv_index_max') List<double?>? uvIndexMax,
|
||||
@JsonKey(name: 'rain_sum') List<double?>? rainSum,
|
||||
@JsonKey(name: 'winddirection_10m_dominant') List<int?>? windDirection10MDominant,
|
||||
@JsonKey(name: 'winddirection_10m_dominant')
|
||||
List<int?>? windDirection10MDominant,
|
||||
}) = _Daily;
|
||||
|
||||
factory Daily.fromJson(Map<String, dynamic> json) => _$DailyFromJson(json);
|
||||
|
|
|
@ -291,7 +291,8 @@ class WeatherCard {
|
|||
time: List<String>.from(json['time'] ?? []),
|
||||
weathercode: List<int>.from(json['weathercode'] ?? []),
|
||||
temperature2M: List<double>.from(json['temperature2M'] ?? []),
|
||||
apparentTemperature: List<double?>.from(json['apparentTemperature'] ?? []),
|
||||
apparentTemperature:
|
||||
List<double?>.from(json['apparentTemperature'] ?? []),
|
||||
relativehumidity2M: List<int?>.from(json['relativehumidity2M'] ?? []),
|
||||
precipitation: List<double>.from(json['precipitation'] ?? []),
|
||||
rain: List<double?>.from(json['rain'] ?? []),
|
||||
|
@ -304,21 +305,26 @@ class WeatherCard {
|
|||
cloudcover: List<int?>.from(json['cloudcover'] ?? []),
|
||||
uvIndex: List<double?>.from(json['uvIndex'] ?? []),
|
||||
dewpoint2M: List<double?>.from(json['dewpoint2M'] ?? []),
|
||||
precipitationProbability: List<int?>.from(json['precipitationProbability'] ?? []),
|
||||
precipitationProbability:
|
||||
List<int?>.from(json['precipitationProbability'] ?? []),
|
||||
shortwaveRadiation: List<double?>.from(json['shortwaveRadiation'] ?? []),
|
||||
timeDaily: List<DateTime>.from(json['timeDaily'] ?? []),
|
||||
weathercodeDaily: List<int?>.from(json['weathercodeDaily'] ?? []),
|
||||
temperature2MMax: List<double?>.from(json['temperature2MMax'] ?? []),
|
||||
temperature2MMin: List<double?>.from(json['temperature2MMin'] ?? []),
|
||||
apparentTemperatureMax: List<double?>.from(json['apparentTemperatureMax'] ?? []),
|
||||
apparentTemperatureMin: List<double?>.from(json['apparentTemperatureMin'] ?? []),
|
||||
apparentTemperatureMax:
|
||||
List<double?>.from(json['apparentTemperatureMax'] ?? []),
|
||||
apparentTemperatureMin:
|
||||
List<double?>.from(json['apparentTemperatureMin'] ?? []),
|
||||
windspeed10MMax: List<double?>.from(json['windspeed10MMax'] ?? []),
|
||||
windgusts10MMax: List<double?>.from(json['windgusts10MMax'] ?? []),
|
||||
uvIndexMax: List<double?>.from(json['uvIndexMax'] ?? []),
|
||||
rainSum: List<double?>.from(json['rainSum'] ?? []),
|
||||
winddirection10MDominant: List<int?>.from(json['winddirection10MDominant'] ?? []),
|
||||
winddirection10MDominant:
|
||||
List<int?>.from(json['winddirection10MDominant'] ?? []),
|
||||
precipitationSum: List<double?>.from(json['precipitationSum'] ?? []),
|
||||
precipitationProbabilityMax: List<int?>.from(json['precipitationProbabilityMax'] ?? []),
|
||||
precipitationProbabilityMax:
|
||||
List<int?>.from(json['precipitationProbabilityMax'] ?? []),
|
||||
sunrise: List<String>.from(json['sunrise'] ?? []),
|
||||
sunset: List<String>.from(json['sunset'] ?? []),
|
||||
lat: json['lat'],
|
||||
|
|
|
@ -37,8 +37,10 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
void getTime() {
|
||||
final weatherCard = widget.weatherCard;
|
||||
|
||||
timeNow = weatherController.getTime(weatherCard.time!, weatherCard.timezone!);
|
||||
dayNow = weatherController.getDay(weatherCard.timeDaily!, weatherCard.timezone!);
|
||||
timeNow =
|
||||
weatherController.getTime(weatherCard.time!, weatherCard.timezone!);
|
||||
dayNow =
|
||||
weatherController.getDay(weatherCard.timeDaily!, weatherCard.timezone!);
|
||||
Future.delayed(const Duration(milliseconds: 30), () {
|
||||
itemScrollController.scrollTo(
|
||||
index: timeNow,
|
||||
|
@ -97,7 +99,8 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
child: SizedBox(
|
||||
height: 136,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
child: ScrollablePositionedList.separated(
|
||||
key: const PageStorageKey(1),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
|
@ -124,7 +127,9 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
vertical: 5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: i == timeNow ? context.theme.colorScheme.primaryContainer : Colors.transparent,
|
||||
color: i == timeNow
|
||||
? context.theme.colorScheme.primaryContainer
|
||||
: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
|
@ -160,7 +165,8 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
windgusts: weatherCard.windgusts10M?[timeNow],
|
||||
uvIndex: weatherCard.uvIndex?[timeNow],
|
||||
dewpoint2M: weatherCard.dewpoint2M?[timeNow],
|
||||
precipitationProbability: weatherCard.precipitationProbability?[timeNow],
|
||||
precipitationProbability:
|
||||
weatherCard.precipitationProbability?[timeNow],
|
||||
shortwaveRadiation: weatherCard.shortwaveRadiation?[timeNow],
|
||||
),
|
||||
WeatherDaily(
|
||||
|
|
|
@ -25,103 +25,108 @@ class _ListWeatherCardState extends State<ListWeatherCard> {
|
|||
setState(() {});
|
||||
},
|
||||
child: Obx(
|
||||
() => weatherController.weatherCards.isEmpty
|
||||
() => weatherController.weatherCards.isEmpty
|
||||
? Center(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/add_weather.png',
|
||||
scale: 6,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.size.width * 0.8,
|
||||
child: Text(
|
||||
'noWeatherCard'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ReorderableListView(
|
||||
onReorder: (oldIndex, newIndex) => weatherController.reorder(oldIndex, newIndex),
|
||||
children: [
|
||||
...weatherController.weatherCards.map(
|
||||
(weatherCardList) => Dismissible(
|
||||
key: ValueKey(weatherCardList),
|
||||
direction: DismissDirection.endToStart,
|
||||
background: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
child: Icon(
|
||||
Iconsax.trush_square,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
confirmDismiss: (DismissDirection direction) async {
|
||||
return await showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog.adaptive(
|
||||
title: Text(
|
||||
'deletedCardWeather'.tr,
|
||||
style: textTheme.titleLarge,
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(
|
||||
'assets/images/add_weather.png',
|
||||
scale: 6,
|
||||
),
|
||||
SizedBox(
|
||||
width: Get.size.width * 0.8,
|
||||
child: Text(
|
||||
'noWeatherCard'.tr,
|
||||
textAlign: TextAlign.center,
|
||||
style: titleMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 18,
|
||||
),
|
||||
),
|
||||
content: Text('deletedCardWeatherQuery'.tr, style: titleMedium),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: false),
|
||||
child: Text(
|
||||
'cancel'.tr,
|
||||
style: titleMedium?.copyWith(color: Colors.blueAccent),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: true),
|
||||
child: Text(
|
||||
'delete'.tr,
|
||||
style: titleMedium?.copyWith(color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
onDismissed: (DismissDirection direction) async {
|
||||
await weatherController.deleteCardWeather(weatherCardList);
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.to(
|
||||
() => InfoWeatherCard(
|
||||
weatherCard: weatherCardList,
|
||||
),
|
||||
transition: Transition.downToUp,
|
||||
),
|
||||
child: WeatherCardContainer(
|
||||
time: weatherCardList.time!,
|
||||
timeDaily: weatherCardList.timeDaily!,
|
||||
timeDay: weatherCardList.sunrise!,
|
||||
timeNight: weatherCardList.sunset!,
|
||||
weather: weatherCardList.weathercode!,
|
||||
degree: weatherCardList.temperature2M!,
|
||||
district: weatherCardList.district!,
|
||||
city: weatherCardList.city!,
|
||||
timezone: weatherCardList.timezone!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: ReorderableListView(
|
||||
onReorder: (oldIndex, newIndex) =>
|
||||
weatherController.reorder(oldIndex, newIndex),
|
||||
children: [
|
||||
...weatherController.weatherCards.map(
|
||||
(weatherCardList) => Dismissible(
|
||||
key: ValueKey(weatherCardList),
|
||||
direction: DismissDirection.endToStart,
|
||||
background: Container(
|
||||
alignment: Alignment.centerRight,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
child: Icon(
|
||||
Iconsax.trush_square,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
confirmDismiss: (DismissDirection direction) async {
|
||||
return await showAdaptiveDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog.adaptive(
|
||||
title: Text(
|
||||
'deletedCardWeather'.tr,
|
||||
style: textTheme.titleLarge,
|
||||
),
|
||||
content: Text('deletedCardWeatherQuery'.tr,
|
||||
style: titleMedium),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: false),
|
||||
child: Text(
|
||||
'cancel'.tr,
|
||||
style: titleMedium?.copyWith(
|
||||
color: Colors.blueAccent),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: true),
|
||||
child: Text(
|
||||
'delete'.tr,
|
||||
style: titleMedium?.copyWith(
|
||||
color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
onDismissed: (DismissDirection direction) async {
|
||||
await weatherController
|
||||
.deleteCardWeather(weatherCardList);
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.to(
|
||||
() => InfoWeatherCard(
|
||||
weatherCard: weatherCardList,
|
||||
),
|
||||
transition: Transition.downToUp,
|
||||
),
|
||||
child: WeatherCardContainer(
|
||||
time: weatherCardList.time!,
|
||||
timeDaily: weatherCardList.timeDaily!,
|
||||
timeDay: weatherCardList.sunrise!,
|
||||
timeNight: weatherCardList.sunset!,
|
||||
weather: weatherCardList.weathercode!,
|
||||
degree: weatherCardList.temperature2M!,
|
||||
district: weatherCardList.district!,
|
||||
city: weatherCardList.city!,
|
||||
timezone: weatherCardList.timezone!,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -108,15 +108,18 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
RawAutocomplete<Result>(
|
||||
focusNode: _focusNode,
|
||||
textEditingController: _controller,
|
||||
fieldViewBuilder: (BuildContext context, TextEditingController fieldTextEditingController,
|
||||
FocusNode fieldFocusNode, VoidCallback onFieldSubmitted) {
|
||||
fieldViewBuilder: (BuildContext context,
|
||||
TextEditingController fieldTextEditingController,
|
||||
FocusNode fieldFocusNode,
|
||||
VoidCallback onFieldSubmitted) {
|
||||
return MyTextForm(
|
||||
elevation: kTextFieldElevation,
|
||||
labelText: 'search'.tr,
|
||||
type: TextInputType.text,
|
||||
icon: const Icon(Iconsax.global_search),
|
||||
controller: _controller,
|
||||
margin: const EdgeInsets.only(left: 10, right: 10, top: 10),
|
||||
margin:
|
||||
const EdgeInsets.only(left: 10, right: 10, top: 10),
|
||||
focusNode: _focusNode,
|
||||
);
|
||||
},
|
||||
|
@ -124,12 +127,15 @@ class _CreateWeatherCardState extends State<CreateWeatherCard> {
|
|||
if (textEditingValue.text.isEmpty) {
|
||||
return const Iterable<Result>.empty();
|
||||
}
|
||||
return WeatherAPI().getCity(textEditingValue.text, locale);
|
||||
return WeatherAPI()
|
||||
.getCity(textEditingValue.text, locale);
|
||||
},
|
||||
onSelected: (Result selection) => fillController(selection),
|
||||
displayStringForOption: (Result option) => '${option.name}, ${option.admin1}',
|
||||
optionsViewBuilder:
|
||||
(BuildContext context, AutocompleteOnSelected<Result> onSelected, Iterable<Result> options) {
|
||||
displayStringForOption: (Result option) =>
|
||||
'${option.name}, ${option.admin1}',
|
||||
optionsViewBuilder: (BuildContext context,
|
||||
AutocompleteOnSelected<Result> onSelected,
|
||||
Iterable<Result> options) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Align(
|
||||
|
|
|
@ -82,7 +82,8 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
child: SizedBox(
|
||||
height: 136,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
child: ScrollablePositionedList.separated(
|
||||
key: const PageStorageKey(0),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
|
@ -94,7 +95,8 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
);
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemScrollController: weatherController.itemScrollController,
|
||||
itemScrollController:
|
||||
weatherController.itemScrollController,
|
||||
itemCount: mainWeather.time!.length,
|
||||
itemBuilder: (ctx, i) {
|
||||
final i24 = (i / 24).floor();
|
||||
|
@ -112,8 +114,10 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
vertical: 5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color:
|
||||
i == hourOfDay ? context.theme.colorScheme.primaryContainer : Colors.transparent,
|
||||
color: i == hourOfDay
|
||||
? context
|
||||
.theme.colorScheme.primaryContainer
|
||||
: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
|
@ -150,8 +154,10 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
windgusts: mainWeather.windgusts10M?[hourOfDay],
|
||||
uvIndex: mainWeather.uvIndex?[hourOfDay],
|
||||
dewpoint2M: mainWeather.dewpoint2M?[hourOfDay],
|
||||
precipitationProbability: mainWeather.precipitationProbability?[hourOfDay],
|
||||
shortwaveRadiation: mainWeather.shortwaveRadiation?[hourOfDay],
|
||||
precipitationProbability:
|
||||
mainWeather.precipitationProbability?[hourOfDay],
|
||||
shortwaveRadiation:
|
||||
mainWeather.shortwaveRadiation?[hourOfDay],
|
||||
),
|
||||
WeatherDaily(
|
||||
weatherData: weatherCard,
|
||||
|
|
|
@ -57,7 +57,7 @@ class _OnboardingPageState extends State<OnboardingPage> {
|
|||
settings.onboard = true;
|
||||
isar.writeTxnSync(() => isar.settings.putSync(settings));
|
||||
Get.off(
|
||||
() => const HomePage(),
|
||||
() => const HomePage(),
|
||||
transition: Transition.downToUp,
|
||||
);
|
||||
},
|
||||
|
|
|
@ -59,10 +59,6 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = context.theme;
|
||||
final textTheme = context.textTheme;
|
||||
final titleMedium = textTheme.titleMedium;
|
||||
final titleLarge = textTheme.titleLarge;
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
|
@ -85,7 +81,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'appearance'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
|
@ -96,21 +92,26 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
text: 'theme'.tr,
|
||||
dropdown: true,
|
||||
dropdownName: settings.theme?.tr,
|
||||
dropdownList: <String>['system'.tr, 'dark'.tr, 'light'.tr],
|
||||
dropdownList: <String>[
|
||||
'system'.tr,
|
||||
'dark'.tr,
|
||||
'light'.tr
|
||||
],
|
||||
dropdownCange: (String? newValue) {
|
||||
final newThemeMode = newValue?.tr;
|
||||
final darkTheme = 'dark'.tr;
|
||||
final systemTheme = 'system'.tr;
|
||||
ThemeMode themeMode = newThemeMode == systemTheme
|
||||
? ThemeMode.system
|
||||
: newThemeMode == darkTheme
|
||||
? ThemeMode.dark
|
||||
: ThemeMode.light;
|
||||
ThemeMode themeMode =
|
||||
newThemeMode == systemTheme
|
||||
? ThemeMode.system
|
||||
: newThemeMode == darkTheme
|
||||
? ThemeMode.dark
|
||||
: ThemeMode.light;
|
||||
String theme = newThemeMode == systemTheme
|
||||
? 'system'
|
||||
: newThemeMode == darkTheme
|
||||
? 'dark'
|
||||
: 'light';
|
||||
? 'dark'
|
||||
: 'light';
|
||||
themeController.saveTheme(theme);
|
||||
themeController.changeThemeMode(themeMode);
|
||||
setState(() {});
|
||||
|
@ -124,7 +125,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
value: settings.amoledTheme,
|
||||
onChange: (value) {
|
||||
themeController.saveOledTheme(value);
|
||||
MyApp.updateAppState(context, newAmoledTheme: value);
|
||||
MyApp.updateAppState(context,
|
||||
newAmoledTheme: value);
|
||||
},
|
||||
),
|
||||
SettingCard(
|
||||
|
@ -135,7 +137,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
value: settings.materialColor,
|
||||
onChange: (value) {
|
||||
themeController.saveMaterialTheme(value);
|
||||
MyApp.updateAppState(context, newMaterialColor: value);
|
||||
MyApp.updateAppState(context,
|
||||
newMaterialColor: value);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
|
@ -166,7 +169,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'functions'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
|
@ -179,7 +182,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
value: settings.location,
|
||||
onChange: (value) async {
|
||||
if (value) {
|
||||
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
||||
bool serviceEnabled = await Geolocator
|
||||
.isLocationServiceEnabled();
|
||||
if (!serviceEnabled) {
|
||||
if (!mounted) return;
|
||||
await showAdaptiveDialog(
|
||||
|
@ -188,25 +192,36 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
return AlertDialog.adaptive(
|
||||
title: Text(
|
||||
'location'.tr,
|
||||
style: titleLarge,
|
||||
style: context.textTheme.titleLarge,
|
||||
),
|
||||
content: Text('no_location'.tr, style: titleMedium),
|
||||
content: Text('no_location'.tr,
|
||||
style: context
|
||||
.textTheme.titleMedium),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Get.back(result: false),
|
||||
onPressed: () =>
|
||||
Get.back(result: false),
|
||||
child: Text(
|
||||
'cancel'.tr,
|
||||
style: titleMedium?.copyWith(color: Colors.blueAccent),
|
||||
style: context
|
||||
.textTheme.titleMedium
|
||||
?.copyWith(
|
||||
color:
|
||||
Colors.blueAccent),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
Geolocator.openLocationSettings();
|
||||
Geolocator
|
||||
.openLocationSettings();
|
||||
Get.back(result: true);
|
||||
},
|
||||
child: Text(
|
||||
'settings'.tr,
|
||||
style: titleMedium?.copyWith(color: Colors.green),
|
||||
style: context
|
||||
.textTheme.titleMedium
|
||||
?.copyWith(
|
||||
color: Colors.green),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
@ -232,23 +247,28 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
switcher: true,
|
||||
value: settings.notifications,
|
||||
onChange: (value) async {
|
||||
final resultExact = await flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestExactAlarmsPermission();
|
||||
final resultExact =
|
||||
await flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestExactAlarmsPermission();
|
||||
final result = Platform.isIOS
|
||||
? await flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<IOSFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermissions()
|
||||
.resolvePlatformSpecificImplementation<
|
||||
IOSFlutterLocalNotificationsPlugin>()
|
||||
?.requestPermissions()
|
||||
: await flutterLocalNotificationsPlugin
|
||||
.resolvePlatformSpecificImplementation<AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestNotificationsPermission();
|
||||
.resolvePlatformSpecificImplementation<
|
||||
AndroidFlutterLocalNotificationsPlugin>()
|
||||
?.requestNotificationsPermission();
|
||||
if (result != null && resultExact != null) {
|
||||
isar.writeTxnSync(() {
|
||||
settings.notifications = value;
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
if (value) {
|
||||
weatherController.notlification(weatherController.mainWeather);
|
||||
weatherController.notlification(
|
||||
weatherController.mainWeather);
|
||||
} else {
|
||||
flutterLocalNotificationsPlugin.cancelAll();
|
||||
}
|
||||
|
@ -274,10 +294,12 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
settings.timeRange = int.parse(newValue!);
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
MyApp.updateAppState(context, newTimeRange: int.parse(newValue!));
|
||||
MyApp.updateAppState(context,
|
||||
newTimeRange: int.parse(newValue!));
|
||||
if (settings.notifications) {
|
||||
flutterLocalNotificationsPlugin.cancelAll();
|
||||
weatherController.notlification(weatherController.mainWeather);
|
||||
weatherController.notlification(
|
||||
weatherController.mainWeather);
|
||||
}
|
||||
},
|
||||
),
|
||||
|
@ -289,19 +311,28 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
infoSettings: true,
|
||||
infoWidget: _TextInfo(
|
||||
info: settings.timeformat == '12'
|
||||
? DateFormat.jm().format(
|
||||
DateFormat.Hm().parse(weatherController.timeConvert(timeStart).format(context)))
|
||||
? DateFormat.jm().format(DateFormat.Hm()
|
||||
.parse(weatherController
|
||||
.timeConvert(timeStart)
|
||||
.format(context)))
|
||||
: DateFormat.Hm().format(DateFormat.Hm()
|
||||
.parse(weatherController.timeConvert(timeStart).format(context))),
|
||||
.parse(weatherController
|
||||
.timeConvert(timeStart)
|
||||
.format(context))),
|
||||
),
|
||||
onPressed: () async {
|
||||
final TimeOfDay? timeStartPicker = await showTimePicker(
|
||||
final TimeOfDay? timeStartPicker =
|
||||
await showTimePicker(
|
||||
context: context,
|
||||
initialTime: weatherController.timeConvert(timeStart),
|
||||
initialTime:
|
||||
weatherController.timeConvert(timeStart),
|
||||
builder: (context, child) {
|
||||
final Widget mediaQueryWrapper = MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
alwaysUse24HourFormat: settings.timeformat == '12' ? false : true,
|
||||
alwaysUse24HourFormat:
|
||||
settings.timeformat == '12'
|
||||
? false
|
||||
: true,
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
|
@ -310,14 +341,18 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
);
|
||||
if (timeStartPicker != null) {
|
||||
isar.writeTxnSync(() {
|
||||
settings.timeStart = timeStartPicker.format(context);
|
||||
settings.timeStart =
|
||||
timeStartPicker.format(context);
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
if (!mounted) return;
|
||||
MyApp.updateAppState(context, newTimeStart: timeStartPicker.format(context));
|
||||
MyApp.updateAppState(context,
|
||||
newTimeStart:
|
||||
timeStartPicker.format(context));
|
||||
if (settings.notifications) {
|
||||
flutterLocalNotificationsPlugin.cancelAll();
|
||||
weatherController.notlification(weatherController.mainWeather);
|
||||
weatherController.notlification(
|
||||
weatherController.mainWeather);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -330,19 +365,28 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
infoSettings: true,
|
||||
infoWidget: _TextInfo(
|
||||
info: settings.timeformat == '12'
|
||||
? DateFormat.jm().format(
|
||||
DateFormat.Hm().parse(weatherController.timeConvert(timeEnd).format(context)))
|
||||
: DateFormat.Hm().format(
|
||||
DateFormat.Hm().parse(weatherController.timeConvert(timeEnd).format(context))),
|
||||
? DateFormat.jm().format(DateFormat.Hm()
|
||||
.parse(weatherController
|
||||
.timeConvert(timeEnd)
|
||||
.format(context)))
|
||||
: DateFormat.Hm().format(DateFormat.Hm()
|
||||
.parse(weatherController
|
||||
.timeConvert(timeEnd)
|
||||
.format(context))),
|
||||
),
|
||||
onPressed: () async {
|
||||
final TimeOfDay? timeEndPicker = await showTimePicker(
|
||||
final TimeOfDay? timeEndPicker =
|
||||
await showTimePicker(
|
||||
context: context,
|
||||
initialTime: weatherController.timeConvert(timeEnd),
|
||||
initialTime:
|
||||
weatherController.timeConvert(timeEnd),
|
||||
builder: (context, child) {
|
||||
final Widget mediaQueryWrapper = MediaQuery(
|
||||
data: MediaQuery.of(context).copyWith(
|
||||
alwaysUse24HourFormat: settings.timeformat == '12' ? false : true,
|
||||
alwaysUse24HourFormat:
|
||||
settings.timeformat == '12'
|
||||
? false
|
||||
: true,
|
||||
),
|
||||
child: child!,
|
||||
);
|
||||
|
@ -351,14 +395,18 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
);
|
||||
if (timeEndPicker != null) {
|
||||
isar.writeTxnSync(() {
|
||||
settings.timeEnd = timeEndPicker.format(context);
|
||||
settings.timeEnd =
|
||||
timeEndPicker.format(context);
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
if (!mounted) return;
|
||||
MyApp.updateAppState(context, newTimeEnd: timeEndPicker.format(context));
|
||||
MyApp.updateAppState(context,
|
||||
newTimeEnd:
|
||||
timeEndPicker.format(context));
|
||||
if (settings.notifications) {
|
||||
flutterLocalNotificationsPlugin.cancelAll();
|
||||
weatherController.notlification(weatherController.mainWeather);
|
||||
weatherController.notlification(
|
||||
weatherController.mainWeather);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -391,7 +439,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'data'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
|
@ -402,10 +450,15 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
text: 'degrees'.tr,
|
||||
dropdown: true,
|
||||
dropdownName: settings.degrees.tr,
|
||||
dropdownList: <String>['celsius'.tr, 'fahrenheit'.tr],
|
||||
dropdownList: <String>[
|
||||
'celsius'.tr,
|
||||
'fahrenheit'.tr
|
||||
],
|
||||
dropdownCange: (String? newValue) async {
|
||||
isar.writeTxnSync(() {
|
||||
settings.degrees = newValue == 'celsius'.tr ? 'celsius' : 'fahrenheit';
|
||||
settings.degrees = newValue == 'celsius'.tr
|
||||
? 'celsius'
|
||||
: 'fahrenheit';
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
await weatherController.deleteAll(false);
|
||||
|
@ -420,10 +473,16 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
text: 'measurements'.tr,
|
||||
dropdown: true,
|
||||
dropdownName: settings.measurements.tr,
|
||||
dropdownList: <String>['metric'.tr, 'imperial'.tr],
|
||||
dropdownList: <String>[
|
||||
'metric'.tr,
|
||||
'imperial'.tr
|
||||
],
|
||||
dropdownCange: (String? newValue) async {
|
||||
isar.writeTxnSync(() {
|
||||
settings.measurements = newValue == 'metric'.tr ? 'metric' : 'imperial';
|
||||
settings.measurements =
|
||||
newValue == 'metric'.tr
|
||||
? 'metric'
|
||||
: 'imperial';
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
await weatherController.deleteAll(false);
|
||||
|
@ -441,7 +500,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
dropdownList: <String>['12'.tr, '24'.tr],
|
||||
dropdownCange: (String? newValue) {
|
||||
isar.writeTxnSync(() {
|
||||
settings.timeformat = newValue == '12'.tr ? '12' : '24';
|
||||
settings.timeformat =
|
||||
newValue == '12'.tr ? '12' : '24';
|
||||
isar.settings.putSync(settings);
|
||||
});
|
||||
setState(() {});
|
||||
|
@ -475,7 +535,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'widget'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
|
@ -486,11 +546,11 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
text: 'widgetBackground'.tr,
|
||||
info: true,
|
||||
infoWidget: CircleAvatar(
|
||||
backgroundColor: theme.indicatorColor,
|
||||
backgroundColor: context.theme.indicatorColor,
|
||||
radius: 11,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: widgetBackgroundColor.isEmpty
|
||||
? theme.primaryColor
|
||||
? context.theme.primaryColor
|
||||
: HexColor.fromHex(widgetBackgroundColor),
|
||||
radius: 10,
|
||||
),
|
||||
|
@ -503,36 +563,48 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 15),
|
||||
child: Text(
|
||||
'widgetBackground'.tr,
|
||||
style: context.textTheme.titleMedium?.copyWith(fontSize: 18),
|
||||
style: context
|
||||
.textTheme.titleMedium
|
||||
?.copyWith(fontSize: 18),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15),
|
||||
child: Theme(
|
||||
data: theme.copyWith(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
data: context.theme.copyWith(
|
||||
inputDecorationTheme:
|
||||
InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ColorPicker(
|
||||
pickerColor: widgetBackgroundColor.isEmpty
|
||||
? theme.primaryColor
|
||||
: HexColor.fromHex(widgetBackgroundColor),
|
||||
pickerColor: widgetBackgroundColor
|
||||
.isEmpty
|
||||
? context.theme.primaryColor
|
||||
: HexColor.fromHex(
|
||||
widgetBackgroundColor),
|
||||
onColorChanged: (pickedColor) {
|
||||
colorBackground = pickedColor.toHex();
|
||||
colorBackground =
|
||||
pickedColor.toHex();
|
||||
},
|
||||
hexInputBar: true,
|
||||
labelTypes: const [],
|
||||
pickerAreaHeightPercent: 0.7,
|
||||
pickerAreaBorderRadius: BorderRadius.circular(20),
|
||||
pickerAreaBorderRadius:
|
||||
BorderRadius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -544,8 +616,12 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
if (colorBackground == null) {
|
||||
return;
|
||||
}
|
||||
weatherController.updateWidgetBackgroundColor(colorBackground!);
|
||||
MyApp.updateAppState(context, newWidgetBackgroundColor: colorBackground);
|
||||
weatherController
|
||||
.updateWidgetBackgroundColor(
|
||||
colorBackground!);
|
||||
MyApp.updateAppState(context,
|
||||
newWidgetBackgroundColor:
|
||||
colorBackground);
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
|
@ -562,11 +638,12 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
text: 'widgetText'.tr,
|
||||
info: true,
|
||||
infoWidget: CircleAvatar(
|
||||
backgroundColor: theme.indicatorColor,
|
||||
backgroundColor: context.theme.indicatorColor,
|
||||
radius: 11,
|
||||
child: CircleAvatar(
|
||||
backgroundColor:
|
||||
widgetTextColor.isEmpty ? theme.primaryColor : HexColor.fromHex(widgetTextColor),
|
||||
backgroundColor: widgetTextColor.isEmpty
|
||||
? context.theme.primaryColor
|
||||
: HexColor.fromHex(widgetTextColor),
|
||||
radius: 10,
|
||||
),
|
||||
),
|
||||
|
@ -578,36 +655,48 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 15),
|
||||
child: Text(
|
||||
'widgetText'.tr,
|
||||
style: context.textTheme.titleMedium?.copyWith(fontSize: 18),
|
||||
style: context
|
||||
.textTheme.titleMedium
|
||||
?.copyWith(fontSize: 18),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 15),
|
||||
child: Theme(
|
||||
data: theme.copyWith(
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
data: context.theme.copyWith(
|
||||
inputDecorationTheme:
|
||||
InputDecorationTheme(
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
borderRadius:
|
||||
BorderRadius.circular(
|
||||
8),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ColorPicker(
|
||||
pickerColor: widgetTextColor.isEmpty
|
||||
? theme.primaryColor
|
||||
: HexColor.fromHex(widgetTextColor),
|
||||
pickerColor: widgetTextColor
|
||||
.isEmpty
|
||||
? context.theme.primaryColor
|
||||
: HexColor.fromHex(
|
||||
widgetTextColor),
|
||||
onColorChanged: (pickedColor) {
|
||||
colorText = pickedColor.toHex();
|
||||
colorText =
|
||||
pickedColor.toHex();
|
||||
},
|
||||
hexInputBar: true,
|
||||
labelTypes: const [],
|
||||
pickerAreaHeightPercent: 0.7,
|
||||
pickerAreaBorderRadius: BorderRadius.circular(20),
|
||||
pickerAreaBorderRadius:
|
||||
BorderRadius.circular(20),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -617,8 +706,12 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
),
|
||||
onPressed: () {
|
||||
if (colorText == null) return;
|
||||
weatherController.updateWidgetTextColor(colorText!);
|
||||
MyApp.updateAppState(context, newWidgetTextColor: colorText);
|
||||
weatherController
|
||||
.updateWidgetTextColor(
|
||||
colorText!);
|
||||
MyApp.updateAppState(context,
|
||||
newWidgetTextColor:
|
||||
colorText);
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
|
@ -645,7 +738,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
info: true,
|
||||
infoSettings: true,
|
||||
infoWidget: _TextInfo(
|
||||
info: appLanguages.firstWhere((element) => (element['locale'] == locale),
|
||||
info: appLanguages.firstWhere(
|
||||
(element) => (element['locale'] == locale),
|
||||
orElse: () => appLanguages.first)['name'],
|
||||
),
|
||||
onPressed: () {
|
||||
|
@ -660,7 +754,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'language'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
|
@ -673,16 +767,20 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
elevation: 4,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
child: ListTile(
|
||||
title: Text(
|
||||
appLanguages[index]['name'],
|
||||
style: textTheme.labelLarge,
|
||||
style: context.textTheme.labelLarge,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
onTap: () {
|
||||
MyApp.updateAppState(context, newLocale: appLanguages[index]['locale']);
|
||||
updateLanguage(appLanguages[index]['locale']);
|
||||
MyApp.updateAppState(context,
|
||||
newLocale: appLanguages[index]
|
||||
['locale']);
|
||||
updateLanguage(
|
||||
appLanguages[index]['locale']);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -715,7 +813,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
child: Text(
|
||||
'support'.tr,
|
||||
style: titleLarge?.copyWith(
|
||||
style: context.textTheme.titleLarge?.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
|
@ -724,13 +822,15 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
elevation: 4,
|
||||
icon: const Icon(Iconsax.card),
|
||||
text: 'DonationAlerts',
|
||||
onPressed: () => urlLauncher('https://www.donationalerts.com/r/darkmoonight'),
|
||||
onPressed: () => urlLauncher(
|
||||
'https://www.donationalerts.com/r/darkmoonight'),
|
||||
),
|
||||
SettingCard(
|
||||
elevation: 4,
|
||||
icon: const Icon(Iconsax.wallet),
|
||||
text: 'ЮMoney',
|
||||
onPressed: () => urlLauncher('https://yoomoney.ru/to/4100117672775961'),
|
||||
onPressed: () => urlLauncher(
|
||||
'https://yoomoney.ru/to/4100117672775961'),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
|
@ -778,7 +878,8 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
scale: 20,
|
||||
),
|
||||
text: '${'project'.tr} GitHub',
|
||||
onPressed: () => urlLauncher('https://github.com/darkmoonight/Rain'),
|
||||
onPressed: () =>
|
||||
urlLauncher('https://github.com/darkmoonight/Rain'),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
],
|
||||
|
|
|
@ -70,7 +70,8 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
DateFormat.EEEE(locale.languageCode).format((weatherData.timeDaily ?? [])[index]),
|
||||
DateFormat.EEEE(locale.languageCode).format(
|
||||
(weatherData.timeDaily ?? [])[index]),
|
||||
style: labelLarge,
|
||||
),
|
||||
),
|
||||
|
@ -79,13 +80,15 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
statusWeather.getImage7Day(weatherCodeDaily[index]),
|
||||
statusWeather
|
||||
.getImage7Day(weatherCodeDaily[index]),
|
||||
scale: 3,
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Expanded(
|
||||
child: Text(
|
||||
statusWeather.getText(weatherCodeDaily[index]),
|
||||
statusWeather
|
||||
.getText(weatherCodeDaily[index]),
|
||||
style: labelLarge,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
@ -98,7 +101,10 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
statusData.getDegree((weatherData.temperature2MMin ?? [])[index]?.round()),
|
||||
statusData.getDegree(
|
||||
(weatherData.temperature2MMin ??
|
||||
[])[index]
|
||||
?.round()),
|
||||
style: labelLarge,
|
||||
),
|
||||
Text(
|
||||
|
@ -106,7 +112,10 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
style: bodyMediumGrey,
|
||||
),
|
||||
Text(
|
||||
statusData.getDegree((weatherData.temperature2MMax ?? [])[index]?.round()),
|
||||
statusData.getDegree(
|
||||
(weatherData.temperature2MMax ??
|
||||
[])[index]
|
||||
?.round()),
|
||||
style: bodyMediumGrey,
|
||||
),
|
||||
],
|
||||
|
|
|
@ -42,7 +42,8 @@ class _WeatherHourlyState extends State<WeatherHourly> {
|
|||
style: textTheme.labelLarge,
|
||||
),
|
||||
Text(
|
||||
DateFormat('E', locale.languageCode).format(DateTime.tryParse(time)!),
|
||||
DateFormat('E', locale.languageCode)
|
||||
.format(DateTime.tryParse(time)!),
|
||||
style: textTheme.labelLarge?.copyWith(
|
||||
color: Colors.grey,
|
||||
),
|
||||
|
|
|
@ -20,7 +20,6 @@ import 'package:time_machine/time_machine.dart';
|
|||
import 'package:timezone/data/latest_all.dart' as tz;
|
||||
import 'package:timezone/timezone.dart' as tz;
|
||||
import 'package:workmanager/workmanager.dart';
|
||||
|
||||
import 'app/data/weather.dart';
|
||||
import 'theme/theme_controller.dart';
|
||||
import 'translation/translation.dart';
|
||||
|
|
64
pubspec.lock
64
pubspec.lock
|
@ -17,6 +17,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.13.0"
|
||||
ansicolor:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: ansicolor
|
||||
sha256: "8bf17a8ff6ea17499e40a2d2542c2f481cd7615760c6d34065cb22bfd22e6880"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -85,10 +93,10 @@ packages:
|
|||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: "10c6bcdbf9d049a0b666702cf1cee4ddfdc38f02a19d35ae392863b47519848b"
|
||||
sha256: "67d591d602906ef9201caf93452495ad1812bea2074f04e25dbd7c133785821b"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.6"
|
||||
version: "2.4.7"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -109,10 +117,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
sha256: "723b4021e903217dfc445ec4cf5b42e27975aece1fc4ebbc1ca6329c2d9fb54e"
|
||||
sha256: "69acb7007eb2a31dc901512bfe0f7b767168be34cb734835d54c070bfa74c1b2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.7.0"
|
||||
version: "8.8.0"
|
||||
characters:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -149,10 +157,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
sha256: "1be9be30396d7e4c0db42c35ea6ccd7cc6a1e19916b5dc64d6ac216b5544d677"
|
||||
sha256: b2151ce26a06171005b379ecff6e08d34c470180ffe16b8e14b6d52be292b55f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.7.0"
|
||||
version: "4.8.0"
|
||||
collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -165,10 +173,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: connectivity_plus
|
||||
sha256: b502a681ba415272ecc41400bd04fe543ed1a62632137dc84d25a91e7746f55f
|
||||
sha256: "224a77051d52a11fbad53dd57827594d3bd24f945af28bd70bab376d68d437f0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
version: "5.0.2"
|
||||
connectivity_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -229,10 +237,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: dio
|
||||
sha256: "417e2a6f9d83ab396ec38ff4ea5da6c254da71e4db765ad737a42af6930140b7"
|
||||
sha256: "797e1e341c3dd2f69f2dad42564a6feff3bfb87187d05abb93b9609e6f1645c3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.3.3"
|
||||
version: "5.4.0"
|
||||
dynamic_color:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -322,10 +330,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_local_notifications
|
||||
sha256: "6d11ea777496061e583623aaf31923f93a9409ef8fcaeeefdd6cd78bf4fe5bb3"
|
||||
sha256: bb5cd63ff7c91d6efe452e41d0d0ae6348925c82eafd10ce170ef585ea04776e
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "16.1.0"
|
||||
version: "16.2.0"
|
||||
flutter_local_notifications_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -351,10 +359,10 @@ packages:
|
|||
dependency: "direct dev"
|
||||
description:
|
||||
name: flutter_native_splash
|
||||
sha256: d93394f22f73e810bda59e11ebe83329c5511d6460b6b7509c4e1f3c92d6d625
|
||||
sha256: c4d899312b36e7454bedfd0a4740275837b99e532d81c8477579d8183db1de6c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.5"
|
||||
version: "2.3.6"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
|
@ -529,10 +537,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: http
|
||||
sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525"
|
||||
sha256: d4872660c46d929f6b8a9ef4e7a7eff7e49bbf0c4ec3f385ee32df5119175139
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.2"
|
||||
http_multi_server:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -705,10 +713,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info_plus
|
||||
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
|
||||
sha256: "88bc797f44a94814f2213db1c9bd5badebafdfb8290ca9f78d4b9ee2a3db4d79"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.0"
|
||||
version: "5.0.1"
|
||||
package_info_plus_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -777,10 +785,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: petitparser
|
||||
sha256: eeb2d1428ee7f4170e2bd498827296a18d4e7fc462b71727d111c0ac7707cfa6
|
||||
sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.1"
|
||||
version: "6.0.2"
|
||||
platform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1046,10 +1054,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "7fd2f55fe86cea2897b963e864dc01a7eb0719ecc65fcef4c1cc3d686d718bb2"
|
||||
sha256: "138bd45b3a456dcfafc46d1a146787424f8d2edfbf2809c9324361e58f851cf7"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
version: "2.2.1"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1102,10 +1110,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: "7c99c0e1e2fa190b48d25c81ca5e42036d5cac81430ef249027d97b0935c553f"
|
||||
sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.0"
|
||||
version: "5.1.1"
|
||||
workmanager:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1126,10 +1134,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: xml
|
||||
sha256: af5e77e9b83f2f4adc5d3f0a4ece1c7f45a2467b695c2540381bac793e34e556
|
||||
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.4.2"
|
||||
version: "6.5.0"
|
||||
xxh3:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1147,5 +1155,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.2.0 <4.0.0"
|
||||
flutter: ">=3.13.0"
|
||||
dart: ">=3.2.2 <4.0.0"
|
||||
flutter: ">=3.16.0"
|
||||
|
|
14
pubspec.yaml
14
pubspec.yaml
|
@ -6,7 +6,7 @@ publish_to: "none"
|
|||
version: 1.2.8+31
|
||||
|
||||
environment:
|
||||
sdk: ">=3.2.0 <4.0.0"
|
||||
sdk: ">=3.2.2 <4.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
@ -14,7 +14,7 @@ dependencies:
|
|||
flutter_localizations:
|
||||
sdk: flutter
|
||||
get: ^4.6.6
|
||||
dio: ^5.3.3
|
||||
dio: ^5.4.0
|
||||
intl: ^0.18.1
|
||||
isar: ^3.1.0+1
|
||||
shimmer: ^3.0.0
|
||||
|
@ -32,15 +32,15 @@ dependencies:
|
|||
path_provider: ^2.1.1
|
||||
json_annotation: ^4.8.1
|
||||
flutter_timezone: ^1.0.8
|
||||
package_info_plus: ^4.2.0
|
||||
connectivity_plus: ^5.0.1
|
||||
package_info_plus: ^5.0.1
|
||||
connectivity_plus: ^5.0.2
|
||||
freezed_annotation: ^2.4.1
|
||||
isar_flutter_libs: ^3.1.0+1
|
||||
flutter_displaymode: ^0.6.0
|
||||
lat_lng_to_timezone: ^0.2.0
|
||||
flutter_colorpicker: ^1.0.3
|
||||
scrollable_positioned_list: ^0.3.8
|
||||
flutter_local_notifications: ^16.1.0
|
||||
flutter_local_notifications: ^16.2.0
|
||||
|
||||
# Uncomment this for publishing FLOSS variant
|
||||
# dependency_overrides:
|
||||
|
@ -54,11 +54,11 @@ dev_dependencies:
|
|||
flutter_test:
|
||||
sdk: flutter
|
||||
freezed: ^2.4.5
|
||||
build_runner: ^2.4.6
|
||||
build_runner: ^2.4.7
|
||||
flutter_lints: ^3.0.1
|
||||
isar_generator: ^3.1.0+1
|
||||
json_serializable: ^6.7.1
|
||||
flutter_native_splash: ^2.3.5
|
||||
flutter_native_splash: ^2.3.6
|
||||
flutter_launcher_icons: ^0.13.1
|
||||
|
||||
flutter_icons:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue