Skip to content

Commit

Permalink
ui card daily
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonavichus committed Apr 25, 2023
1 parent d707b0d commit cd56e31
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 64 deletions.
Binary file added assets/images/cold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/hot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
140 changes: 139 additions & 1 deletion lib/app/widgets/daily_card.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:rain/app/widgets/desc.dart';
import 'package:rain/app/widgets/status.dart';
import 'package:rain/app/widgets/status_im_fa.dart';
import 'package:rain/app/widgets/sunset_sunrise.dart';

class DailyCard extends StatelessWidget {
const DailyCard({
Expand Down Expand Up @@ -31,6 +37,138 @@ class DailyCard extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Container();
final locale = Get.locale;
final status = Status();
final statusImFa = StatusImFa();

return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Text(
DateFormat.MMMMEEEEd(locale?.languageCode).format(timeDaily!),
style: context.theme.textTheme.titleLarge,
),
Container(
margin: const EdgeInsets.symmetric(vertical: 15),
padding: const EdgeInsets.symmetric(
horizontal: 15,
vertical: 10,
),
decoration: BoxDecoration(
color: context.theme.colorScheme.primaryContainer,
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Row(
children: [
Image.asset(
status.getImage7Day(weathercodeDaily!),
scale: 3,
),
const SizedBox(width: 5),
Expanded(
child: Text(
status.getText(weathercodeDaily!),
style: context.theme.textTheme.labelLarge
?.copyWith(fontSize: 16),
overflow: TextOverflow.ellipsis,
),
),
],
),
),
Row(
children: [
Text(
statusImFa.getDegree(temperature2MMin!.round()),
style: context.theme.textTheme.labelLarge
?.copyWith(fontSize: 16),
),
Text(
' / ',
style: context.theme.textTheme.bodyMedium?.copyWith(
color: Colors.grey,
),
),
Text(
statusImFa.getDegree(temperature2MMax!.round()),
style: context.theme.textTheme.bodyMedium
?.copyWith(fontSize: 16),
),
],
),
],
),
),
SunsetSunrise(
timeSunrise: sunrise!,
timeSunset: sunset!,
),
Container(
margin: const EdgeInsets.only(bottom: 15),
padding: const EdgeInsets.only(top: 20, bottom: 5),
decoration: BoxDecoration(
color: context.theme.colorScheme.primaryContainer,
borderRadius: const BorderRadius.all(
Radius.circular(20),
),
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DescWeather(
imageName: 'assets/images/humidity.png',
value: '$precipitationProbabilityMax%',
desc: 'precipitationProbabilit'.tr,
),
DescWeather(
imageName: 'assets/images/wind.png',
value: statusImFa.getSpeed(windspeed10MMax!.round()),
desc: 'wind'.tr,
),
DescWeather(
imageName: 'assets/images/windgusts.png',
value: statusImFa.getSpeed(windgusts10MMax!.round()),
desc: 'windgusts'.tr,
),
],
),
const SizedBox(height: 5),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DescWeather(
imageName: 'assets/images/rainfall.png',
value: statusImFa.getPrecipitation(precipitationSum!),
desc: 'precipitation'.tr,
),
DescWeather(
imageName: 'assets/images/cold.png',
value:
statusImFa.getDegree(apparentTemperatureMin!.round()),
desc: 'apparentTemperatureMin'.tr,
),
DescWeather(
imageName: 'assets/images/hot.png',
value:
statusImFa.getDegree(apparentTemperatureMax!.round()),
desc: 'apparentTemperatureMax'.tr,
),
],
),
],
),
),
],
),
);
}
}
4 changes: 2 additions & 2 deletions lib/app/widgets/status_im_fa.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class StatusImFa {
String getTimeFormat(String time) {
switch (settings.timeformat) {
case '12':
return DateFormat.jm().format(DateTime.tryParse(time)!);
return DateFormat.j().format(DateTime.tryParse(time)!);
case '24':
return DateFormat.Hm().format(DateTime.tryParse(time)!);
default:
Expand All @@ -62,7 +62,7 @@ class StatusImFa {
String getTimeFormatTz(TZDateTime time) {
switch (settings.timeformat) {
case '12':
return DateFormat.jm().format(time);
return DateFormat.j().format(time);
case '24':
return DateFormat.Hm().format(time);
default:
Expand Down
117 changes: 58 additions & 59 deletions lib/app/widgets/weather_daily.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,71 +47,70 @@ class _WeatherDailyState extends State<WeatherDaily> {
children: [
Expanded(
child: ListView.builder(
physics: const NeverScrollableScrollPhysics(),
itemCount: 7,
itemBuilder: (ctx, i) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
DateFormat.EEEE(locale?.languageCode)
.format(widget.date[i]),
style: context.theme.textTheme.labelLarge,
),
physics: const NeverScrollableScrollPhysics(),
itemCount: 7,
itemBuilder: (ctx, i) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: Text(
DateFormat.EEEE(locale?.languageCode)
.format(widget.date[i]),
style: context.theme.textTheme.labelLarge,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
status.getImage7Day(widget.weather[i]),
scale: 3,
),
const SizedBox(width: 5),
Expanded(
child: Text(
status.getText(widget.weather[i]),
style: context.theme.textTheme.labelLarge,
overflow: TextOverflow.ellipsis,
),
),
],
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
statusImFa.getDegree(
widget.minDegree[i].round().toInt()),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
status.getImage7Day(widget.weather[i]),
scale: 3,
),
const SizedBox(width: 5),
Expanded(
child: Text(
status.getText(widget.weather[i]),
style: context.theme.textTheme.labelLarge,
overflow: TextOverflow.ellipsis,
),
Text(
' / ',
style: context.theme.textTheme.bodyMedium
?.copyWith(
color: Colors.grey,
),
),
],
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
statusImFa.getDegree(widget.minDegree[i].round()),
style: context.theme.textTheme.labelLarge,
),
Text(
' / ',
style:
context.theme.textTheme.bodyMedium?.copyWith(
color: Colors.grey,
),
Text(
statusImFa.getDegree(
widget.maxDegree[i].round().toInt()),
style: context.theme.textTheme.bodyMedium
?.copyWith(
color: Colors.grey,
),
),
Text(
statusImFa.getDegree(widget.maxDegree[i].round()),
style:
context.theme.textTheme.bodyMedium?.copyWith(
color: Colors.grey,
),
],
),
),
],
),
],
),
);
}),
),
],
),
);
},
),
),
const Divider(),
GestureDetector(
Expand Down
2 changes: 1 addition & 1 deletion lib/app/widgets/weather_hourly.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class _WeatherHourlyState extends State<WeatherHourly> {
scale: 3,
),
Text(
statusImFa.getDegree(widget.degree.round().toInt()),
statusImFa.getDegree(widget.degree.round()),
style: context.theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/widgets/weather_now.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class _WeatherNowState extends State<WeatherNow> {
height: 200,
),
GlowText(
'${widget.degree.round().toInt()}',
'${widget.degree.round()}',
style: context.theme.textTheme.displayLarge?.copyWith(
fontSize: 90,
fontWeight: FontWeight.w800,
Expand Down
Loading

0 comments on commit cd56e31

Please sign in to comment.