Skip to content

armgit / ente

Public Imported from GitHub
0

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

[locker] Show syncing state in home empty banner

AmanRajSinghMouryadc0866e83a16
diff --git a/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart b/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
index 382843faf4..2f336d313a 100644
--- a/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/home_empty_state_widget.dart
@@ -6,12 +6,18 @@ import 'package:locker/l10n/l10n.dart';
class HomeEmptyStateWidget extends StatelessWidget {
const HomeEmptyStateWidget({
super.key,
+ this.isSyncing = false,
});
+ final bool isSyncing;
+
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
final textTheme = getEnteTextTheme(context);
+ final title =
+ isSyncing ? context.l10n.syncing : context.l10n.homeLockerEmptyTitle;
+ final subtitle = isSyncing ? null : context.l10n.homeLockerEmptySubtitle;
return DottedBorder(
options: RoundedRectDottedBorderOptions(
strokeWidth: 1,
@@ -33,24 +39,34 @@ class HomeEmptyStateWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Image.asset(
- 'assets/upload_file.png',
- ),
+ isSyncing
+ ? SizedBox(
+ width: 32,
+ height: 32,
+ child: CircularProgressIndicator(
+ strokeWidth: 3,
+ color: colorScheme.primary700,
+ ),
+ )
+ : Image.asset(
+ 'assets/upload_file.png',
+ ),
const SizedBox(height: 12),
Text(
- context.l10n.homeLockerEmptyTitle,
+ title,
style: textTheme.h3Bold.copyWith(
color: colorScheme.textBase,
),
),
- const SizedBox(height: 8),
- Text(
- context.l10n.homeLockerEmptySubtitle,
- style: textTheme.small.copyWith(
- color: colorScheme.primary700,
- decoration: TextDecoration.none,
+ if (subtitle != null) const SizedBox(height: 8),
+ if (subtitle != null)
+ Text(
+ subtitle,
+ style: textTheme.small.copyWith(
+ color: colorScheme.primary700,
+ decoration: TextDecoration.none,
+ ),
),
- ),
],
),
),
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index b87c212931..aa45ac4f0a 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -218,6 +218,7 @@ class _HomePageState extends UploaderPageState<HomePage>
bool _isLoading = true;
bool _hasCompletedInitialLoad = false;
bool _isSettingsOpen = false;
+ bool get _isSyncing => !_hasCompletedInitialLoad || _isLoading;
List<Collection> _collections = [];
List<Collection> _filteredCollections = [];
@@ -642,7 +643,7 @@ class _HomePageState extends UploaderPageState<HomePage>
appBar: CustomLockerAppBar(
scaffoldKey: scaffoldKey,
isSearchActive: isSearchActive,
- isSyncing: !_hasCompletedInitialLoad || _isLoading,
+ isSyncing: _isSyncing,
searchController: searchController,
searchFocusNode: _searchFocusNode,
onSearchFocused: _handleSearchFocused,
@@ -732,10 +733,10 @@ class _HomePageState extends UploaderPageState<HomePage>
);
}
if (_displayedCollections.isEmpty) {
- return const Center(
+ return Center(
child: Padding(
- padding: EdgeInsets.all(16.0),
- child: HomeEmptyStateWidget(),
+ padding: const EdgeInsets.all(16.0),
+ child: HomeEmptyStateWidget(isSyncing: _isSyncing),
),
);
}
@@ -745,10 +746,10 @@ class _HomePageState extends UploaderPageState<HomePage>
final scrollBottomPadding = MediaQuery.of(context).padding.bottom + 120;
return _recentFiles.isEmpty
- ? const Center(
+ ? Center(
child: Padding(
- padding: EdgeInsets.symmetric(horizontal: 16.0),
- child: HomeEmptyStateWidget(),
+ padding: const EdgeInsets.symmetric(horizontal: 16.0),
+ child: HomeEmptyStateWidget(isSyncing: _isSyncing),
),
)
: SingleChildScrollView(