-
Notifications
You must be signed in to change notification settings - Fork 0
feature: implement weakly weather ui #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
de62507
feature: implement weakly weather ui
ShroukMohamed16 70c7e5f
refactor : solve ui issues
ShroukMohamed16 9b63da7
Merge remote-tracking branch 'origin/develop' into feature/implement-…
ShroukMohamed16 eece66e
Merge branch 'develop' into feature/implement-weakly-weather-ui
ShroukMohamed16 c21c7a0
refactor : apply theme to daily weather
ShroukMohamed16 edc75b6
fix: solve build issue
ShroukMohamed16 9def2e9
refactor : use Assets.images
ShroukMohamed16 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:flutter_bloc/flutter_bloc.dart'; | ||
| import 'package:flutter_svg/flutter_svg.dart'; | ||
| import 'package:weather_app/ui/model/daily_weather.dart'; | ||
| import 'package:weather_app/ui/theme/font_families.dart'; | ||
|
|
||
| import '../../gen/assets.gen.dart'; | ||
| import '../cubit/theme/theme_cubit.dart'; | ||
|
|
||
| class NextDaysWeatherForecastTable extends StatelessWidget { | ||
| final List<DailyWeatherInfo> dailyWeatherList; | ||
|
|
||
| const NextDaysWeatherForecastTable ({super.key, required this.dailyWeatherList}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final theme = context.watch<ThemeCubit>().state; | ||
|
|
||
| return Container( | ||
| decoration: BoxDecoration( | ||
| color: theme.colors.background, | ||
| shape: BoxShape.rectangle, | ||
| borderRadius: BorderRadius.circular(24), | ||
| border: Border.all(color: theme.colors.border, width: 1), | ||
| ), | ||
| child: ListView.separated( | ||
| padding: EdgeInsets.zero, | ||
| shrinkWrap: true, | ||
|
|
||
| itemCount: dailyWeatherList.length, | ||
|
|
||
| itemBuilder: (context, index) { | ||
| return _DailyWeatherDetails(dailyWeather: dailyWeatherList[index]); | ||
| }, | ||
|
|
||
| separatorBuilder: (context, index) { | ||
| return Divider( | ||
| height: 1, | ||
| thickness: 1, | ||
| color: theme.colors.border, | ||
| ); | ||
| }, | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| class _DailyWeatherDetails extends StatelessWidget { | ||
| final DailyWeatherInfo dailyWeather; | ||
|
|
||
| const _DailyWeatherDetails({required this.dailyWeather}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final theme = context.watch<ThemeCubit>().state; | ||
| return Padding( | ||
| padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 16.0), | ||
| child: Row( | ||
| children: [ | ||
| Expanded( | ||
| child: Container( | ||
| alignment: Alignment.centerLeft, | ||
| child: Text( | ||
| dailyWeather.dayOfWeek, | ||
| textAlign: TextAlign.start, | ||
| style: TextStyle( | ||
| fontFamily: urbanist, | ||
| fontSize: 16, | ||
| fontWeight: FontWeight.w400, | ||
| color:theme.colors.text60, | ||
| ), | ||
| ), | ||
| ), | ||
| ), | ||
|
|
||
| Expanded( | ||
| child: Center( | ||
| child: Image.asset(dailyWeather.iconPath, height: 32), | ||
| ), | ||
| ), | ||
|
|
||
| Expanded( | ||
| child: Row( | ||
|
|
||
| mainAxisSize: MainAxisSize.min, | ||
| crossAxisAlignment: CrossAxisAlignment.end, | ||
| children: [ | ||
| _TempDisplay( | ||
| icon: Assets.images.arrowUp.path, | ||
| text: '${dailyWeather.maxTemperature}°C', | ||
| ), | ||
|
|
||
| Padding( | ||
| padding: EdgeInsets.symmetric(horizontal: 4.0), | ||
| child: Text( | ||
| '|', | ||
| style: TextStyle( | ||
| fontFamily: urbanist, | ||
| color: theme.colors.backgroundStart.withAlpha(14), | ||
| fontWeight: FontWeight.w100, | ||
| ), | ||
| ), | ||
| ), | ||
|
|
||
| _TempDisplay( | ||
| icon: Assets.images.arrowDown.path, | ||
| text: '${dailyWeather.minTemperature}°C', | ||
| ), | ||
|
|
||
| ], | ||
| ), | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| class _TempDisplay extends StatelessWidget { | ||
| final String icon; | ||
| final String text; | ||
|
|
||
| const _TempDisplay({required this.icon, required this.text}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| final theme = context.watch<ThemeCubit>().state; | ||
| return Row( | ||
| children: [ | ||
| SvgPicture.asset(icon, height: 12, colorFilter: ColorFilter.mode( | ||
| theme.colors.text87, | ||
| BlendMode.srcIn, | ||
| ), | ||
| ), | ||
| const SizedBox(width: 2.5), | ||
| Text( | ||
| text, | ||
| style: TextStyle( | ||
| fontFamily: urbanist, | ||
| fontSize: 14, | ||
| color: theme.colors.text87, | ||
| fontWeight: FontWeight.w500, | ||
| letterSpacing: 0.25, | ||
| ), | ||
| ), | ||
| ], | ||
| ); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| class DailyWeatherInfo { | ||
| final String iconPath; | ||
| final int maxTemperature; | ||
| final int minTemperature; | ||
| final String dayOfWeek; | ||
|
|
||
| const DailyWeatherInfo({ | ||
| required this.iconPath, | ||
| required this.maxTemperature, | ||
| required this.minTemperature, | ||
| required this.dayOfWeek, | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.