Skip to content

Commit

Permalink
add section for third jumua time
Browse files Browse the repository at this point in the history
  • Loading branch information
ghassenbenzahra123 committed Oct 30, 2024
1 parent 7b8e9a1 commit 1d0a695
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 31 deletions.
6 changes: 6 additions & 0 deletions lib/src/models/times.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:mawaqit/src/helpers/time_utils.dart';
class Times {
final String? jumua;
final String? jumua2;
final String? jumua3;
final String? aidPrayerTime;
final String? aidPrayerTime2;
final int hijriAdjustment;
Expand Down Expand Up @@ -70,6 +71,7 @@ class Times {
const Times({
required this.jumua,
required this.jumua2,
required this.jumua3,
required this.aidPrayerTime,
required this.aidPrayerTime2,
required this.hijriAdjustment,
Expand All @@ -88,6 +90,7 @@ class Times {
runtimeType == other.runtimeType &&
jumua == other.jumua &&
jumua2 == other.jumua2 &&
jumua3 == other.jumua3 &&
aidPrayerTime == other.aidPrayerTime &&
aidPrayerTime2 == other.aidPrayerTime2 &&
hijriAdjustment == other.hijriAdjustment &&
Expand All @@ -101,6 +104,7 @@ class Times {
int get hashCode =>
jumua.hashCode ^
jumua2.hashCode ^
jumua3.hashCode ^
aidPrayerTime.hashCode ^
aidPrayerTime2.hashCode ^
hijriAdjustment.hashCode ^
Expand All @@ -115,6 +119,7 @@ class Times {
return 'Times{' +
' jumua: $jumua,' +
' jumua2: $jumua2,' +
' jumua3: $jumua3,' +
' aidPrayerTime: $aidPrayerTime,' +
' aidPrayerTime2: $aidPrayerTime2,' +
' hijriAdjustment: $hijriAdjustment,' +
Expand All @@ -132,6 +137,7 @@ class Times {
return Times(
jumua: map['jumua'] ?? map['jumua2'],
jumua2: replacedJumua,
jumua3: map['jumua3'],
aidPrayerTime: map['aidPrayerTime'],
aidPrayerTime2: map['aidPrayerTime2'],
hijriAdjustment: map['hijriAdjustment'] ?? -1,
Expand Down
123 changes: 92 additions & 31 deletions lib/src/pages/home/widgets/salah_items/SalahItem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SalahItemWidget extends StatelessOrientationWidget {
required this.time,
this.title,
this.iqama,
this.iqama2,
this.active = false,
this.removeBackground = false,
this.withDivider = true,
Expand All @@ -24,6 +25,7 @@ class SalahItemWidget extends StatelessOrientationWidget {
final String? title;
final String time;
final String? iqama;
final String? iqama2;

/// show divider only when both time and iqama exists
final bool withDivider;
Expand Down Expand Up @@ -76,39 +78,98 @@ class SalahItemWidget extends StatelessOrientationWidget {
),
),
SizedBox(height: 1.vr),
if (time.trim().isEmpty)
Icon(Icons.dnd_forwardslash, size: 6.vwr)
else
Container(
decoration: (iqama != null && showIqama && withDivider)
? BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.white, width: 1)),
)
: null,
child: TimeWidget.fromString(
show24hFormat: !is12period,
time: time,
style: TextStyle(
fontSize: isIqamaMoreImportant ? smallFont : bigFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
if (iqama2 != null) // Three times layout
Column(
children: [
TimeWidget.fromString(
show24hFormat: !is12period,
time: time,
style: TextStyle(
fontSize: bigFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
height: 1,
),
),
Container(
margin: EdgeInsets.symmetric(vertical: 1.vr),
width: 20.vwr, // Adjust this value to match your needs
height: 1,
// fontFamily: StringManager.getFontFamily(context),
color: Colors.white,
),
),
),
if (iqama != null && showIqama)
TimeWidget.fromString(
show24hFormat: !is12period,
time: iqama!,
style: TextStyle(
fontSize: isIqamaMoreImportant ? bigFont : smallFont,
fontWeight: FontWeight.bold,
shadows: kHomeTextShadow,
letterSpacing: 1,
color: Colors.white,
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TimeWidget.fromString(
show24hFormat: !is12period,
time: iqama!,
style: TextStyle(
fontSize: smallFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
height: 1,
),
),
Container(
height: bigFont,
width: 1,
margin: EdgeInsets.symmetric(horizontal: 1.vwr),
color: Colors.white,
),
TimeWidget.fromString(
show24hFormat: !is12period,
time: iqama2!,
style: TextStyle(
fontSize: smallFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
height: 1,
),
),
],
),
],
)
else // Original two times layout
Column(
children: [
if (time.trim().isEmpty)
Icon(Icons.dnd_forwardslash, size: 6.vwr)
else
Container(
decoration: (iqama != null && showIqama && withDivider)
? BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.white, width: 1)),
)
: null,
child: TimeWidget.fromString(
show24hFormat: !is12period,
time: time,
style: TextStyle(
fontSize: isIqamaMoreImportant ? smallFont : bigFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
height: 1,
),
),
),
if (iqama != null && showIqama)
TimeWidget.fromString(
show24hFormat: !is12period,
time: iqama!,
style: TextStyle(
fontSize: isIqamaMoreImportant ? bigFont : smallFont,
fontWeight: FontWeight.bold,
shadows: kHomeTextShadow,
letterSpacing: 1,
color: Colors.white,
),
),
],
),
],
),
Expand Down
1 change: 1 addition & 0 deletions lib/src/pages/times/widgets/jumua_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class JumuaWidget extends StatelessWidget {
title: S.of(context).jumua,
time: !mosqueManager.isJumuaOrJumua2EmptyOrNull() ? DateFormat.Hm().format(mosqueManager.activeJumuaaDate()) : "",
iqama: mosqueManager.times!.jumua2,
iqama2: mosqueManager.times!.jumua3,
isIqamaMoreImportant: false,
active: mosqueManager.nextIqamaIndex() == 1 && AppDateTime.isFriday && mosqueManager.times?.jumua != null,
);
Expand Down

0 comments on commit 1d0a695

Please sign in to comment.