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,38 +3969,38 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
: 'CEK UPDATE', : 'CEK UPDATE',
), ),
), ),
SizedBox(height: 16 * s), if (updateResult?.updateAvailable ?? false) ...[
_buildTentangActionButton( SizedBox(height: 16 * s),
rowIndex: 1, _buildTentangActionButton(
s: s, rowIndex: 1,
onActivate: _installLatestUpdate,
builder: (isFocused) => _buildTvPrimaryActionSurface(
s: s, s: s,
isFocused: isFocused, onActivate: _installLatestUpdate,
icon: _isInstallingUpdate builder: (isFocused) => _buildTvPrimaryActionSurface(
? SizedBox( s: s,
width: 24 * s, isFocused: isFocused,
height: 24 * s, icon: _isInstallingUpdate
child: CircularProgressIndicator( ? SizedBox(
width: 24 * s,
height: 24 * s,
child: CircularProgressIndicator(
color: isFocused
? SacredColors.onPrimary
: SacredColors.onSecondary,
strokeWidth: 3,
),
)
: HugeIcon(
icon: HugeIcons.strokeRoundedArrowDown01,
color: isFocused color: isFocused
? SacredColors.onPrimary ? SacredColors.onPrimary
: SacredColors.onSecondary, : SacredColors.onSecondary,
strokeWidth: 3,
), ),
) label: _isInstallingUpdate
: HugeIcon( ? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%'
icon: HugeIcons.strokeRoundedArrowDown01, : 'UPDATE SEKARANG',
color: isFocused ),
? SacredColors.onPrimary
: SacredColors.onSecondary,
),
label: _isInstallingUpdate
? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%'
: (updateResult?.updateAvailable ?? false)
? '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'