mirror of
https://github.com/darkmoonight/Rain.git
synced 2025-06-28 12:09:57 +00:00
Redesign
This commit is contained in:
parent
647d620d45
commit
6646f657d2
33 changed files with 504 additions and 313 deletions
|
@ -93,9 +93,11 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
degree: weatherCard.temperature2M![timeNow],
|
||||
timeDay: weatherCard.sunrise![dayNow],
|
||||
timeNight: weatherCard.sunset![dayNow],
|
||||
tempMax: weatherCard.temperature2MMax![dayNow]!,
|
||||
tempMin: weatherCard.temperature2MMin![dayNow]!,
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 15),
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
|
@ -167,6 +169,8 @@ class _InfoWeatherCardState extends State<InfoWeatherCard> {
|
|||
precipitationProbability:
|
||||
weatherCard.precipitationProbability?[timeNow],
|
||||
shortwaveRadiation: weatherCard.shortwaveRadiation?[timeNow],
|
||||
initiallyExpanded: false,
|
||||
title: 'hourlyVariables'.tr,
|
||||
),
|
||||
WeatherDaily(
|
||||
weatherData: weatherCard,
|
||||
|
|
|
@ -36,7 +36,7 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
return ListView(
|
||||
children: const [
|
||||
MyShimmer(
|
||||
hight: 350,
|
||||
hight: 200,
|
||||
),
|
||||
MyShimmer(
|
||||
hight: 130,
|
||||
|
@ -64,6 +64,8 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
final dayOfNow = weatherController.dayOfNow.value;
|
||||
final sunrise = mainWeather.sunrise![dayOfNow];
|
||||
final sunset = mainWeather.sunset![dayOfNow];
|
||||
final tempMax = mainWeather.temperature2MMax![dayOfNow];
|
||||
final tempMin = mainWeather.temperature2MMin![dayOfNow];
|
||||
|
||||
return ListView(
|
||||
children: [
|
||||
|
@ -73,9 +75,11 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
degree: mainWeather.temperature2M![hourOfDay],
|
||||
timeDay: sunrise,
|
||||
timeNight: sunset,
|
||||
tempMax: tempMax!,
|
||||
tempMin: tempMin!,
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 15),
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
|
@ -152,6 +156,8 @@ class _WeatherPageState extends State<WeatherPage> {
|
|||
precipitationProbability:
|
||||
mainWeather.precipitationProbability?[hourOfDay],
|
||||
shortwaveRadiation: mainWeather.shortwaveRadiation?[hourOfDay],
|
||||
initiallyExpanded: false,
|
||||
title: 'hourlyVariables'.tr,
|
||||
),
|
||||
WeatherDaily(
|
||||
weatherData: weatherCard,
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_glow/flutter_glow.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:iconsax/iconsax.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rain/app/data/weather.dart';
|
||||
import 'package:rain/app/widgets/desc/desc.dart';
|
||||
import 'package:rain/app/widgets/desc/desc_container.dart';
|
||||
import 'package:rain/app/widgets/desc/message.dart';
|
||||
import 'package:rain/app/widgets/hourly/weather_hourly.dart';
|
||||
import 'package:rain/app/widgets/now/weather_now.dart';
|
||||
import 'package:rain/app/widgets/status/status_data.dart';
|
||||
import 'package:rain/app/widgets/status/status_weather.dart';
|
||||
import 'package:rain/app/widgets/sun_moon/sunset_sunrise.dart';
|
||||
import 'package:rain/main.dart';
|
||||
import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
||||
|
||||
class InfoDailyCard extends StatefulWidget {
|
||||
const InfoDailyCard({
|
||||
|
@ -31,6 +33,7 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
|
|||
final message = Message();
|
||||
late PageController pageController;
|
||||
int pageIndex = 0;
|
||||
int hourOfDay = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -83,6 +86,7 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
|
|||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
pageIndex = index;
|
||||
hourOfDay = 0;
|
||||
});
|
||||
},
|
||||
itemCount: timeDaily.length,
|
||||
|
@ -101,6 +105,10 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
|
|||
weatherData.precipitationProbabilityMax?[index];
|
||||
final rainSum = weatherData.rainSum?[index];
|
||||
final precipitationSum = weatherData.precipitationSum?[index];
|
||||
final sunrise = weatherData.sunrise![index];
|
||||
final sunset = weatherData.sunset![index];
|
||||
|
||||
final startIndex = index * 24;
|
||||
|
||||
return indexedWeatherCodeDaily == null
|
||||
? null
|
||||
|
@ -108,136 +116,124 @@ class _InfoDailyCardState extends State<InfoDailyCard> {
|
|||
margin: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: ListView(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
Image(
|
||||
image: AssetImage(
|
||||
statusWeather
|
||||
.getImageNowDaily(indexedWeatherCodeDaily),
|
||||
),
|
||||
fit: BoxFit.fill,
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
GlowText(
|
||||
'${weatherData.temperature2MMin![index]?.round()} / ${weatherData.temperature2MMax![index]?.round()}',
|
||||
style: textTheme.titleLarge?.copyWith(
|
||||
fontSize: 35,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
blurRadius: 4,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
statusWeather.getText(indexedWeatherCodeDaily),
|
||||
style: textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
DateFormat.MMMMEEEEd(locale.languageCode)
|
||||
.format(timeDaily[index]),
|
||||
style: textTheme.labelLarge?.copyWith(
|
||||
color: Colors.grey,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 15),
|
||||
child: SunsetSunrise(
|
||||
timeSunrise: weatherData.sunrise![index],
|
||||
timeSunset: weatherData.sunset![index],
|
||||
),
|
||||
WeatherNow(
|
||||
weather:
|
||||
weatherData.weathercode![startIndex + hourOfDay],
|
||||
degree: weatherData
|
||||
.temperature2M![startIndex + hourOfDay],
|
||||
time: weatherData.time![startIndex + hourOfDay],
|
||||
timeDay: sunrise,
|
||||
timeNight: sunset,
|
||||
tempMax: apparentTemperatureMax!,
|
||||
tempMin: apparentTemperatureMin!,
|
||||
),
|
||||
Card(
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.spaceEvenly,
|
||||
spacing: 5,
|
||||
children: [
|
||||
apparentTemperatureMin == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/cold.png',
|
||||
value: statusData.getDegree(
|
||||
apparentTemperatureMin.round()),
|
||||
desc: 'apparentTemperatureMin'.tr,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 10, vertical: 5),
|
||||
child: SizedBox(
|
||||
height: 135,
|
||||
child: ScrollablePositionedList.separated(
|
||||
separatorBuilder:
|
||||
(BuildContext context, int index) {
|
||||
return const VerticalDivider(
|
||||
width: 10,
|
||||
indent: 40,
|
||||
endIndent: 40,
|
||||
);
|
||||
},
|
||||
scrollDirection: Axis.horizontal,
|
||||
itemCount: 24,
|
||||
itemBuilder: (ctx, i) {
|
||||
int hourlyIndex = startIndex + i;
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
hourOfDay = i;
|
||||
setState(() {});
|
||||
},
|
||||
child: Container(
|
||||
margin: const EdgeInsets.symmetric(
|
||||
vertical: 5),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 5,
|
||||
),
|
||||
apparentTemperatureMax == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/hot.png',
|
||||
value: statusData.getDegree(
|
||||
apparentTemperatureMax.round()),
|
||||
desc: 'apparentTemperatureMax'.tr,
|
||||
),
|
||||
uvIndexMax == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/uv.png',
|
||||
value: '${uvIndexMax.round()}',
|
||||
desc: 'uvIndex'.tr,
|
||||
message: message
|
||||
.getUvIndex(uvIndexMax.round()),
|
||||
),
|
||||
windDirection10MDominant == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/windsock.png',
|
||||
value: '$windDirection10MDominant°',
|
||||
desc: 'direction'.tr,
|
||||
message: message.getDirection(
|
||||
windDirection10MDominant),
|
||||
),
|
||||
windSpeed10MMax == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/wind.png',
|
||||
value: statusData
|
||||
.getSpeed(windSpeed10MMax.round()),
|
||||
desc: 'wind'.tr,
|
||||
),
|
||||
windGusts10MMax == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName:
|
||||
'assets/images/windgusts.png',
|
||||
value: statusData
|
||||
.getSpeed(windGusts10MMax.round()),
|
||||
desc: 'windgusts'.tr,
|
||||
),
|
||||
precipitationProbabilityMax == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName:
|
||||
'assets/images/precipitation_probability.png',
|
||||
value: '$precipitationProbabilityMax%',
|
||||
desc: 'precipitationProbability'.tr,
|
||||
),
|
||||
rainSum == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/water.png',
|
||||
value: statusData
|
||||
.getPrecipitation(rainSum),
|
||||
desc: 'rain'.tr,
|
||||
),
|
||||
precipitationSum == null
|
||||
? const Offstage()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/rainfall.png',
|
||||
value: statusData
|
||||
.getPrecipitation(precipitationSum),
|
||||
desc: 'precipitation'.tr,
|
||||
),
|
||||
],
|
||||
decoration: BoxDecoration(
|
||||
color: i == hourOfDay
|
||||
? context.theme.colorScheme
|
||||
.primaryContainer
|
||||
: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(20),
|
||||
),
|
||||
),
|
||||
child: WeatherHourly(
|
||||
time: weatherData.time![hourlyIndex],
|
||||
weather: weatherData
|
||||
.weathercode![hourlyIndex],
|
||||
degree: weatherData
|
||||
.temperature2M![hourlyIndex],
|
||||
timeDay: sunrise,
|
||||
timeNight: sunset,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SunsetSunrise(
|
||||
timeSunrise: sunrise,
|
||||
timeSunset: sunset,
|
||||
),
|
||||
DescContainer(
|
||||
humidity: weatherData
|
||||
.relativehumidity2M?[startIndex + hourOfDay],
|
||||
wind:
|
||||
weatherData.windspeed10M?[startIndex + hourOfDay],
|
||||
visibility:
|
||||
weatherData.visibility?[startIndex + hourOfDay],
|
||||
feels: weatherData
|
||||
.apparentTemperature?[startIndex + hourOfDay],
|
||||
evaporation: weatherData
|
||||
.evapotranspiration?[startIndex + hourOfDay],
|
||||
precipitation: weatherData
|
||||
.precipitation?[startIndex + hourOfDay],
|
||||
direction: weatherData
|
||||
.winddirection10M?[startIndex + hourOfDay],
|
||||
pressure: weatherData
|
||||
.surfacePressure?[startIndex + hourOfDay],
|
||||
rain: weatherData.rain?[startIndex + hourOfDay],
|
||||
cloudcover:
|
||||
weatherData.cloudcover?[startIndex + hourOfDay],
|
||||
windgusts:
|
||||
weatherData.windgusts10M?[startIndex + hourOfDay],
|
||||
uvIndex: weatherData.uvIndex?[startIndex + hourOfDay],
|
||||
dewpoint2M:
|
||||
weatherData.dewpoint2M?[startIndex + hourOfDay],
|
||||
precipitationProbability:
|
||||
weatherData.precipitationProbability?[
|
||||
startIndex + hourOfDay],
|
||||
shortwaveRadiation: weatherData
|
||||
.shortwaveRadiation?[startIndex + hourOfDay],
|
||||
initiallyExpanded: true,
|
||||
title: 'hourlyVariables'.tr,
|
||||
),
|
||||
DescContainer(
|
||||
apparentTemperatureMin: apparentTemperatureMin,
|
||||
apparentTemperatureMax: apparentTemperatureMax,
|
||||
uvIndexMax: uvIndexMax,
|
||||
windDirection10MDominant: windDirection10MDominant,
|
||||
windSpeed10MMax: windSpeed10MMax,
|
||||
windGusts10MMax: windGusts10MMax,
|
||||
precipitationProbabilityMax:
|
||||
precipitationProbabilityMax,
|
||||
rainSum: rainSum,
|
||||
precipitationSum: precipitationSum,
|
||||
initiallyExpanded: true,
|
||||
title: 'dailyVariables'.tr,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -113,7 +113,7 @@ class _WeatherDailyState extends State<WeatherDaily> {
|
|||
statusData.getDegree(
|
||||
(weatherData.temperature2MMax ?? [])[index]
|
||||
?.round()),
|
||||
style: bodyMediumGrey,
|
||||
style: labelLarge,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
@ -7,22 +7,34 @@ import 'package:rain/app/widgets/status/status_data.dart';
|
|||
class DescContainer extends StatefulWidget {
|
||||
const DescContainer({
|
||||
super.key,
|
||||
required this.humidity,
|
||||
required this.wind,
|
||||
required this.visibility,
|
||||
required this.feels,
|
||||
required this.evaporation,
|
||||
required this.precipitation,
|
||||
required this.direction,
|
||||
required this.pressure,
|
||||
required this.rain,
|
||||
required this.cloudcover,
|
||||
required this.windgusts,
|
||||
required this.uvIndex,
|
||||
required this.dewpoint2M,
|
||||
required this.precipitationProbability,
|
||||
required this.shortwaveRadiation,
|
||||
this.humidity,
|
||||
this.wind,
|
||||
this.visibility,
|
||||
this.feels,
|
||||
this.evaporation,
|
||||
this.precipitation,
|
||||
this.direction,
|
||||
this.pressure,
|
||||
this.rain,
|
||||
this.cloudcover,
|
||||
this.windgusts,
|
||||
this.uvIndex,
|
||||
this.dewpoint2M,
|
||||
this.precipitationProbability,
|
||||
this.shortwaveRadiation,
|
||||
this.apparentTemperatureMin,
|
||||
this.apparentTemperatureMax,
|
||||
this.uvIndexMax,
|
||||
this.windDirection10MDominant,
|
||||
this.windSpeed10MMax,
|
||||
this.windGusts10MMax,
|
||||
this.precipitationProbabilityMax,
|
||||
this.rainSum,
|
||||
this.precipitationSum,
|
||||
required this.initiallyExpanded,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
final int? humidity;
|
||||
final double? wind;
|
||||
final double? visibility;
|
||||
|
@ -39,6 +51,19 @@ class DescContainer extends StatefulWidget {
|
|||
final int? precipitationProbability;
|
||||
final double? shortwaveRadiation;
|
||||
|
||||
final double? apparentTemperatureMin;
|
||||
final double? apparentTemperatureMax;
|
||||
final double? uvIndexMax;
|
||||
final int? windDirection10MDominant;
|
||||
final double? windSpeed10MMax;
|
||||
final double? windGusts10MMax;
|
||||
final int? precipitationProbabilityMax;
|
||||
final double? rainSum;
|
||||
final double? precipitationSum;
|
||||
|
||||
final bool initiallyExpanded;
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<DescContainer> createState() => _DescContainerState();
|
||||
}
|
||||
|
@ -65,37 +90,126 @@ class _DescContainerState extends State<DescContainer> {
|
|||
final uvIndex = widget.uvIndex;
|
||||
final shortwaveRadiation = widget.shortwaveRadiation;
|
||||
|
||||
final apparentTemperatureMin = widget.apparentTemperatureMin;
|
||||
final apparentTemperatureMax = widget.apparentTemperatureMax;
|
||||
final uvIndexMax = widget.uvIndexMax;
|
||||
final windDirection10MDominant = widget.windDirection10MDominant;
|
||||
final windSpeed10MMax = widget.windSpeed10MMax;
|
||||
final windGusts10MMax = widget.windGusts10MMax;
|
||||
final precipitationProbabilityMax = widget.precipitationProbabilityMax;
|
||||
final rainSum = widget.rainSum;
|
||||
final precipitationSum = widget.precipitationSum;
|
||||
|
||||
final initiallyExpanded = widget.initiallyExpanded;
|
||||
final title = widget.title;
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 22, bottom: 5),
|
||||
child: ExpansionTile(
|
||||
shape: const Border(),
|
||||
title: Text(
|
||||
title,
|
||||
style: context.textTheme.labelLarge,
|
||||
),
|
||||
initiallyExpanded: initiallyExpanded,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 5),
|
||||
child: Wrap(
|
||||
alignment: WrapAlignment.spaceEvenly,
|
||||
spacing: 5,
|
||||
children: [
|
||||
apparentTemperatureMin == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/cold.png',
|
||||
value: statusData
|
||||
.getDegree(apparentTemperatureMin.round()),
|
||||
desc: 'apparentTemperatureMin'.tr,
|
||||
),
|
||||
apparentTemperatureMax == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/hot.png',
|
||||
value: statusData
|
||||
.getDegree(apparentTemperatureMax.round()),
|
||||
desc: 'apparentTemperatureMax'.tr,
|
||||
),
|
||||
uvIndexMax == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/uv.png',
|
||||
value: '${uvIndexMax.round()}',
|
||||
desc: 'uvIndex'.tr,
|
||||
message: message.getUvIndex(uvIndexMax.round()),
|
||||
),
|
||||
windDirection10MDominant == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/windsock.png',
|
||||
value: '$windDirection10MDominant°',
|
||||
desc: 'direction'.tr,
|
||||
message: message.getDirection(windDirection10MDominant),
|
||||
),
|
||||
windSpeed10MMax == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/wind.png',
|
||||
value: statusData.getSpeed(windSpeed10MMax.round()),
|
||||
desc: 'wind'.tr,
|
||||
),
|
||||
windGusts10MMax == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/windgusts.png',
|
||||
value: statusData.getSpeed(windGusts10MMax.round()),
|
||||
desc: 'windgusts'.tr,
|
||||
),
|
||||
precipitationProbabilityMax == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName:
|
||||
'assets/images/precipitation_probability.png',
|
||||
value: '$precipitationProbabilityMax%',
|
||||
desc: 'precipitationProbability'.tr,
|
||||
),
|
||||
rainSum == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/water.png',
|
||||
value: statusData.getPrecipitation(rainSum),
|
||||
desc: 'rain'.tr,
|
||||
),
|
||||
precipitationSum == null
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/rainfall.png',
|
||||
value: statusData.getPrecipitation(precipitationSum),
|
||||
desc: 'precipitation'.tr,
|
||||
),
|
||||
dewpoint2M == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/dew.png',
|
||||
value: statusData.getDegree(dewpoint2M.round()),
|
||||
desc: 'dewpoint'.tr,
|
||||
),
|
||||
feels == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/temperature.png',
|
||||
value: statusData.getDegree(feels.round()),
|
||||
desc: 'feels'.tr,
|
||||
),
|
||||
visibility == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/fog.png',
|
||||
value: statusData.getVisibility(visibility),
|
||||
desc: 'visibility'.tr,
|
||||
),
|
||||
direction == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/windsock.png',
|
||||
value: '$direction°',
|
||||
|
@ -103,63 +217,64 @@ class _DescContainerState extends State<DescContainer> {
|
|||
message: message.getDirection(direction),
|
||||
),
|
||||
wind == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/wind.png',
|
||||
value: statusData.getSpeed(wind.round()),
|
||||
desc: 'wind'.tr,
|
||||
),
|
||||
windgusts == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/windgusts.png',
|
||||
value: statusData.getSpeed(windgusts.round()),
|
||||
desc: 'windgusts'.tr,
|
||||
),
|
||||
evaporation == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/evaporation.png',
|
||||
value: statusData.getPrecipitation(evaporation.abs()),
|
||||
desc: 'evaporation'.tr,
|
||||
),
|
||||
precipitation == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/rainfall.png',
|
||||
value: statusData.getPrecipitation(precipitation),
|
||||
desc: 'precipitation'.tr,
|
||||
),
|
||||
rain == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/water.png',
|
||||
value: statusData.getPrecipitation(rain),
|
||||
desc: 'rain'.tr,
|
||||
),
|
||||
precipitationProbability == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/precipitation_probability.png',
|
||||
imageName:
|
||||
'assets/images/precipitation_probability.png',
|
||||
value: '$precipitationProbability%',
|
||||
desc: 'precipitationProbability'.tr,
|
||||
),
|
||||
humidity == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/humidity.png',
|
||||
value: '$humidity%',
|
||||
desc: 'humidity'.tr,
|
||||
),
|
||||
cloudcover == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/cloudy.png',
|
||||
value: '$cloudcover%',
|
||||
desc: 'cloudcover'.tr,
|
||||
),
|
||||
pressure == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/atmospheric.png',
|
||||
value: '${pressure.round()} ${'hPa'.tr}',
|
||||
|
@ -167,7 +282,7 @@ class _DescContainerState extends State<DescContainer> {
|
|||
message: message.getPressure(pressure.round()),
|
||||
),
|
||||
uvIndex == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/uv.png',
|
||||
value: '${uvIndex.round()}',
|
||||
|
@ -175,7 +290,7 @@ class _DescContainerState extends State<DescContainer> {
|
|||
message: message.getUvIndex(uvIndex.round()),
|
||||
),
|
||||
shortwaveRadiation == null
|
||||
? const Offstage()
|
||||
? Container()
|
||||
: DescWeather(
|
||||
imageName: 'assets/images/shortwave_radiation.png',
|
||||
value: '${shortwaveRadiation.round()} ${'W/m2'.tr}',
|
||||
|
@ -184,6 +299,8 @@ class _DescContainerState extends State<DescContainer> {
|
|||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_glow/flutter_glow.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rain/app/widgets/status/status_data.dart';
|
||||
import 'package:rain/app/widgets/status/status_weather.dart';
|
||||
import 'package:rain/main.dart';
|
||||
|
||||
|
@ -13,12 +13,16 @@ class WeatherNow extends StatefulWidget {
|
|||
required this.time,
|
||||
required this.timeDay,
|
||||
required this.timeNight,
|
||||
required this.tempMax,
|
||||
required this.tempMin,
|
||||
});
|
||||
final String time;
|
||||
final String timeDay;
|
||||
final String timeNight;
|
||||
final int weather;
|
||||
final double degree;
|
||||
final double tempMax;
|
||||
final double tempMin;
|
||||
|
||||
@override
|
||||
State<WeatherNow> createState() => _WeatherNowState();
|
||||
|
@ -26,31 +30,22 @@ class WeatherNow extends StatefulWidget {
|
|||
|
||||
class _WeatherNowState extends State<WeatherNow> {
|
||||
final statusWeather = StatusWeather();
|
||||
final statusData = StatusData();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 15),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(top: 18, bottom: 18, left: 25, right: 15),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 15),
|
||||
Image(
|
||||
image: AssetImage(statusWeather.getImageNow(
|
||||
widget.weather, widget.time, widget.timeDay, widget.timeNight)),
|
||||
fit: BoxFit.fill,
|
||||
height: 200,
|
||||
),
|
||||
GlowText(
|
||||
'${roundDegree ? widget.degree.round() : widget.degree}',
|
||||
style: context.textTheme.displayLarge?.copyWith(
|
||||
fontSize: 90,
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
statusWeather.getText(widget.weather),
|
||||
style: context.textTheme.titleLarge,
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
DateFormat.MMMMEEEEd(locale.languageCode).format(
|
||||
DateTime.parse(widget.time),
|
||||
|
@ -59,7 +54,44 @@ class _WeatherNowState extends State<WeatherNow> {
|
|||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Text(
|
||||
statusWeather.getText(widget.weather),
|
||||
style: context.textTheme.titleLarge?.copyWith(fontSize: 20),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
statusData.getDegree(
|
||||
roundDegree ? widget.degree.round() : widget.degree),
|
||||
style: context.textTheme.displayMedium?.copyWith(
|
||||
fontWeight: FontWeight.w800,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 5),
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(statusData.getDegree((widget.tempMin.round())),
|
||||
style: context.textTheme.labelLarge),
|
||||
Text(' / ',
|
||||
style: context.textTheme.labelLarge
|
||||
?.copyWith(color: Colors.grey)),
|
||||
Text(statusData.getDegree((widget.tempMax.round())),
|
||||
style: context.textTheme.labelLarge),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Image(
|
||||
image: AssetImage(statusWeather.getImageNow(widget.weather,
|
||||
widget.time, widget.timeDay, widget.timeNight)),
|
||||
fit: BoxFit.fill,
|
||||
height: 140,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import 'package:rain/main.dart';
|
|||
import 'package:timezone/timezone.dart';
|
||||
|
||||
class StatusData {
|
||||
String getDegree(int? degree) {
|
||||
String getDegree(degree) {
|
||||
switch (settings.degrees) {
|
||||
case 'celsius':
|
||||
return '$degree°C';
|
||||
|
|
|
@ -126,5 +126,7 @@ class BnIn {
|
|||
'cities': 'শহর',
|
||||
'groups': 'আমাদের দলগুলি',
|
||||
'openMeteo': 'Open-Meteo থেকে ডেটা (CC-BY 4.0)',
|
||||
'hourlyVariables': 'ঘণ্টায় আবহাওয়ার পরিবর্তনশীল',
|
||||
'dailyVariables': 'দৈনিক আবহাওয়ার পরিবর্তনশীল',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,5 +126,7 @@ class CsCz {
|
|||
'done': 'Hotovo',
|
||||
'groups': 'Naše skupiny',
|
||||
'openMeteo': 'Data z Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Hodinové meteorologické proměnné',
|
||||
'dailyVariables': 'Denní meteorologické proměnné',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class DaDk {
|
|||
'done': 'Færdig',
|
||||
'groups': 'Vores grupper',
|
||||
'openMeteo': 'Data fra Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Timevise vejrfaktorer',
|
||||
'dailyVariables': 'Daglige vejrfaktorer',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class DeDe {
|
|||
'done': 'Fertig',
|
||||
'groups': 'Unsere gruppen',
|
||||
'openMeteo': 'Daten von Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Stündliche Wettervariablen',
|
||||
'dailyVariables': 'Tägliche Wettervariablen',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class EnUs {
|
|||
'done': 'Done',
|
||||
'groups': 'Our groups',
|
||||
'openMeteo': 'Data by Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Hourly weather variables',
|
||||
'dailyVariables': 'Daily weather variables',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class EsEs {
|
|||
'done': 'Hecho',
|
||||
'groups': 'Nuestros grupos',
|
||||
'openMeteo': 'Datos de Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Variables meteorológicas horarias',
|
||||
'dailyVariables': 'Variables meteorológicas diarias',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class FaIr {
|
|||
'done': 'پایان',
|
||||
'groups': 'گروههای ما',
|
||||
'openMeteo': 'دادهها از Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'متغیرهای ساعتی هواشناسی',
|
||||
'dailyVariables': 'متغیرهای روزانه هواشناسی',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class FrFr {
|
|||
'done': 'Terminé',
|
||||
'groups': 'Nos groupes',
|
||||
'openMeteo': 'Données de Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Variables météorologiques horaires',
|
||||
'dailyVariables': 'Variables météorologiques quotidiennes',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class GaIe {
|
|||
'done': 'Críochnaithe',
|
||||
'groups': 'Ár ngrúpaí',
|
||||
'openMeteo': 'Sonraí ó Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Athrógacha aimsire uaireanta',
|
||||
'dailyVariables': 'Athrógacha aimsire laethúla',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -125,5 +125,7 @@ class HiIn {
|
|||
'done': 'किया',
|
||||
'groups': 'हमारे समूह',
|
||||
'openMeteo': 'Open-Meteo से डेटा (CC-BY 4.0)',
|
||||
'hourlyVariables': 'घंटेवार मौसम चर',
|
||||
'dailyVariables': 'दैनिक मौसम चर',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class HuHu {
|
|||
'done': 'Kész',
|
||||
'groups': 'Csoportjaink',
|
||||
'openMeteo': 'Adatok az Open-Meteo-tól (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Óránkénti időjárási változók',
|
||||
'dailyVariables': 'Napi időjárási változók',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class ItIt {
|
|||
'done': 'Fatto',
|
||||
'groups': 'I nostri gruppi',
|
||||
'openMeteo': 'Dati da Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Variabili meteorologiche orarie',
|
||||
'dailyVariables': 'Variabili meteorologiche giornaliere',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class KaGe {
|
|||
'done': 'დასრულებულია',
|
||||
'groups': 'ჩვენი ჯგუფები',
|
||||
'openMeteo': 'მონაცემები Open-Meteo-დან (CC-BY 4.0)',
|
||||
'hourlyVariables': 'საათობრივი ამინდის ცვლადები',
|
||||
'dailyVariables': 'ყოველდღიური ამინდის ცვლადები',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -123,5 +123,7 @@ class KoKr {
|
|||
'done': '완료',
|
||||
'groups': '우리 그룹',
|
||||
'openMeteo': 'Open-Meteo의 데이터 (CC-BY 4.0)',
|
||||
'hourlyVariables': '시간별 날씨 변수',
|
||||
'dailyVariables': '일별 날씨 변수',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -128,5 +128,7 @@ class NlNl {
|
|||
'done': 'Klaar',
|
||||
'groups': 'Onze groepen',
|
||||
'openMeteo': 'Gegevens van Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Uurlijkse weervariabelen',
|
||||
'dailyVariables': 'Dagelijkse weervariabelen',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,5 +126,7 @@ class PlPl {
|
|||
'done': 'Gotowe',
|
||||
'groups': 'Nasze grupy',
|
||||
'openMeteo': 'Dane z Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Godzinowe zmienne pogodowe',
|
||||
'dailyVariables': 'Dzienne zmienne pogodowe',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class PtBr {
|
|||
'done': 'Concluído',
|
||||
'groups': 'Nossos grupos',
|
||||
'openMeteo': 'Dados do Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Variáveis meteorológicas horárias',
|
||||
'dailyVariables': 'Variáveis meteorológicas diárias',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,5 +126,7 @@ class RoRo {
|
|||
'done': 'Gata',
|
||||
'groups': 'Grupurile noastre',
|
||||
'openMeteo': 'Date de la Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Variabile meteorologice orare',
|
||||
'dailyVariables': 'Variabile meteorologice zilnice',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class RuRu {
|
|||
'done': 'Готово',
|
||||
'groups': 'Наши группы',
|
||||
'openMeteo': 'Данные от Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Почасовые погодные условия',
|
||||
'dailyVariables': 'Ежедневные погодные условия',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,5 +126,7 @@ class SkSk {
|
|||
'done': 'Hotovo',
|
||||
'groups': 'Naše skupiny',
|
||||
'openMeteo': 'Údaje od Open-Meteo (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Hodinové meteorologické premenné',
|
||||
'dailyVariables': 'Denné meteorologické premenné',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -126,5 +126,7 @@ class TrTr {
|
|||
'done': 'Tamam',
|
||||
'groups': 'Gruplarımız',
|
||||
'openMeteo': 'Open-Meteo\'dan veriler (CC-BY 4.0)',
|
||||
'hourlyVariables': 'Saatlik hava değişkenleri',
|
||||
'dailyVariables': 'Günlük hava değişkenleri',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -127,5 +127,7 @@ class UrPk {
|
|||
'done': 'ہوگیا',
|
||||
'groups': 'ہماری گروپس',
|
||||
'openMeteo': 'Open-Meteo سے ڈیٹا (CC-BY 4.0)',
|
||||
'hourlyVariables': 'ہر گھنٹے کے موسمی متغیرات',
|
||||
'dailyVariables': 'روزانہ کے موسمی متغیرات',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -122,5 +122,7 @@ class ZhCh {
|
|||
'done': '完成',
|
||||
'groups': '我们的组',
|
||||
'openMeteo': '来自Open-Meteo的数据 (CC-BY 4.0)',
|
||||
'hourlyVariables': '每小时天气变量',
|
||||
'dailyVariables': '每日天气变量',
|
||||
};
|
||||
}
|
||||
|
|
|
@ -123,5 +123,7 @@ class ZhTw {
|
|||
'done': '完成',
|
||||
'groups': '我們的小組',
|
||||
'openMeteo': '來自Open-Meteo的數據 (CC-BY 4.0)',
|
||||
'hourlyVariables': '每小時天氣變量',
|
||||
'dailyVariables': '每日天氣變量',
|
||||
};
|
||||
}
|
||||
|
|
27
pubspec.lock
27
pubspec.lock
|
@ -294,15 +294,6 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.0"
|
||||
flutter_glow:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: "7c5e1fd34583db4b40073add9ca329b03bf52a51"
|
||||
url: "https://github.com/payam-zahedi/flutter-glow.git"
|
||||
source: git
|
||||
version: "0.3.1"
|
||||
flutter_hsvcolor_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -466,10 +457,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_platform_interface
|
||||
sha256: c6005787efe9e27cb0f6b50230c217e6f0ef8e1e7a8b854efb4f46489e502603
|
||||
sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.2.3"
|
||||
version: "4.2.4"
|
||||
geolocator_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -578,10 +569,10 @@ packages:
|
|||
dependency: "direct main"
|
||||
description:
|
||||
name: internet_connection_checker_plus
|
||||
sha256: a35278f4a8433ce254fdf115d6d25e878f58af374ad4b9713e24491d4402151d
|
||||
sha256: "45d33532937eb931a14fb1f885c4b0ade6332983ba98349920fca0a23751d7c9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.4.1"
|
||||
version: "2.4.2"
|
||||
intl:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -778,10 +769,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: path_provider_android
|
||||
sha256: "9c96da072b421e98183f9ea7464898428e764bc0ce5567f27ec8693442e72514"
|
||||
sha256: bca87b0165ffd7cdb9cad8edd22d18d2201e886d9a9f19b4fb3452ea7df3a72a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.5"
|
||||
version: "2.2.6"
|
||||
path_provider_foundation:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -826,10 +817,10 @@ packages:
|
|||
dependency: transitive
|
||||
description:
|
||||
name: platform
|
||||
sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
|
||||
sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.4"
|
||||
version: "3.1.5"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1196,5 +1187,5 @@ packages:
|
|||
source: hosted
|
||||
version: "3.1.2"
|
||||
sdks:
|
||||
dart: ">=3.4.1 <4.0.0"
|
||||
dart: ">=3.4.3 <4.0.0"
|
||||
flutter: ">=3.22.0"
|
||||
|
|
|
@ -3,10 +3,10 @@ description: Weather application
|
|||
|
||||
publish_to: "none"
|
||||
|
||||
version: 1.3.1+34
|
||||
version: 1.3.2+35
|
||||
|
||||
environment:
|
||||
sdk: ">=3.4.1 <4.0.0"
|
||||
sdk: ">=3.4.3 <4.0.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
@ -27,9 +27,6 @@ dependencies:
|
|||
home_widget: ^0.6.0
|
||||
workmanager: ^0.5.2
|
||||
google_fonts: ^6.2.1
|
||||
flutter_glow:
|
||||
git:
|
||||
url: https://github.com/payam-zahedi/flutter-glow.git
|
||||
url_launcher: ^6.3.0
|
||||
time_machine: ^0.9.17
|
||||
dynamic_color: ^1.7.0
|
||||
|
@ -47,7 +44,7 @@ dependencies:
|
|||
flutter_hsvcolor_picker: ^1.5.1
|
||||
scrollable_positioned_list: ^0.3.8
|
||||
flutter_local_notifications: ^17.1.2
|
||||
internet_connection_checker_plus: ^2.4.1
|
||||
internet_connection_checker_plus: ^2.4.2
|
||||
|
||||
# Uncomment this for publishing FLOSS variant
|
||||
# dependency_overrides:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue