Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[mob][photos] Refresh pending sync storage rows

Amanbc9b3a30b0e5
diff --git a/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart b/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
index eb8f3d4abf..3caccd8b1f 100644
--- a/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
+++ b/mobile/apps/photos/lib/ui/settings/pending_sync/path_info_storage_viewer.dart
@@ -1,13 +1,11 @@
import 'dart:io';
+import 'package:ente_components/ente_components.dart';
import 'package:ente_pure_utils/ente_pure_utils.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:logging/logging.dart';
-import 'package:photos/theme/ente_theme.dart';
-import 'package:photos/ui/components/captioned_text_widget.dart';
-import 'package:photos/ui/components/menu_item_widget/menu_item_widget.dart';
class PathInfoStorageItem {
final String path;
@@ -25,14 +23,10 @@ class PathInfoStorageItem {
class PathInfoStorageViewer extends StatefulWidget {
final PathInfoStorageItem item;
- final bool removeTopRadius;
- final bool removeBottomRadius;
final bool enableDoubleTapClear;
const PathInfoStorageViewer(
this.item, {
- this.removeTopRadius = false,
- this.removeBottomRadius = false,
this.enableDoubleTapClear = false,
super.key,
});
@@ -79,38 +73,28 @@ class _PathInfoStorageViewerState extends State<PathInfoStorageViewer> {
}
Widget _buildMenuItemWidget(DirectoryStat? stat, Object? err) {
- return MenuItemWidget(
+ final colors = context.componentColors;
+ return MenuComponent(
key: UniqueKey(),
- alignCaptionedTextToLeft: true,
- captionedTextWidget: CaptionedTextWidget(
- title: widget.item.title,
- subTitle: stat != null ? '${stat.fileCount}' : null,
- subTitleColor: getEnteColorScheme(context).textFaint,
- ),
- trailingWidget: stat != null
+ title: widget.item.title,
+ subtitle: stat != null ? '${stat.fileCount}' : null,
+ trailing: err != null
+ ? Icon(Icons.error_outline_outlined, color: colors.textLight)
+ : stat != null
? Padding(
padding: const EdgeInsets.only(left: 12.0),
child: Text(
formatBytes(stat.size),
- style: getEnteTextTheme(
- context,
- ).small.copyWith(color: getEnteColorScheme(context).textFaint),
+ style: TextStyles.mini.copyWith(color: colors.textLight),
),
)
: SizedBox.fromSize(
size: const Size.square(14),
child: CircularProgressIndicator(
strokeWidth: 2,
- color: getEnteColorScheme(context).strokeMuted,
+ color: colors.strokeFaint,
),
),
- trailingIcon: err != null ? Icons.error_outline_outlined : null,
- trailingIconIsMuted: err != null,
- singleBorderRadius: 8,
- menuItemColor: getEnteColorScheme(context).fillFaint,
- isBottomBorderRadiusRemoved: widget.removeBottomRadius,
- isTopBorderRadiusRemoved: widget.removeTopRadius,
- showOnlyLoadingState: true,
onTap: () async {
if (kDebugMode) {
await Clipboard.setData(ClipboardData(text: widget.item.path));
diff --git a/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart b/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
index 0ca1720219..00ea94370a 100644
--- a/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
+++ b/mobile/apps/photos/lib/ui/settings/pending_sync/pending_sync_info_screen.dart
@@ -1,3 +1,4 @@
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:photos/core/configuration.dart";
import "package:photos/generated/l10n.dart";
@@ -136,22 +137,19 @@ class _PendingSyncInfoScreenState extends State<PendingSyncInfoScreen> {
MenuSectionTitle(
title: AppLocalizations.of(context).cachedData,
),
- ListView.builder(
- shrinkWrap: true,
- padding: const EdgeInsets.all(0),
- physics: const ScrollPhysics(),
- // to disable GridView's scrolling
- itemBuilder: (context, index) {
- final path = paths[index];
- return PathInfoStorageViewer(
- path,
- removeTopRadius: index > 0,
- removeBottomRadius: index < paths.length - 1,
- enableDoubleTapClear: internalUser,
- key: ValueKey("$index-$_refreshCounterKey"),
- );
- },
- itemCount: paths.length,
+ MenuGroupComponent(
+ items: [
+ for (
+ var pathIndex = 0;
+ pathIndex < paths.length;
+ pathIndex++
+ )
+ PathInfoStorageViewer(
+ paths[pathIndex],
+ enableDoubleTapClear: internalUser,
+ key: ValueKey("$pathIndex-$_refreshCounterKey"),
+ ),
+ ],
),
const SizedBox(height: 24),
],