Skip to content

Commit

Permalink
few changes for the ui
Browse files Browse the repository at this point in the history
  • Loading branch information
moha-b committed Jan 28, 2024
1 parent b85b2de commit 3efba6c
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 49 deletions.
3 changes: 3 additions & 0 deletions assets/images/weather/rain.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/images/weather/snow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/images/weather/sunny.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/core/utils/app_images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ class AppImages {
static const String _weatherImagesPath = "assets/images/weather";
static const String windSvg = "$_weatherImagesPath/wind.svg";
static const String sunSvg = "$_weatherImagesPath/sun.svg";
static const String sunnySvg = "$_weatherImagesPath/sunny.svg";
static const String rainSvg = "$_weatherImagesPath/rain.svg";
static const String snowSvg = "$_weatherImagesPath/snow.svg";
static const String humiditySvg = "$_weatherImagesPath/humidity.svg";
//
static const String daySun = "$_weatherImagesPath/Day Sun.webp";
Expand Down
106 changes: 57 additions & 49 deletions lib/features/daily_forecast/screens/widgets/daily_widget.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:clima/core/helper/date_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:lottie/lottie.dart';

import '../../../../core/common/temperature_text.dart';
import '../../../../core/helper/date_helper.dart';
import '../../../../core/utils/utils.dart';
import '../../data/models/daily_weather_model.dart';

Expand All @@ -16,64 +17,67 @@ class DailyWidget extends StatelessWidget {
final int index;
@override
Widget build(BuildContext context) {
return SizedBox(
return Container(
height: AppDimensions.height! * 0.197,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
padding: const EdgeInsets.all(8),
decoration: AppDecoration.container(context, isBordered: true),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"${DateHelper.formatDate(weatherModel.time[index]!, 'EEEE')} • ${DateHelper.formatDate(weatherModel.time[index]!, 'MM-dd')}",
style: AppTypography.medium18()),
SizedBox(height: 8),
Container(
height: AppDimensions.height! * 0.15,
padding: const EdgeInsets.all(8),
decoration: AppDecoration.container(context, isBordered: true),
child: Row(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Lottie.asset(weatherModel.image[index]!)),
SizedBox(width: 16),
Text(
"${DateHelper.formatDate(weatherModel.time[index]!, 'EEEE')} • ${DateHelper.formatDate(weatherModel.time[index]!, 'MM-dd')}",
style: AppTypography.medium18()),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
child: Row(
children: [
Expanded(child: Lottie.asset(weatherModel.image[index]!)),
Expanded(
child: FittedBox(
fit: BoxFit.scaleDown,
child: TemperatureText(
temperature:
"${weatherModel.temperature[index]}"),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: FittedBox(
fit: BoxFit.scaleDown,
child: TemperatureText(
temperature:
"${weatherModel.temperature[index]}"),
),
),
Text(
"feels like ${weatherModel.apparentTemperature[index]}"),
],
),
),
Text(
"feels like ${weatherModel.apparentTemperature[index]}"),
],
),
),
Spacer(),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
DataWidget(
apparentTemperature:
weatherModel.windSpeed10mMax[index],
icon: Icons.wind_power),
DataWidget(
apparentTemperature: weatherModel.snowfallSum[index],
icon: Icons.ac_unit),
DataWidget(
apparentTemperature: weatherModel.rainSum[index],
icon: Icons.water_drop_outlined),
DataWidget(
apparentTemperature: weatherModel.uvIndexMax[index],
icon: Icons.upcoming),
],
),
),
],
),
),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
DataWidget(
apparentTemperature:
"${weatherModel.windSpeed10mMax[index]}km/h",
icon: AppImages.windSvg),
DataWidget(
apparentTemperature: "${weatherModel.snowfallSum[index]}%",
icon: AppImages.snowSvg),
DataWidget(
apparentTemperature: "${weatherModel.rainSum[index]}%",
icon: AppImages.rainSvg),
DataWidget(
apparentTemperature: "${weatherModel.rainSum[index]}°",
icon: AppImages.sunnySvg),
],
),
const SizedBox(width: 16),
],
),
);
Expand All @@ -87,17 +91,21 @@ class DataWidget extends StatelessWidget {
required this.icon,
});

final num? apparentTemperature;
final IconData icon;
final String apparentTemperature;
final String icon;

@override
Widget build(BuildContext context) {
return Row(
children: [
Icon(icon),
SvgPicture.asset(
icon,
width: AppDimensions.width! * 0.07,
fit: BoxFit.cover,
),
const SizedBox(width: 5),
Text(
apparentTemperature.toString(),
apparentTemperature,
style: AppTypography.medium12(),
),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class CustomAppBar extends StatelessWidget {
isCenter: false,
),
),
const SizedBox(height: 16),
Text(
"${daily.temperatureMin}° ~ ${daily.temperatureMax}°",
),
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ flutter:
- assets/images/weather/humidity.svg
- assets/images/weather/sun.svg
- assets/images/weather/wind.svg
- assets/images/weather/snow.svg
- assets/images/weather/rain.svg
- assets/images/weather/sunny.svg
- assets/lottie/
- assets/map/map_dark_theme.json

Expand Down

0 comments on commit 3efba6c

Please sign in to comment.