fix(about): show update action only when update is available
This commit is contained in:
@@ -408,6 +408,11 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
|
||||
_currentVersion = result.current;
|
||||
_updateCheckResult = result;
|
||||
});
|
||||
if (!result.updateAvailable &&
|
||||
_selectedTab == 5 &&
|
||||
_tentangFocusNodes[1].hasFocus) {
|
||||
_focusTentangRow(0);
|
||||
}
|
||||
_showStatusBadge(
|
||||
result.hasError
|
||||
? result.errorMessage!
|
||||
@@ -1141,7 +1146,7 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
|
||||
|
||||
void _focusTentangRow(int index) {
|
||||
if (_selectedTab != 5) return;
|
||||
if (index < 0 || index >= _tentangFocusNodes.length) return;
|
||||
if (index < 0 || index >= _tentangRowCount()) return;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
if (mounted) {
|
||||
_tentangFocusNodes[index].requestFocus();
|
||||
@@ -1149,6 +1154,10 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
|
||||
});
|
||||
}
|
||||
|
||||
int _tentangRowCount() {
|
||||
return (_updateCheckResult?.updateAvailable ?? false) ? 2 : 1;
|
||||
}
|
||||
|
||||
void _focusJadwalRow(int index) {
|
||||
if (_selectedTab != 1) return;
|
||||
if (index < 0 || index >= _jadwalFocusNodes.length) return;
|
||||
@@ -3960,38 +3969,38 @@ class _AdminScreenState extends ConsumerState<AdminScreen> {
|
||||
: 'CEK UPDATE',
|
||||
),
|
||||
),
|
||||
SizedBox(height: 16 * s),
|
||||
_buildTentangActionButton(
|
||||
rowIndex: 1,
|
||||
s: s,
|
||||
onActivate: _installLatestUpdate,
|
||||
builder: (isFocused) => _buildTvPrimaryActionSurface(
|
||||
if (updateResult?.updateAvailable ?? false) ...[
|
||||
SizedBox(height: 16 * s),
|
||||
_buildTentangActionButton(
|
||||
rowIndex: 1,
|
||||
s: s,
|
||||
isFocused: isFocused,
|
||||
icon: _isInstallingUpdate
|
||||
? SizedBox(
|
||||
width: 24 * s,
|
||||
height: 24 * s,
|
||||
child: CircularProgressIndicator(
|
||||
onActivate: _installLatestUpdate,
|
||||
builder: (isFocused) => _buildTvPrimaryActionSurface(
|
||||
s: s,
|
||||
isFocused: isFocused,
|
||||
icon: _isInstallingUpdate
|
||||
? SizedBox(
|
||||
width: 24 * s,
|
||||
height: 24 * s,
|
||||
child: CircularProgressIndicator(
|
||||
color: isFocused
|
||||
? SacredColors.onPrimary
|
||||
: SacredColors.onSecondary,
|
||||
strokeWidth: 3,
|
||||
),
|
||||
)
|
||||
: HugeIcon(
|
||||
icon: HugeIcons.strokeRoundedArrowDown01,
|
||||
color: isFocused
|
||||
? SacredColors.onPrimary
|
||||
: SacredColors.onSecondary,
|
||||
strokeWidth: 3,
|
||||
),
|
||||
)
|
||||
: HugeIcon(
|
||||
icon: HugeIcons.strokeRoundedArrowDown01,
|
||||
color: isFocused
|
||||
? SacredColors.onPrimary
|
||||
: SacredColors.onSecondary,
|
||||
),
|
||||
label: _isInstallingUpdate
|
||||
? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%'
|
||||
: (updateResult?.updateAvailable ?? false)
|
||||
? 'UPDATE SEKARANG'
|
||||
: 'BELUM ADA UPDATE',
|
||||
label: _isInstallingUpdate
|
||||
? 'MENGUNDUH UPDATE ${(100 * _updateDownloadProgress).toStringAsFixed(0)}%'
|
||||
: 'UPDATE SEKARANG',
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
name: jamshalat_masjid_screen
|
||||
description: Smart Digital Prayer Clock for Android TV Box
|
||||
publish_to: 'none'
|
||||
version: 1.0.3+4
|
||||
version: 1.0.4+5
|
||||
|
||||
environment:
|
||||
sdk: '>=3.0.0 <4.0.0'
|
||||
|
||||
Reference in New Issue
Block a user