[fix]: Code clean up on screens
This commit is contained in:
@@ -268,9 +268,6 @@ class _AppDetailsScreenState extends State<AppDetailsScreen> {
|
||||
final availableRepos = app.availableRepositories;
|
||||
if (availableRepos == null || availableRepos.isEmpty) return;
|
||||
|
||||
// Capture the mounted context before showing dialog
|
||||
// final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||
|
||||
await showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (dialogContext) => Padding(
|
||||
@@ -1215,7 +1212,7 @@ class _DownloadSectionState extends State<_DownloadSection> {
|
||||
duration: Duration(milliseconds: 300),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
LinearProgressIndicator(value: progress, year2023: false)
|
||||
LinearProgressIndicator(value: progress)
|
||||
.animate()
|
||||
.fadeIn(duration: Duration(milliseconds: 300))
|
||||
.slideY(
|
||||
@@ -1508,7 +1505,7 @@ class _IzzyStatsLoadingCard extends StatelessWidget {
|
||||
child: Row(
|
||||
spacing: 12,
|
||||
children: [
|
||||
CircularProgressIndicator(year2023: false),
|
||||
CircularProgressIndicator(),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Loading IzzyOnDroid download stats...',
|
||||
@@ -1878,14 +1875,14 @@ class _AppDetailsIconState extends State<_AppDetailsIcon> {
|
||||
Widget build(BuildContext context) {
|
||||
if (_showFallback) {
|
||||
return Container(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
child: const Icon(Symbols.android, color: Colors.white, size: 40),
|
||||
);
|
||||
}
|
||||
|
||||
if (_index >= _candidates.length) {
|
||||
return Container(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
child: const Icon(Symbols.apps, color: Colors.white, size: 40),
|
||||
);
|
||||
}
|
||||
@@ -1898,7 +1895,7 @@ class _AppDetailsIconState extends State<_AppDetailsIcon> {
|
||||
// Move to next candidate or fallback
|
||||
_next();
|
||||
return Container(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
child: const Icon(
|
||||
Symbols.broken_image,
|
||||
color: Colors.white,
|
||||
@@ -1909,14 +1906,13 @@ class _AppDetailsIconState extends State<_AppDetailsIcon> {
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Container(
|
||||
color: Colors.white.withOpacity(0.2),
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
alignment: Alignment.center,
|
||||
child: const SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
year2023: false,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
|
||||
),
|
||||
),
|
||||
@@ -2160,7 +2156,7 @@ class _VersionDownloadButton extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
LinearProgressIndicator(value: progress, year2023: false),
|
||||
LinearProgressIndicator(value: progress),
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -2350,7 +2346,7 @@ class _ScreenshotsSectionState extends State<_ScreenshotsSection> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(year2023: false),
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 12),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
@@ -2475,7 +2471,6 @@ class _FullScreenScreenshotsState extends State<_FullScreenScreenshots> {
|
||||
if (loadingProgress == null) return child;
|
||||
return Center(
|
||||
child: CircularProgressIndicator(
|
||||
year2023: false,
|
||||
value: loadingProgress.expectedTotalBytes != null
|
||||
? loadingProgress.cumulativeBytesLoaded /
|
||||
loadingProgress.expectedTotalBytes!
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:florid/l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
@@ -62,7 +61,7 @@ class _CategoriesScreenState extends State<CategoriesScreen>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const CircularProgressIndicator(year2023: false),
|
||||
const CircularProgressIndicator(),
|
||||
const SizedBox(height: 16),
|
||||
Text(AppLocalizations.of(context)!.loading_categories),
|
||||
],
|
||||
|
||||
@@ -80,7 +80,7 @@ class _CategoryAppsScreenState extends State<CategoryAppsScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(year2023: false),
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text(AppLocalizations.of(context)!.loading_apps),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:florid/l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
@@ -110,7 +109,9 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
onPressed: _openRecentlyUpdatedScreen,
|
||||
iconAlignment: IconAlignment.end,
|
||||
icon: Icon(Symbols.arrow_forward),
|
||||
label: Text(AppLocalizations.of(context)!.show_more),
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.show_more,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -118,9 +119,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
if (isLoading && recentlyUpdatedApps.isEmpty)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 32.0),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(year2023: false),
|
||||
),
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
else if (recentlyUpdatedApps.isEmpty)
|
||||
Padding(
|
||||
@@ -188,7 +187,9 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
onPressed: _openLatestScreen,
|
||||
iconAlignment: IconAlignment.end,
|
||||
icon: Icon(Symbols.arrow_forward),
|
||||
label: Text(AppLocalizations.of(context)!.show_more),
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.show_more,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -196,9 +197,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
if (isLoading && latestApps.isEmpty)
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 32.0),
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(year2023: false),
|
||||
),
|
||||
child: Center(child: CircularProgressIndicator()),
|
||||
)
|
||||
else if (latestApps.isEmpty)
|
||||
Padding(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:florid/l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
@@ -65,7 +64,7 @@ class _LatestScreenState extends State<LatestScreen>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(year2023: false),
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text(AppLocalizations.of(context)!.loading_latest_apps),
|
||||
],
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:florid/l10n/app_localizations.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_animate/flutter_animate.dart';
|
||||
@@ -230,7 +229,10 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('${AppLocalizations.of(context)!.setup_failed}: $e'),
|
||||
action: SnackBarAction(label: AppLocalizations.of(context)!.retry, onPressed: _performSetup),
|
||||
action: SnackBarAction(
|
||||
label: AppLocalizations.of(context)!.retry,
|
||||
onPressed: _performSetup,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -592,7 +594,7 @@ class _PermissionCard extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
color: isGranted
|
||||
? colorScheme.primaryContainer.withOpacity(0.5)
|
||||
? colorScheme.primaryContainer.withValues(alpha: 0.5)
|
||||
: colorScheme.surfaceContainer,
|
||||
border: Border.all(
|
||||
color: isGranted ? colorScheme.primary : colorScheme.outlineVariant,
|
||||
@@ -607,7 +609,7 @@ class _PermissionCard extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: isGranted
|
||||
? colorScheme.primary.withOpacity(0.2)
|
||||
? colorScheme.primary.withValues(alpha: 0.2)
|
||||
: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
@@ -695,7 +697,6 @@ class _ProgressStep extends StatelessWidget {
|
||||
child: LinearProgressIndicator(
|
||||
value: progress,
|
||||
minHeight: 8,
|
||||
year2023: false,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -65,7 +65,7 @@ class _RecentlyUpdatedScreenState extends State<RecentlyUpdatedScreen>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(year2023: false),
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text('Loading recently updated apps...'),
|
||||
],
|
||||
|
||||
@@ -207,7 +207,7 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(year2023: false),
|
||||
CircularProgressIndicator(),
|
||||
SizedBox(height: 16),
|
||||
Text(AppLocalizations.of(context)!.searching),
|
||||
],
|
||||
|
||||
@@ -262,7 +262,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
leading: Icon(Symbols.delete_sweep),
|
||||
title: 'Clear APK downloads',
|
||||
onTap: () {
|
||||
_clearRepoCache(context);
|
||||
_clearApkDownloads(context);
|
||||
},
|
||||
subtitle:
|
||||
'Remove downloaded installer files from storage',
|
||||
@@ -271,7 +271,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
leading: Icon(Symbols.image_not_supported),
|
||||
title: 'Clear image cache',
|
||||
onTap: () {
|
||||
_clearRepoCache(context);
|
||||
_clearImageCache(context);
|
||||
},
|
||||
subtitle: 'Remove cached icons and screenshots',
|
||||
),
|
||||
@@ -403,21 +403,3 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SectionHeader extends StatelessWidget {
|
||||
final String label;
|
||||
const _SectionHeader({required this.label});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 8, 16, 4),
|
||||
child: Text(
|
||||
label,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user