@ -3,6 +3,8 @@ import 'package:flutter/material.dart';
import ' package:flutter_svg/svg.dart ' ;
import ' package:hmg_qline/view_models/screen_config_view_model.dart ' ;
import ' package:hmg_qline/views/common_widgets/app_general_widgets.dart ' ;
import ' package:hmg_qline/views/common_widgets/date_display_widget.dart ' ;
import ' package:hmg_qline/views/common_widgets/headline_tag_widget.dart ' ;
import ' package:provider/provider.dart ' ;
import ' package:hmg_qline/constants/app_constants.dart ' ;
import ' package:hmg_qline/utilities/enums.dart ' ;
@ -111,12 +113,12 @@ class _AppFooterState extends State<AppFooter> {
children: [
AppText (
label ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1. 8 ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1. 5 ,
fontFamily: isForArabic ? AppStrings . fontNameGesTwo : AppStrings . fontNamePoppins ,
) ,
AppText (
prayerName ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 2 ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.8 ,
fontWeight: FontWeight . bold ,
color: AppColors . darkGreyTextColor ,
fontFamily: isForArabic ? AppStrings . fontNameGesTwo : AppStrings . fontNamePoppins ,
@ -159,6 +161,115 @@ class _AppFooterState extends State<AppFooter> {
return " 0 " ;
}
bool _hasBothPrayerAndWeather ( ScreenConfigViewModel screenConfigVM ) {
return screenConfigVM . globalConfigurationsModel . isPrayerTimeReq & & screenConfigVM . globalConfigurationsModel . isWeatherReq ;
}
bool _isPortraitWithBothFeatures ( ScreenConfigViewModel screenConfigVM ) {
bool isPortrait = screenConfigVM . globalConfigurationsModel . orientationTypeEnum = = ScreenOrientationEnum . portraitUp | |
screenConfigVM . globalConfigurationsModel . orientationTypeEnum = = ScreenOrientationEnum . portraitDown ;
return isPortrait & & _hasBothPrayerAndWeather ( screenConfigVM ) ;
}
Widget _buildConnectionStatus ( ScreenConfigViewModel screenConfigVM ) {
bool isPortrait = screenConfigVM . globalConfigurationsModel . orientationTypeEnum = = ScreenOrientationEnum . portraitUp | |
screenConfigVM . globalConfigurationsModel . orientationTypeEnum = = ScreenOrientationEnum . portraitDown ;
EdgeInsets padding ;
if ( _isPortraitWithBothFeatures ( screenConfigVM ) ) {
padding = EdgeInsets . only ( top: SizeConfig . getHeightMultiplier ( ) ! * 0.15 ) ;
} else if ( isPortrait ) {
padding = EdgeInsets . only ( top: SizeConfig . getHeightMultiplier ( ) ! * 0.3 ) ;
} else {
padding = EdgeInsets . only ( top: SizeConfig . getHeightMultiplier ( ) ! * 0.15 ) ;
}
Widget content ;
if ( _isPortraitWithBothFeatures ( screenConfigVM ) ) {
content = Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
_buildStatusRow ( " Hub Status " , screenConfigVM . isHubConnected ) ,
SizedBox ( height: SizeConfig . getHeightMultiplier ( ) ! * 0.05 ) ,
_buildStatusRow ( " Network Status " , screenConfigVM . isInternetConnected ) ,
] ,
) ;
} else if ( isPortrait ) {
content = Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
_buildStatusRow ( " Hub Status " , screenConfigVM . isHubConnected ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) ! * 2 ) ,
_buildStatusRow ( " Network Status " , screenConfigVM . isInternetConnected ) ,
] ,
) ;
} else {
content = Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
_buildStatusRow ( " Hub Status " , screenConfigVM . isHubConnected ) ,
SizedBox ( height: SizeConfig . getHeightMultiplier ( ) ! * 0.05 ) ,
_buildStatusRow ( " Network Status " , screenConfigVM . isInternetConnected ) ,
] ,
) ;
}
return Padding ( padding: padding , child: content ) ;
}
Widget buildWeatherIcon ( String ? weatherIconPath ) {
if ( weatherIconPath ! = null ) {
return SvgPicture . asset (
weatherIconPath ,
height: SizeConfig . getHeightMultiplier ( ) * 0.4 ,
) ;
}
return const SizedBox . shrink ( ) ;
}
Widget buildCurrentCityTemp ( String ? currentCity , String ? temp , bool isForArabic ) {
return Column (
mainAxisSize: MainAxisSize . min ,
children: [
if ( temp ! = null )
AppText (
temp . toString ( ) ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 2 ,
fontFamily: AppStrings . fontNamePoppins ,
fontWeight: FontWeight . bold ,
) ,
AppText (
currentCity . toString ( ) ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.8 ,
fontFamily: isForArabic ? AppStrings . fontNameGesTwo : AppStrings . fontNamePoppins ,
) ,
] ,
) ;
}
Widget buildTempDetails ( String ? iconPhrase , double ? maxTempText , double ? minTempText , bool isForArabic ) {
return Column (
mainAxisSize: MainAxisSize . min ,
children: [
SimpleDateDisplay ( isForArabic: isForArabic ) ,
if ( iconPhrase ! = null )
AppText (
iconPhrase ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.5 ,
fontFamily: AppStrings . fontNamePoppins ,
) ,
if ( minTempText ! = null & & maxTempText ! = null )
AppText (
" $ minTempText °C / $ maxTempText °C " ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.5 ,
fontFamily: AppStrings . fontNamePoppins ,
fontWeight: FontWeight . bold ,
) ,
] ,
) ;
}
@ override
Widget build ( BuildContext context ) {
return Consumer < ScreenConfigViewModel > (
@ -167,14 +278,21 @@ class _AppFooterState extends State<AppFooter> {
screenConfigVM . globalConfigurationsModel . orientationTypeEnum = = ScreenOrientationEnum . portraitDown ;
return Padding (
padding: EdgeInsets . symmetric (
horizontal: SizeConfig . getWidthMultiplier ( ) * 4 ,
vertical: SizeConfig . getHeightMultiplier ( ) * 0.14 ,
padding: EdgeInsets . fromLTRB (
SizeConfig . getWidthMultiplier ( ) * 4 ,
SizeConfig . getHeightMultiplier ( ) * 0.14 ,
0 ,
SizeConfig . getHeightMultiplier ( ) * 0.05 ,
) ,
child: Column (
mainAxisSize: MainAxisSize . min ,
children: [
Padding (
padding: EdgeInsets . only ( right: SizeConfig . getWidthMultiplier ( ) * 4 ) ,
child: Row (
children: [
Expanded (
flex: 3 ,
flex : screenConfigVM . globalConfigurationsModel . isWeatherReq & & screenConfigVM . globalConfigurationsModel . isPrayerTimeReq ? 2 : 3 ,
child: customShadowSmoothContainer (
height: SizeConfig . getHeightMultiplier ( ) * 0.8 ,
padding: EdgeInsets . symmetric (
@ -218,26 +336,7 @@ class _AppFooterState extends State<AppFooter> {
) ,
] ,
) ,
Padding (
padding: isPortrait ? EdgeInsets . only ( top: SizeConfig . getHeightMultiplier ( ) ! * 0.3 ) : EdgeInsets . only ( top: SizeConfig . getHeightMultiplier ( ) ! * 0.15 ) ,
child: isPortrait
? Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
_buildStatusRow ( " Hub Status " , screenConfigVM . isHubConnected ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) ! * 2 ) ,
_buildStatusRow ( " Network Status " , screenConfigVM . isInternetConnected ) ,
] ,
)
: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
children: [
_buildStatusRow ( " Hub Status " , screenConfigVM . isHubConnected ) ,
SizedBox ( height: SizeConfig . getHeightMultiplier ( ) ! * 0.05 ) ,
_buildStatusRow ( " Network Status " , screenConfigVM . isInternetConnected ) ,
] ,
) ,
) ,
_buildConnectionStatus ( screenConfigVM ) ,
] ,
) ,
) ,
@ -247,18 +346,46 @@ class _AppFooterState extends State<AppFooter> {
Directionality (
textDirection: screenConfigVM . globalConfigurationsModel . textDirection ,
child: Expanded (
flex: isPortrait ? 2 : 3 ,
flex: 2 ,
child: customShadowSmoothContainer (
height: SizeConfig . getHeightMultiplier ( ) * 0.8 ,
padding: EdgeInsets . symmetric (
horizontal: isPortrait ? SizeConfig . getWidthMultiplier ( ) * 3 : SizeConfig . getWidthMultiplier ( ) * 1. 5 ,
horizontal: isPortrait ? SizeConfig . getWidthMultiplier ( ) * 2.5 : SizeConfig . getWidthMultiplier ( ) * 1. 3 ,
vertical: SizeConfig . getHeightMultiplier ( ) * 0.1 ,
) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
if ( isPortrait ) . . . [
SvgPicture . asset (
AppAssets . salahTimeIcon ,
height: SizeConfig . getHeightMultiplier ( ) * 0.4 ,
) ,
] ,
Row (
children: [
if ( screenConfigVM . nextPrayerToShowEng . isNotEmpty ) . . . [
_buildPrayerColumn ( screenConfigVM . globalConfigurationsModel . nextPrayerTextEng , " ${ screenConfigVM . nextPrayerToShowEng } " ) ,
] ,
if ( screenConfigVM . nextPrayerToShowEng . isNotEmpty & & screenConfigVM . nextPrayerToShowArb . isNotEmpty ) . . . [
Padding (
padding: EdgeInsets . fromLTRB (
SizeConfig . getWidthMultiplier ( ) ! * 0.1 ,
SizeConfig . getHeightMultiplier ( ) ! * 0.18 ,
SizeConfig . getWidthMultiplier ( ) ! * 0.1 ,
0 ,
) ,
child: AppText ( " | " , fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.8 , color: AppColors . darkGreyTextColor ) ,
) ,
] ,
if ( screenConfigVM . nextPrayerToShowArb . isNotEmpty ) . . . [
_buildPrayerColumn ( screenConfigVM . globalConfigurationsModel . nextPrayerTextArb , screenConfigVM . nextPrayerToShowArb , isForArabic: true ) ,
] ,
] ,
) ,
SizedBox (
width: SizeConfig . getWidthMultiplier ( ) * 15 ,
width: SizeConfig . getWidthMultiplier ( ) * 14 ,
child: Center (
child: Column (
crossAxisAlignment: CrossAxisAlignment . start ,
mainAxisAlignment: MainAxisAlignment . center ,
@ -275,14 +402,14 @@ class _AppFooterState extends State<AppFooter> {
_isMoreThanOneHour ( _remainingTime )
? AppText (
screenConfigVM . nextPrayerTime ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 3 ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 2.5 ,
fontWeight: FontWeight . bold ,
color: AppColors . newRedColor ,
letterSpacing: 1.5 ,
)
: AppText (
_remainingTime ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 3 ,
fontSize: SizeConfig . getWidthMultiplier ( ) ! * 2.5 ,
fontWeight: FontWeight . bold ,
color: AppColors . newRedColor ,
letterSpacing: 1.5 ,
@ -290,36 +417,67 @@ class _AppFooterState extends State<AppFooter> {
] ,
) ,
) ,
Row (
children: [
if ( screenConfigVM . nextPrayerToShowEng . isNotEmpty ) . . . [
_buildPrayerColumn ( screenConfigVM . globalConfigurationsModel . nextPrayerTextEng , " ${ screenConfigVM . nextPrayerToShowEng } " ) ,
) ,
] ,
if ( screenConfigVM . nextPrayerToShowEng . isNotEmpty & & screenConfigVM . nextPrayerToShowArb . isNotEmpty ) . . . [
Padding (
padding: EdgeInsets . fromLTRB (
SizeConfig . getWidthMultiplier ( ) ! * 0.1 ,
SizeConfig . getHeightMultiplier ( ) ! * 0.18 ,
SizeConfig . getWidthMultiplier ( ) ! * 0.1 ,
0 ,
) ,
child: AppText ( " | " , fontSize: SizeConfig . getWidthMultiplier ( ) ! * 1.8 , color: AppColors . darkGreyTextColor ) ,
) ,
) ,
) ,
] ,
if ( screenConfigVM . nextPrayerToShowArb . isNotEmpty ) . . . [
_buildPrayerColumn ( screenConfigVM . globalConfigurationsModel . nextPrayerTextArb , screenConfigVM . nextPrayerToShowArb , isForArabic: true ) ,
if ( screenConfigVM . globalConfigurationsModel . isWeatherReq & &
( screenConfigVM . globalConfigurationsModel . orientationTypeEnum ! = ScreenOrientationEnum . landscapeLeft & &
screenConfigVM . globalConfigurationsModel . orientationTypeEnum ! = ScreenOrientationEnum . landscapeRight ) ) . . . [
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) ! * 1.7 ) ,
Expanded (
flex: isPortrait ? 3 : 4 ,
child: customShadowSmoothContainer (
height: SizeConfig . getHeightMultiplier ( ) * 0.8 ,
padding: EdgeInsets . symmetric (
horizontal: isPortrait ? SizeConfig . getWidthMultiplier ( ) * 3 : SizeConfig . getWidthMultiplier ( ) * 1.5 ,
vertical: SizeConfig . getHeightMultiplier ( ) * 0.1 ,
) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceBetween ,
children: [
Row (
children: [
buildWeatherIcon ( screenConfigVM . weathersWidgetModel . weatherIconPath ? ? AppAssets . weatherIcon ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) * 1.2 ) ,
buildCurrentCityTemp ( " الرياض " , " 21 °C " , true ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) * 1.2 ) ,
buildTempDetails ( screenConfigVM . weathersWidgetModel . iconPhrase , screenConfigVM . weathersWidgetModel . maxTemp , screenConfigVM . weathersWidgetModel . minTemp , true ) ,
] ,
) ,
Row (
children: [
buildCurrentCityTemp ( " Riyadh " , " 21 °C " , false ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) * 1.2 ) ,
buildTempDetails ( screenConfigVM . weathersWidgetModel . iconPhrase , screenConfigVM . weathersWidgetModel . maxTemp , screenConfigVM . weathersWidgetModel . minTemp , false ) ,
SizedBox ( width: SizeConfig . getWidthMultiplier ( ) * 1.2 ) ,
buildWeatherIcon ( screenConfigVM . weathersWidgetModel . weatherIconPath ? ? AppAssets . weatherIcon ) ,
] ,
) ,
if ( isPortrait ) . . . [
SvgPicture . asset (
AppAssets . salahTimeIcon ,
height: SizeConfig . getHeightMultiplier ( ) * 0.5 ,
] ,
) ,
) ,
) ,
] ,
] ,
) ,
) ,
SizedBox ( height: SizeConfig . getHeightMultiplier ( ) ! * 0.1 ) ,
if ( screenConfigVM . globalConfigurationsModel . isRssFeedReq & & ( screenConfigVM . rssFeedModel . rssFeed ! = null & & screenConfigVM . rssFeedModel . rssFeed ! . isNotEmpty ) ) . . . [
/ / if ( true ) . . . [
customShadowSmoothContainer (
removeRightBorder: true ,
height: SizeConfig . getHeightMultiplier ( ) ! * 0.3 ,
width: double . infinity ,
child: Row (
children: [
const HmgNewsWidget ( tagTitle: " HMG News " ) ,
rssFeedWidget ( ) ,
/ / customShadowSmoothContainer ( child: rssFeedWidget ( ) ) ,
] ,
) ,
) ,
] ,