π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Add a generic empty state widget
AmanRajSinghMouryaa2760907a144
diff --git a/mobile/apps/locker/lib/ui/components/empty_state_widget.dart b/mobile/apps/locker/lib/ui/components/empty_state_widget.dartnew file mode 100644index 0000000000..6632a9262a--- /dev/null+++ b/mobile/apps/locker/lib/ui/components/empty_state_widget.dart@@ -0,0 +1,91 @@+import "package:dotted_border/dotted_border.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";++class EmptyStateWidget extends StatelessWidget {+ const EmptyStateWidget({+ super.key,+ required this.assetPath,+ required this.title,+ this.subtitle,+ this.onTap,+ this.showBorder = true,+ this.illustrationHeight,+ this.horizontalPadding = 24,+ this.verticalPadding = 42,+ this.spacing = 12,+ });++ final String assetPath;+ final String title;+ final String? subtitle;+ final VoidCallback? onTap;+ final bool showBorder;+ final double? illustrationHeight;+ final double horizontalPadding;+ final double verticalPadding;+ final double spacing;++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);++ final content = GestureDetector(+ onTap: onTap,+ child: Container(+ width: double.infinity,+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ borderRadius: BorderRadius.circular(24),+ ),+ padding: EdgeInsets.symmetric(+ horizontal: horizontalPadding,+ vertical: verticalPadding,+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.center,+ children: [+ if (assetPath.isNotEmpty)+ Image.asset(+ assetPath,+ height: illustrationHeight,+ ),+ if (assetPath.isNotEmpty) SizedBox(height: spacing),+ Text(+ title,+ style: textTheme.h3Bold.copyWith(+ color: colorScheme.textBase,+ ),+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 12),+ if (subtitle != null && subtitle!.isNotEmpty)+ Text(+ subtitle!,+ style: textTheme.small.copyWith(+ color: colorScheme.textMuted,+ ),+ textAlign: TextAlign.center,+ ),+ ],+ ),+ ),+ );++ if (!showBorder) {+ return content;+ }++ return DottedBorder(+ options: const RoundedRectDottedBorderOptions(+ strokeWidth: 1,+ color: Color.fromRGBO(82, 82, 82, 0.6),+ dashPattern: [5, 5],+ radius: Radius.circular(24),+ ),+ child: content,+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/collection_page.dart b/mobile/apps/locker/lib/ui/pages/collection_page.dartindex 64c77d0d3c..ba7e958407 100644--- a/mobile/apps/locker/lib/ui/pages/collection_page.dart+++ b/mobile/apps/locker/lib/ui/pages/collection_page.dart@@ -16,6 +16,7 @@ import 'package:locker/services/collections/models/collection.dart';import "package:locker/services/collections/models/collection_view_type.dart";import "package:locker/services/configuration.dart";import 'package:locker/services/files/sync/models/file.dart';+import "package:locker/ui/components/empty_state_widget.dart";import 'package:locker/ui/components/item_list_view.dart';import "package:locker/ui/components/menu_item_widget.dart";import 'package:locker/ui/components/search_result_view.dart';@@ -402,9 +403,14 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>SingleChildScrollView(padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16),child: _displayedFiles.isEmpty- ? SizedBox(- height: 400,- child: _buildEmptyState(textTheme),+ ? const Center(+ child: EmptyStateWidget(+ assetPath: 'assets/empty_state.png',+ title: "Nothing to see here",+ subtitle:+ "Upload files to this collection to see them here",+ showBorder: false,+ ),): ItemListView(key: ValueKey(_displayedFiles.length),@@ -416,44 +422,6 @@ class _CollectionPageState extends UploaderPageState<CollectionPage>);}- Widget _buildEmptyState(EnteTextTheme textTheme) {- return Padding(- padding: const EdgeInsets.all(32.0),- child: Center(- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Icon(- isSearchActive ? Icons.search_off : Icons.folder_off,- size: 64,- color: Colors.grey,- ),- const SizedBox(height: 16),- Text(- isSearchActive- ? context.l10n.noFilesFoundForQuery(searchQuery)- : context.l10n.noFilesFound,- style: textTheme.large.copyWith(- color: Colors.grey,- ),- textAlign: TextAlign.center,- ),- if (isSearchActive) ...[- const SizedBox(height: 8),- Text(- context.l10n.tryAdjustingYourSearchQuery,- style: textTheme.body.copyWith(- color: Colors.grey[600],- ),- textAlign: TextAlign.center,- ),- ],- ],- ),- ),- );- }-void _searchEverywhere() {Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(