fix(about): show update action only when update is available

This commit is contained in:
dwindown
2026-04-02 07:06:03 +07:00
parent 440be7c2d5
commit 14c3850092
2 changed files with 37 additions and 28 deletions

View File

@@ -408,6 +408,11 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
_currentVersion = result.current; _currentVersion = result.current;
_updateCheckResult = result; _updateCheckResult = result;
}); });
if (!result.updateAvailable &&
_selectedTab == 5 &&
_tentangFocusNodes[1].hasFocus) {
_focusTentangRow(0);
}
_showStatusBadge( _showStatusBadge(
result.hasError result.hasError
? result.errorMessage! ? result.errorMessage!
@@ -1141,7 +1146,7 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
void _focusTentangRow(int index) { void _focusTentangRow(int index) {
if (_selectedTab != 5) return; if (_selectedTab != 5) return;
if (index < 0 || index >= _tentangFocusNodes.length) return; if (index < 0 || index >= _tentangRowCount()) return;
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) { if (mounted) {
_tentangFocusNodes[index].requestFocus(); _tentangFocusNodes[index].requestFocus();
@@ -1149,6 +1154,10 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
}); });
} }
int _tentangRowCount() {
return (_updateCheckResult?.updateAvailable ?? false) ? 2 : 1;
}
void _focusJadwalRow(int index) { void _focusJadwalRow(int index) {
if (_selectedTab != 1) return; if (_selectedTab != 1) return;
if (index < 0 || index >= _jadwalFocusNodes.length) return; if (index < 0 || index >= _jadwalFocusNodes.length) return;
@@ -3960,6 +3969,7 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
: 'CEK UPDATE', : 'CEK UPDATE',
), ),
), ),
if (updateResult?.updateAvailable ?? false) ...[
SizedBox(height: 16 * s), SizedBox(height: 16 * s),
_buildTentangActionButton( _buildTentangActionButton(
rowIndex: 1, rowIndex: 1,
@@ -3987,12 +3997,11 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
), ),
label: _isInstallingUpdate label: _isInstallingUpdate
? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%' ? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%'
: (updateResult?.updateAvailable ?? false) : 'UPDATE SEKARANG',
? 'UPDATE SEKARANG'
: 'BELUM ADA UPDATE',
), ),
), ),
], ],
],
), ),
), ),
], ],

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.3+4 version: 1.0.4+5
environment: environment:
sdk: '>=3.0.0 <4.0.0' sdk: '>=3.0.0 <4.0.0'