Skip to content
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

Feat/iqama time message screen #1106

Merged
merged 5 commits into from
Apr 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/src/pages/developer/DeveloperScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class _DeveloperScreenState extends State<DeveloperScreen> {
walkThrowScreensSubscription?.cancel();
setState(() {
walkThrowScreensSubscription = null;
forcedScreen = null; // clear the forcedScreen when canceling the walkthrough
forcedScreen = null; // clear the forcedScreen when canceling the walkthrough
});
}

Expand Down Expand Up @@ -109,6 +109,7 @@ class _DeveloperScreenState extends State<DeveloperScreen> {
cancelWalkThrowScreens();
super.dispose();
}

@override
Widget build(BuildContext context) {
context.watch<MosqueManager>();
Expand Down
1 change: 0 additions & 1 deletion lib/src/pages/home/sub_screens/DuaaEftarScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class _DuaaEftarScreenState extends State<DuaaEftarScreen> {
),
),
ResponsiveMiniSalahBarWidget(),
SizedBox(height: 10),
],
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/src/pages/home/sub_screens/IqamaaCountDownSubScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class _IqamaaCountDownSubScreenState extends State<IqamaaCountDownSubScreen> {
height: 1,
),
).animate().slide(delay: .5.seconds).fade().addRepaintBoundary(),
SizedBox(height: 1.vh),
StreamBuilder(
stream: Stream.periodic(Duration(seconds: 1)),
builder: (context, snapshot) {
Expand All @@ -115,7 +116,7 @@ class _IqamaaCountDownSubScreenState extends State<IqamaaCountDownSubScreen> {
}),
Spacer(),
ResponsiveMiniSalahBarWidget(),
SizedBox(height: 10),
SizedBox(height: 1.vh),
],
);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/pages/home/sub_screens/RandomHadithScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class _RandomHadithScreenState extends State<RandomHadithScreen> {
),
),
ResponsiveMiniSalahBarWidget(),
SizedBox(height: 4.vh),
SizedBox(height: 10),
],
);
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/pages/home/sub_screens/fajr_wake_up_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class _FajrWakeUpSubScreenState extends State<FajrWakeUpSubScreen> {
),
),
ResponsiveMiniSalahBarWidget(),
SizedBox(height: 2.vw),
],
),
);
Expand Down
86 changes: 41 additions & 45 deletions lib/src/pages/home/widgets/salah_items/SalahItem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ class SalahItemWidget extends StatelessOrientationWidget {

@override
Widget buildPortrait(BuildContext context) {
double titleFont = 3.vwr;
double bigFont = 3.5.vwr;
double smallFont = 2.6.vwr;
double titleFont = 3.5.vwr;
double bigFont = 4.vwr;
double smallFont = 3.vwr;

final mosqueProvider = context.watch<MosqueManager>();
final mosqueConfig = mosqueProvider.mosqueConfig;
Expand All @@ -138,10 +138,11 @@ class SalahItemWidget extends StatelessOrientationWidget {
? null
: Colors.black.withOpacity(.5),
),
padding: EdgeInsets.symmetric(vertical: 1.6.vr, horizontal: 1.vwr),
padding: EdgeInsets.symmetric(vertical: 1.vr, horizontal: 1.vwr),
child: FittedBox(
fit: BoxFit.scaleDown,
child: Row(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
if (title != null && title!.trim().isNotEmpty)
Text(
Expand All @@ -154,46 +155,41 @@ class SalahItemWidget extends StatelessOrientationWidget {
height: 1.5,
),
),
SizedBox(width: 2.vr),
Column(
mainAxisSize: MainAxisSize.min,
children: [
if (time.trim().isEmpty)
Icon(Icons.dnd_forwardslash, size: 6.vwr)
else
TimeWidget.fromString(
show24hFormat: !is12period,
time: time,
style: TextStyle(
fontSize: isIqamaMoreImportant ? smallFont : bigFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
// fontFamily: StringManager.getFontFamily(context),
),
),
if (iqama != null && showIqama)
SizedBox(
height: isArabic ? 1.5.vr : 1.3.vwr,
child: Divider(
thickness: 1,
color: withDivider ? Colors.white : Colors.transparent,
),
),
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,
),
),
],
),
SizedBox(height: 1.vh),
if (time.trim().isEmpty)
Icon(Icons.dnd_forwardslash, size: 6.vwr)
else
TimeWidget.fromString(
show24hFormat: !is12period,
time: time,
style: TextStyle(
fontSize: isIqamaMoreImportant ? smallFont : bigFont,
fontWeight: FontWeight.w700,
shadows: kHomeTextShadow,
color: Colors.white,
// fontFamily: StringManager.getFontFamily(context),
),
),
if (iqama != null && showIqama)
SizedBox(
height: isArabic ? 1.5.vr : 1.3.vwr,
child: Divider(
thickness: 1,
color: withDivider ? Colors.white : Colors.transparent,
),
),
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ class ResponsiveMiniSalahBarWidget extends StatelessOrientationWidget {
final todayTimes = mosqueProvider.useTomorrowTimes
? times.dayTimesStrings(now.add(1.days), salahOnly: false)
: times.dayTimesStrings(now, salahOnly: false);
final iqamas = mosqueProvider.times!.dayIqamaStrings(now);

final turkishImask = todayTimes.length == 7 ? todayTimes.removeAt(0) : null;
todayTimes.removeAt(1);
final isIqamaMoreImportant = mosqueProvider.mosqueConfig!.iqamaMoreImportant == true;

/// on jumuaa we disable duhr highlight for mosques only
bool duhrHighlightDisable = mosqueProvider.mosqueDate().weekday == DateTime.friday && mosqueProvider.typeIsMosque;
Expand All @@ -47,16 +49,18 @@ class ResponsiveMiniSalahBarWidget extends StatelessOrientationWidget {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (turkishImask != null)
SalahItemWidget(time: turkishImask)
SalahItemWidget(removeBackground: true, time: turkishImask, isIqamaMoreImportant: isIqamaMoreImportant)
.animate()
.fadeIn(duration: _duration)
.slideY(begin: 1, duration: _duration, curve: Curves.easeOut)
.addRepaintBoundary(),
for (var i = 0; i < 5; i++)
SalahItemWidget(
time: todayTimes[i],
active: i == 1 ? nextActiveIqama == i && !duhrHighlightDisable : nextActiveIqama == i,
)
withDivider: false,
iqama: iqamas[i],
time: todayTimes[i],
active: i == 1 ? nextActiveIqama == i && !duhrHighlightDisable : nextActiveIqama == i,
isIqamaMoreImportant: isIqamaMoreImportant)
.animate(delay: _step * (i + 1))
.fadeIn(duration: _duration)
.slideY(begin: 1, duration: _duration, curve: Curves.easeOut)
Expand All @@ -76,43 +80,90 @@ class ResponsiveMiniSalahBarWidget extends StatelessOrientationWidget {
final todayTimes = mosqueProvider.useTomorrowTimes
? times.dayTimesStrings(now.add(1.days), salahOnly: false)
: times.dayTimesStrings(now, salahOnly: false);

final iqamas = mosqueProvider.times!.dayIqamaStrings(now);
final isIqamaMoreImportant = mosqueProvider.mosqueConfig!.iqamaMoreImportant == true;
final turkishImask = todayTimes.length == 7 ? todayTimes.removeAt(0) : null;
todayTimes.removeAt(1);
todayTimes.removeAt(0); // Remove the first element (Fajr)

/// on jumuaa we disable duhr highlight for mosques only
bool duhrHighlightDisable = AppDateTime.isFriday && mosqueProvider.typeIsMosque;
// Helper function to generate SalahItemWidget
Widget buildSalahItemWidget({
required String title,
required String time,
required String iqama,
required bool active,
}) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: SizedBox(
width: MediaQuery.of(context).size.width / 4,
height: 60.0,
child: SalahItemWidget(
title: title,
time: time,
iqama: iqama,
active: active,
isIqamaMoreImportant: isIqamaMoreImportant,
)
.animate()
.fadeIn(duration: _duration)
.slideY(begin: 1, duration: _duration, curve: Curves.easeOut)
.addRepaintBoundary(),
),
);
}

return Padding(
padding: EdgeInsets.symmetric(horizontal: 1.vh),
child: Wrap(
spacing: 5.vh,
runSpacing: 2.vw,
crossAxisAlignment: WrapCrossAlignment.center,
alignment: WrapAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (turkishImask != null)
buildSalahItemWidget(
title: S.of(context).imsak,
time: todayTimes[0],
iqama: iqamas[0],
active: nextActiveIqama == 0,
),
for (int index = 0; index < (turkishImask != null ? 2 : 3); index++)
buildSalahItemWidget(
title: mosqueProvider.salahName(index),
time: todayTimes[index],
iqama: iqamas[index],
active: index == 1 ? nextActiveIqama == index : nextActiveIqama == index,
),
],
),
if (turkishImask != null)
SizedBox(
width: 30.vw,
child: MiniHorizontalSalahItem(
title: S.of(context).imsak,
time: turkishImask,
)
.animate()
.fadeIn(duration: _duration)
.slideY(begin: 1, duration: _duration, curve: Curves.easeOut)
.addRepaintBoundary(),
),
for (var i = 0; i < 5; i++)
SizedBox(
width: 30.vw,
child: MiniHorizontalSalahItem(
title: mosqueProvider.salahName(i),
time: todayTimes[i],
active: i == 1 ? nextActiveIqama == i && !duhrHighlightDisable : nextActiveIqama == i,
)
.animate(delay: _step * (i + 1))
.fadeIn(duration: _duration)
.slideY(begin: 1, duration: _duration, curve: Curves.easeOut)
.addRepaintBoundary(),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
3,
(index) => buildSalahItemWidget(
title: mosqueProvider.salahName(index + 2),
time: todayTimes[index + 2],
iqama: iqamas[index + 2],
active: (index + 2) == 1 ? nextActiveIqama == (index + 2) : nextActiveIqama == (index + 2),
),
),
)
else
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: List.generate(
2,
(index) => buildSalahItemWidget(
title: mosqueProvider.salahName(index + 3),
time: todayTimes[index + 3],
iqama: iqamas[index + 3],
active: (index + 3) == 1 ? nextActiveIqama == (index + 3) : nextActiveIqama == (index + 3),
),
),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/services/mixins/audio_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ mixin AudioMixin on ChangeNotifier {
String? adhanName = mosqueConfig?.adhanVoice;
Duration duration = Duration(seconds: mosqueConfig!.adhanDuration!);

if(isFajrPray && adhanName != null){
if (isFajrPray && adhanName != null) {
adhanName = adhanName + '-fajr';
}

Expand Down
Loading