Add midnight fallback notice, overnight simulations, and keyboard log filter

This commit is contained in:
dwindown
2026-04-07 11:27:39 +07:00
parent 414450125d
commit c1eade84ab
8 changed files with 1989 additions and 1615 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,14 +13,14 @@ class AdzanAlertScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final screenData = ref.watch(screenStateProvider); final screenData = ref.watch(screenStateProvider);
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now(); final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider); final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider); final settings = ref.watch(settingsProvider);
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
final s = size.width / 1920; final s = size.width / 1920;
final prayerLabel = screenData.activePrayer final prayerLabel =
?.displayLabel(isFriday: screenData.isFriday) ?? screenData.activePrayer?.displayLabel(isFriday: screenData.isFriday) ??
''; '';
final timeStr = final timeStr =
'${clock.hour.toString().padLeft(2, '0')}:${clock.minute.toString().padLeft(2, '0')}'; '${clock.hour.toString().padLeft(2, '0')}:${clock.minute.toString().padLeft(2, '0')}';
final secStr = clock.second.toString().padLeft(2, '0'); final secStr = clock.second.toString().padLeft(2, '0');
@@ -54,8 +54,8 @@ class AdzanAlertScreen extends ConsumerWidget {
child: Center( child: Center(
child: Opacity( child: Opacity(
opacity: 0.03, opacity: 0.03,
child: Icon(Icons.mosque, size: 500 * s, child: Icon(Icons.mosque,
color: SacredColors.onSurface), size: 500 * s, color: SacredColors.onSurface),
), ),
), ),
), ),
@@ -66,8 +66,8 @@ class AdzanAlertScreen extends ConsumerWidget {
left: 0, left: 0,
right: 0, right: 0,
child: Container( child: Container(
padding: EdgeInsets.symmetric( padding:
horizontal: 64 * s, vertical: 24 * s), EdgeInsets.symmetric(horizontal: 64 * s, vertical: 24 * s),
color: SacredColors.background, color: SacredColors.background,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -136,7 +136,8 @@ class AdzanAlertScreen extends ConsumerWidget {
.withValues(alpha: 0.4), .withValues(alpha: 0.4),
borderRadius: BorderRadius.circular(SacredRadii.full), borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all( border: Border.all(
color: SacredColors.outlineVariant.withValues(alpha: 0.15), color:
SacredColors.outlineVariant.withValues(alpha: 0.15),
), ),
), ),
child: Row( child: Row(
@@ -168,8 +169,8 @@ class AdzanAlertScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
fontSize: 48 * s, fontSize: 48 * s,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: SacredColors.onSurface color:
.withValues(alpha: 0.5), SacredColors.onSurface.withValues(alpha: 0.5),
), ),
), ),
Text( Text(
@@ -253,9 +254,8 @@ class AdzanAlertScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
fontSize: isActive ? 32 * fs : 28 * fs, fontSize: isActive ? 32 * fs : 28 * fs,
fontWeight: isActive ? FontWeight.w700 : FontWeight.w600, fontWeight: isActive ? FontWeight.w700 : FontWeight.w600,
color: isActive color:
? SacredColors.primary isActive ? SacredColors.primary : SacredColors.onSurface,
: SacredColors.onSurface,
), ),
), ),
], ],
@@ -307,8 +307,8 @@ class _PulsingIconState extends State<_PulsingIcon>
height: 200 * s, height: 200 * s,
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
color: SacredColors.secondary color:
.withValues(alpha: 0.1 * _ctrl.value), SacredColors.secondary.withValues(alpha: 0.1 * _ctrl.value),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
blurRadius: 60 * s * _ctrl.value, blurRadius: 60 * s * _ctrl.value,

View File

@@ -93,12 +93,14 @@ class _HomeViewState extends ConsumerState<HomeView> {
if (result.synced) { if (result.synced) {
debugPrint('[AutoSync] Cache refreshed successfully.'); debugPrint('[AutoSync] Cache refreshed successfully.');
ref.invalidate(todayScheduleProvider); ref.invalidate(todayScheduleProvider);
ref.invalidate(runtimeScheduleProvider);
ref.invalidate(scheduleCacheStatusProvider); ref.invalidate(scheduleCacheStatusProvider);
return; return;
} }
if (result.attempted) { if (result.attempted) {
debugPrint('[AutoSync] Refresh attempt failed. Staying on local cache.'); debugPrint(
'[AutoSync] Refresh attempt failed. Staying on local cache.');
} }
} finally { } finally {
_isAutoRefreshRunning = false; _isAutoRefreshRunning = false;
@@ -211,7 +213,10 @@ class _HomeViewState extends ConsumerState<HomeView> {
BackgroundRotateAction? _matchManualRotateSequence() { BackgroundRotateAction? _matchManualRotateSequence() {
if (_recentKeys.length < 3) return null; if (_recentKeys.length < 3) return null;
final tail = _recentKeys.sublist(_recentKeys.length - 3).map(_normalizedComboKey).toList(); final tail = _recentKeys
.sublist(_recentKeys.length - 3)
.map(_normalizedComboKey)
.toList();
if (tail[0] == LogicalKeyboardKey.arrowRight && if (tail[0] == LogicalKeyboardKey.arrowRight &&
tail[1] == LogicalKeyboardKey.arrowRight && tail[1] == LogicalKeyboardKey.arrowRight &&
tail[2] == LogicalKeyboardKey.select) { tail[2] == LogicalKeyboardKey.select) {
@@ -294,14 +299,17 @@ class _HomeViewState extends ConsumerState<HomeView> {
if (previous == null) return; if (previous == null) return;
// TRIGGER 1: Adzan Beep (Fires precisely when transitioning to Adzan) // TRIGGER 1: Adzan Beep (Fires precisely when transitioning to Adzan)
if (previous.state != ScreenState.adzan && next.state == ScreenState.adzan) { if (previous.state != ScreenState.adzan &&
next.state == ScreenState.adzan) {
SoundService.instance.playAdzanBeep(); SoundService.instance.playAdzanBeep();
} }
// TRIGGER 2: 3-Second Iqomah Countdown // TRIGGER 2: 3-Second Iqomah Countdown
if (next.state == ScreenState.menujuIqomah && next.iqomahRemaining != null) { if (next.state == ScreenState.menujuIqomah &&
next.iqomahRemaining != null) {
// Play precisely on the tick where it is 3 seconds. // Play precisely on the tick where it is 3 seconds.
if (previous.iqomahRemaining?.inSeconds != 3 && next.iqomahRemaining!.inSeconds == 3) { if (previous.iqomahRemaining?.inSeconds != 3 &&
next.iqomahRemaining!.inSeconds == 3) {
SoundService.instance.playIqomahCountdown(); SoundService.instance.playIqomahCountdown();
} }
} }

View File

@@ -21,7 +21,7 @@ class JumatScreen extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now(); final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider); final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider); final settings = ref.watch(settingsProvider);
final screenData = ref.watch(screenStateProvider); final screenData = ref.watch(screenStateProvider);
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
@@ -31,8 +31,8 @@ class JumatScreen extends ConsumerWidget {
final timeStr = DateFormat('HH:mm').format(clock); final timeStr = DateFormat('HH:mm').format(clock);
final secStr = DateFormat(':ss').format(clock); final secStr = DateFormat(':ss').format(clock);
final dateGregorian = DateFormat('EEEE, d MMMM yyyy', 'en').format(clock); final dateGregorian = DateFormat('EEEE, d MMMM yyyy', 'en').format(clock);
final dateHijri = final dateHijri = ref.watch(hijriDateProvider).valueOrNull ??
ref.watch(hijriDateProvider).valueOrNull ?? HijriDateFormatter.format(clock); HijriDateFormatter.format(clock);
final durToKhutbah = screenData.timeUntilNext ?? const Duration(minutes: 0); final durToKhutbah = screenData.timeUntilNext ?? const Duration(minutes: 0);
final minToKhutbah = durToKhutbah.inMinutes; final minToKhutbah = durToKhutbah.inMinutes;
@@ -42,7 +42,8 @@ class JumatScreen extends ConsumerWidget {
child: Stack( child: Stack(
children: [ children: [
// ── Underlay: Branded local image or Unsplash ── // ── Underlay: Branded local image or Unsplash ──
if (settings.brandedBgImage != null && settings.brandedBgImage!.isNotEmpty) if (settings.brandedBgImage != null &&
settings.brandedBgImage!.isNotEmpty)
Positioned.fill( Positioned.fill(
child: Image.file( child: Image.file(
File(settings.brandedBgImage!), File(settings.brandedBgImage!),
@@ -99,16 +100,20 @@ class JumatScreen extends ConsumerWidget {
children: [ children: [
// Pill // Pill
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 24 * s, vertical: 8 * s), padding: EdgeInsets.symmetric(
horizontal: 24 * s, vertical: 8 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: SacredColors.secondary.withValues(alpha: 0.1), color: SacredColors.secondary.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(SacredRadii.full), borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all(color: SacredColors.secondary.withValues(alpha: 0.2)), border: Border.all(
color: SacredColors.secondary
.withValues(alpha: 0.2)),
), ),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
_PulsingDot(color: SacredColors.secondary, size: 12 * s), _PulsingDot(
color: SacredColors.secondary, size: 12 * s),
SizedBox(width: 12 * s), SizedBox(width: 12 * s),
Text( Text(
'PERSIAPAN JUMAT', 'PERSIAPAN JUMAT',
@@ -146,7 +151,8 @@ class JumatScreen extends ConsumerWidget {
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
fontSize: 48 * s, fontSize: 48 * s,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: SacredColors.primary.withValues(alpha: 0.7), color:
SacredColors.primary.withValues(alpha: 0.7),
), ),
), ),
), ),
@@ -183,9 +189,11 @@ class JumatScreen extends ConsumerWidget {
child: Container( child: Container(
padding: EdgeInsets.all(40 * s), padding: EdgeInsets.all(40 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: SacredColors.surfaceContainerHigh.withValues(alpha: 0.6), color: SacredColors.surfaceContainerHigh
.withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(SacredRadii.xl), borderRadius: BorderRadius.circular(SacredRadii.xl),
border: Border.all(color: Colors.white.withValues(alpha: 0.05)), border: Border.all(
color: Colors.white.withValues(alpha: 0.05)),
), ),
child: ClipRRect( child: ClipRRect(
borderRadius: BorderRadius.circular(SacredRadii.xl), borderRadius: BorderRadius.circular(SacredRadii.xl),
@@ -207,7 +215,10 @@ class JumatScreen extends ConsumerWidget {
letterSpacing: 3 * s, letterSpacing: 3 * s,
), ),
), ),
HugeIcon(icon: HugeIcons.strokeRoundedSparkles, color: SacredColors.secondary, size: 24 * s), HugeIcon(
icon: HugeIcons.strokeRoundedSparkles,
color: SacredColors.secondary,
size: 24 * s),
], ],
), ),
SizedBox(height: 16 * s), SizedBox(height: 16 * s),
@@ -223,23 +234,23 @@ class JumatScreen extends ConsumerWidget {
SizedBox(height: 32 * s), SizedBox(height: 32 * s),
// Khatib Info // Khatib Info
_buildInfoTile( _buildInfoTile(s,
s, icon: Icons.person_pin,
icon: Icons.person_pin, color: SacredColors.primary,
color: SacredColors.primary, label: 'KHATIB HARI INI',
label: 'KHATIB HARI INI', value: settings.khatibName.isEmpty
value: settings.khatibName.isEmpty ? 'Belum Diatur' : settings.khatibName ? 'Belum Diatur'
), : settings.khatibName),
SizedBox(height: 24 * s), SizedBox(height: 24 * s),
// Countdown Info // Countdown Info
_buildInfoTile( _buildInfoTile(s,
s, icon: Icons.timer,
icon: Icons.timer, color: SacredColors.secondary,
color: SacredColors.secondary, label: 'KHUTBAH DIMULAI DALAM',
label: 'KHUTBAH DIMULAI DALAM', value: minToKhutbah > 0
value: minToKhutbah > 0 ? '~ $minToKhutbah Menit' : 'Sebentar Lagi' ? '~ $minToKhutbah Menit'
), : 'Sebentar Lagi'),
], ],
), ),
), ),
@@ -277,7 +288,8 @@ class JumatScreen extends ConsumerWidget {
children: [ children: [
// Mosque Name // Mosque Name
GestureDetector( GestureDetector(
onTap: () => Navigator.of(context).push(MaterialPageRoute(builder: (_) => const AdminScreen())), onTap: () => Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => const AdminScreen())),
child: Text( child: Text(
settings.masjidName, settings.masjidName,
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
@@ -290,7 +302,10 @@ class JumatScreen extends ConsumerWidget {
// Mosque Address // Mosque Address
Row( Row(
children: [ children: [
HugeIcon(icon: HugeIcons.strokeRoundedMosque01, color: SacredColors.primary, size: 24 * s), HugeIcon(
icon: HugeIcons.strokeRoundedMosque01,
color: SacredColors.primary,
size: 24 * s),
SizedBox(width: 8 * s), SizedBox(width: 8 * s),
Text( Text(
settings.masjidAddress, settings.masjidAddress,
@@ -306,7 +321,11 @@ class JumatScreen extends ConsumerWidget {
); );
} }
Widget _buildInfoTile(double s, {required IconData icon, required Color color, required String label, required String value}) { Widget _buildInfoTile(double s,
{required IconData icon,
required Color color,
required String label,
required String value}) {
return Container( return Container(
padding: EdgeInsets.all(20 * s), padding: EdgeInsets.all(20 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -373,32 +392,44 @@ class JumatScreen extends ConsumerWidget {
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
_buildTimeItem(s, 'Fajr', schedule.subuh, Icons.brightness_3, false), _buildTimeItem(s, 'Fajr', schedule.subuh, Icons.brightness_3, false),
_buildTimeItem(s, 'Terbit', schedule.terbit, Icons.wb_twilight, false), _buildTimeItem(
s, 'Terbit', schedule.terbit, Icons.wb_twilight, false),
_buildTimeItem(s, 'JUMAT', schedule.dzuhur, Icons.wb_sunny, true), _buildTimeItem(s, 'JUMAT', schedule.dzuhur, Icons.wb_sunny, true),
_buildTimeItem(s, 'Asr', schedule.ashar, Icons.sunny_snowing, false), _buildTimeItem(s, 'Asr', schedule.ashar, Icons.sunny_snowing, false),
_buildTimeItem(s, 'Maghrib', schedule.maghrib, Icons.wb_cloudy, false), _buildTimeItem(
s, 'Maghrib', schedule.maghrib, Icons.wb_cloudy, false),
_buildTimeItem(s, 'Isha', schedule.isya, Icons.bedtime, false), _buildTimeItem(s, 'Isha', schedule.isya, Icons.bedtime, false),
], ],
), ),
); );
} }
Widget _buildTimeItem(double s, String name, String time, IconData icon, bool isJumat) { Widget _buildTimeItem(
double s, String name, String time, IconData icon, bool isJumat) {
if (isJumat) { if (isJumat) {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 48 * s, vertical: 12 * s), padding: EdgeInsets.symmetric(horizontal: 48 * s, vertical: 12 * s),
decoration: BoxDecoration( decoration: BoxDecoration(
color: SacredColors.primary.withValues(alpha: 0.15), color: SacredColors.primary.withValues(alpha: 0.15),
border: Border.all(color: SacredColors.primary.withValues(alpha: 0.3)), border:
Border.all(color: SacredColors.primary.withValues(alpha: 0.3)),
borderRadius: BorderRadius.circular(SacredRadii.xl), borderRadius: BorderRadius.circular(SacredRadii.xl),
), ),
child: Column( child: Column(
children: [ children: [
Icon(icon, color: SacredColors.primary, size: 28 * s), Icon(icon, color: SacredColors.primary, size: 28 * s),
SizedBox(height: 8 * s), SizedBox(height: 8 * s),
Text(name, style: GoogleFonts.manrope(fontSize: 18 * s, fontWeight: FontWeight.w800, color: SacredColors.primary)), Text(name,
style: GoogleFonts.manrope(
fontSize: 18 * s,
fontWeight: FontWeight.w800,
color: SacredColors.primary)),
SizedBox(height: 4 * s), SizedBox(height: 4 * s),
Text(time, style: GoogleFonts.plusJakartaSans(fontSize: 16 * s, fontWeight: FontWeight.w700, color: SacredColors.primary)), Text(time,
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s,
fontWeight: FontWeight.w700,
color: SacredColors.primary)),
], ],
), ),
); );
@@ -407,11 +438,21 @@ class JumatScreen extends ConsumerWidget {
padding: EdgeInsets.symmetric(horizontal: 24 * s, vertical: 8 * s), padding: EdgeInsets.symmetric(horizontal: 24 * s, vertical: 8 * s),
child: Column( child: Column(
children: [ children: [
Icon(icon, color: SacredColors.onSurface.withValues(alpha: 0.6), size: 24 * s), Icon(icon,
color: SacredColors.onSurface.withValues(alpha: 0.6),
size: 24 * s),
SizedBox(height: 8 * s), SizedBox(height: 8 * s),
Text(name, style: GoogleFonts.manrope(fontSize: 16 * s, fontWeight: FontWeight.w500, color: SacredColors.onSurface.withValues(alpha: 0.6))), Text(name,
style: GoogleFonts.manrope(
fontSize: 16 * s,
fontWeight: FontWeight.w500,
color: SacredColors.onSurface.withValues(alpha: 0.6))),
SizedBox(height: 4 * s), SizedBox(height: 4 * s),
Text(time, style: GoogleFonts.plusJakartaSans(fontSize: 16 * s, fontWeight: FontWeight.w700, color: SacredColors.onSurface)), Text(time,
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s,
fontWeight: FontWeight.w700,
color: SacredColors.onSurface)),
], ],
), ),
); );
@@ -420,7 +461,9 @@ class JumatScreen extends ConsumerWidget {
Widget _buildMarquee(double s, double fs, AppSettings settings) { Widget _buildMarquee(double s, double fs, AppSettings settings) {
// Quick custom simplified marquee or fallback to settings.runningTexts // Quick custom simplified marquee or fallback to settings.runningTexts
final texts = settings.runningTexts.isEmpty final texts = settings.runningTexts.isEmpty
? ["JUMAT MUBARAK: Luruskan dan rapatkan shaf. Harap non-aktifkan alat komunikasi."] ? [
"JUMAT MUBARAK: Luruskan dan rapatkan shaf. Harap non-aktifkan alat komunikasi."
]
: settings.runningTexts; : settings.runningTexts;
return Container( return Container(
@@ -448,29 +491,45 @@ class _PulsingDot extends StatefulWidget {
State<_PulsingDot> createState() => _PulsingDotState(); State<_PulsingDot> createState() => _PulsingDotState();
} }
class _PulsingDotState extends State<_PulsingDot> with SingleTickerProviderStateMixin { class _PulsingDotState extends State<_PulsingDot>
with SingleTickerProviderStateMixin {
late AnimationController _ctrl; late AnimationController _ctrl;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_ctrl = AnimationController(vsync: this, duration: const Duration(milliseconds: 1200))..repeat(); _ctrl = AnimationController(
vsync: this, duration: const Duration(milliseconds: 1200))
..repeat();
} }
@override @override
void dispose() { _ctrl.dispose(); super.dispose(); } void dispose() {
_ctrl.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(
width: widget.size, height: widget.size, width: widget.size,
height: widget.size,
child: Stack( child: Stack(
children: [ children: [
FadeTransition( FadeTransition(
opacity: Tween(begin: 0.75, end: 0.0).animate(_ctrl), opacity: Tween(begin: 0.75, end: 0.0).animate(_ctrl),
child: ScaleTransition( child: ScaleTransition(
scale: Tween(begin: 1.0, end: 2.0).animate(_ctrl), scale: Tween(begin: 1.0, end: 2.0).animate(_ctrl),
child: Container(decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color)), child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle, color: widget.color)),
), ),
), ),
Center(child: Container(width: widget.size, height: widget.size, decoration: BoxDecoration(shape: BoxShape.circle, color: widget.color))), Center(
child: Container(
width: widget.size,
height: widget.size,
decoration: BoxDecoration(
shape: BoxShape.circle, color: widget.color))),
], ],
), ),
); );
@@ -485,15 +544,23 @@ class _JumatMarquee extends StatefulWidget {
State<_JumatMarquee> createState() => _JumatMarqueeState(); State<_JumatMarquee> createState() => _JumatMarqueeState();
} }
class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMixin { class _JumatMarqueeState extends State<_JumatMarquee>
with TickerProviderStateMixin {
late AnimationController _ctrl; late AnimationController _ctrl;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_ctrl = AnimationController(vsync: this, duration: const Duration(seconds: 30))..repeat(); _ctrl =
AnimationController(vsync: this, duration: const Duration(seconds: 30))
..repeat();
} }
@override @override
void dispose() { _ctrl.dispose(); super.dispose(); } void dispose() {
_ctrl.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final joined = widget.texts.join(""); final joined = widget.texts.join("");
@@ -504,29 +571,34 @@ class _JumatMarqueeState extends State<_JumatMarquee> with TickerProviderStateMi
letterSpacing: 2 * widget.s, letterSpacing: 2 * widget.s,
); );
return LayoutBuilder( return LayoutBuilder(builder: (context, constraints) {
builder: (context, constraints) { return Stack(
return Stack( children: [
children: [ AnimatedBuilder(
AnimatedBuilder( animation: _ctrl,
animation: _ctrl, builder: (ctx, child) {
builder: (ctx, child) { // Ensure endless scroll mathematically
// Ensure endless scroll mathematically return Positioned(
return Positioned( left: -(_ctrl.value * constraints.maxWidth),
left: -(_ctrl.value * constraints.maxWidth), top: 0,
top: 0, bottom: 0, bottom: 0,
child: Row( child: Row(
children: [ children: [
Container(alignment: Alignment.centerLeft, width: constraints.maxWidth, child: Text(joined, style: style, maxLines: 1)), Container(
Container(alignment: Alignment.centerLeft, width: constraints.maxWidth, child: Text(joined, style: style, maxLines: 1)), alignment: Alignment.centerLeft,
], width: constraints.maxWidth,
), child: Text(joined, style: style, maxLines: 1)),
); Container(
}, alignment: Alignment.centerLeft,
), width: constraints.maxWidth,
], child: Text(joined, style: style, maxLines: 1)),
); ],
} ),
); );
},
),
],
);
});
} }
} }

View File

@@ -28,7 +28,8 @@ class MainScreen extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now(); final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider); final runtimeSchedule = ref.watch(runtimeScheduleProvider);
final schedule = runtimeSchedule.schedule;
final settings = ref.watch(settingsProvider); final settings = ref.watch(settingsProvider);
final screenData = ref.watch(screenStateProvider); final screenData = ref.watch(screenStateProvider);
final size = MediaQuery.of(context).size; final size = MediaQuery.of(context).size;
@@ -118,6 +119,8 @@ class MainScreen extends ConsumerWidget {
settings, settings,
dateGregorian, dateGregorian,
dateHijri, dateHijri,
showWaitingUpdateNotice:
runtimeSchedule.isFallbackFromPreviousDay,
inlineClockText: inlineClockText:
centerSlide.isPrimary ? null : '$timeStr$secStr', centerSlide.isPrimary ? null : '$timeStr$secStr',
), ),
@@ -166,7 +169,7 @@ class MainScreen extends ConsumerWidget {
Widget _buildHeader(BuildContext context, double s, double fs, Widget _buildHeader(BuildContext context, double s, double fs,
AppSettings settings, String dateGregorian, String dateHijri, AppSettings settings, String dateGregorian, String dateHijri,
{String? inlineClockText}) { {required bool showWaitingUpdateNotice, String? inlineClockText}) {
final hScale = settings.scaleTopHeader; final hScale = settings.scaleTopHeader;
final showInlineClock = final showInlineClock =
inlineClockText != null && inlineClockText.isNotEmpty; inlineClockText != null && inlineClockText.isNotEmpty;
@@ -252,6 +255,37 @@ class MainScreen extends ConsumerWidget {
), ),
), ),
if (showWaitingUpdateNotice)
Expanded(
flex: 2,
child: Align(
alignment: Alignment.centerRight,
child: Container(
margin: EdgeInsets.only(right: 16 * s),
padding: EdgeInsets.symmetric(
horizontal: 18 * s,
vertical: 9 * s,
),
decoration: BoxDecoration(
color: SacredColors.secondary.withValues(alpha: 0.2),
borderRadius: BorderRadius.circular(SacredRadii.full),
border: Border.all(
color: SacredColors.secondary.withValues(alpha: 0.7),
),
),
child: Text(
'Menunggu Update Data',
style: GoogleFonts.plusJakartaSans(
fontSize: 16 * s * hScale,
fontWeight: FontWeight.w700,
color: SacredColors.secondary,
letterSpacing: 0.3 * s,
),
),
),
),
),
// Right: Hijri date + mosque icon // Right: Hijri date + mosque icon
Expanded( Expanded(
flex: 3, flex: 3,

View File

@@ -13,15 +13,35 @@ import 'core/sacred_tokens.dart';
import 'data/local/models.dart'; import 'data/local/models.dart';
import 'features/home/home_view.dart'; import 'features/home/home_view.dart';
const String _duplicateKeyDownAssertion =
'A KeyDownEvent is dispatched, but the state shows that the physical key is already pressed.';
bool _isIgnorableKeyboardAssertion(Object error, [StackTrace? stack]) {
final text = error.toString();
if (!text.contains(_duplicateKeyDownAssertion)) return false;
final stackText = stack?.toString() ?? '';
return stackText.isEmpty || stackText.contains('hardware_keyboard.dart');
}
bool _isIgnorableFlutterAssertion(FlutterErrorDetails details) {
return _isIgnorableKeyboardAssertion(details.exception, details.stack);
}
void main() { void main() {
runZonedGuarded(() async { runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
FlutterError.onError = (details) { FlutterError.onError = (details) {
if (_isIgnorableFlutterAssertion(details)) {
return;
}
FlutterError.presentError(details); FlutterError.presentError(details);
debugPrint('[Fatal][FlutterError] ${details.exceptionAsString()}'); debugPrint('[Fatal][FlutterError] ${details.exceptionAsString()}');
}; };
PlatformDispatcher.instance.onError = (error, stack) { PlatformDispatcher.instance.onError = (error, stack) {
if (_isIgnorableKeyboardAssertion(error, stack)) {
return true;
}
debugPrint('[Fatal][PlatformDispatcher] $error'); debugPrint('[Fatal][PlatformDispatcher] $error');
debugPrintStack(stackTrace: stack); debugPrintStack(stackTrace: stack);
return true; return true;
@@ -104,8 +124,7 @@ Future<void> _sanitizeMediaSettings(Box<AppSettings> settingsBox) async {
? settings.brandedBgImage ? settings.brandedBgImage
: null; : null;
final needsSave = final needsSave = validSlides.length != settings.slideshowImages.length ||
validSlides.length != settings.slideshowImages.length ||
brandedBg != settings.brandedBgImage; brandedBg != settings.brandedBgImage;
if (!needsSave) return; if (!needsSave) return;

View File

@@ -29,8 +29,7 @@ class BackgroundRotateCommand {
action = BackgroundRotateAction.random; action = BackgroundRotateAction.random;
} }
final backgroundRotateCommandProvider = final backgroundRotateCommandProvider = StateProvider<BackgroundRotateCommand>(
StateProvider<BackgroundRotateCommand>(
(ref) => const BackgroundRotateCommand.initial(), (ref) => const BackgroundRotateCommand.initial(),
); );
@@ -101,6 +100,44 @@ final todayScheduleProvider = Provider<DailyPrayerSchedule?>((ref) {
return SyncService.instance.getTodaySchedule(clock); return SyncService.instance.getTodaySchedule(clock);
}); });
class RuntimeScheduleData {
final DailyPrayerSchedule? schedule;
final bool isFallbackFromPreviousDay;
const RuntimeScheduleData({
required this.schedule,
this.isFallbackFromPreviousDay = false,
});
const RuntimeScheduleData.empty()
: schedule = null,
isFallbackFromPreviousDay = false;
}
/// Runtime schedule used by main display/state machine.
/// If today's data is missing after midnight, we temporarily fallback to yesterday
/// so screen remains operational while showing a waiting-for-update notice.
final runtimeScheduleProvider = Provider<RuntimeScheduleData>((ref) {
final clock = ref.watch(clockProvider).valueOrNull;
if (clock == null) return const RuntimeScheduleData.empty();
final today = SyncService.instance.getTodaySchedule(clock);
if (today != null) {
return RuntimeScheduleData(schedule: today);
}
final previousDay = clock.subtract(const Duration(days: 1));
final fallback = SyncService.instance.getTodaySchedule(previousDay);
if (fallback != null) {
return RuntimeScheduleData(
schedule: fallback,
isFallbackFromPreviousDay: true,
);
}
return const RuntimeScheduleData.empty();
});
final scheduleCacheStatusProvider = Provider<ScheduleCacheStatus>((ref) { final scheduleCacheStatusProvider = Provider<ScheduleCacheStatus>((ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now(); final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
return SyncService.instance.getCacheStatus(clock); return SyncService.instance.getCacheStatus(clock);
@@ -149,7 +186,7 @@ class ScreenStateData {
final screenStateProvider = Provider<ScreenStateData>((ref) { final screenStateProvider = Provider<ScreenStateData>((ref) {
final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now(); final clock = ref.watch(clockProvider).valueOrNull ?? DateTime.now();
final schedule = ref.watch(todayScheduleProvider); final schedule = ref.watch(runtimeScheduleProvider).schedule;
final settings = ref.watch(settingsProvider); final settings = ref.watch(settingsProvider);
final isFriday = clock.weekday == DateTime.friday; final isFriday = clock.weekday == DateTime.friday;

View File

@@ -1,7 +1,7 @@
name: jamshalat_masjid_screen name: jamshalat_masjid_screen
description: Smart Digital Prayer Clock for Android TV Box description: Smart Digital Prayer Clock for Android TV Box
publish_to: 'none' publish_to: 'none'
version: 1.0.14+15 version: 1.0.15+16
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'