π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simpler flow
vishnukvmd46601a29b8e3
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex f8a828fb7f..9bf479fef9 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -352,6 +352,9 @@"reddit": "Reddit","information": "Information","saveInformation": "Save information",+ "saveToLocker": "Save to Locker",+ "saveDocumentTitle": "Document",+ "saveDocumentDescription": "Upload documents securely to keep everything in one place.","informationDescription": "Save important information that can be shared and passed down to loved ones.","personalNote": "Personal note","personalNoteDescription": "Store essential notes or reflections securely.",diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex 2774a96234..a0ef3cf787 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -1030,6 +1030,24 @@ abstract class AppLocalizations {/// **'Save information'**String get saveInformation;+ /// No description provided for @saveToLocker.+ ///+ /// In en, this message translates to:+ /// **'Save to Locker'**+ String get saveToLocker;++ /// No description provided for @saveDocumentTitle.+ ///+ /// In en, this message translates to:+ /// **'Document'**+ String get saveDocumentTitle;++ /// No description provided for @saveDocumentDescription.+ ///+ /// In en, this message translates to:+ /// **'Upload documents securely to keep everything in one place.'**+ String get saveDocumentDescription;+/// No description provided for @informationDescription.////// In en, this message translates to:@@ -2191,7 +2209,7 @@ abstract class AppLocalizations {/// No description provided for @incorrectPassword.////// In en, this message translates to:- /// **'Incorrect Password'**+ /// **'Incorrect password'**String get incorrectPassword;/// No description provided for @pleaseTryAgain.@@ -2203,7 +2221,7 @@ abstract class AppLocalizations {/// No description provided for @noInternetConnection.////// In en, this message translates to:- /// **'No Internet Connection'**+ /// **'No internet connection'**String get noInternetConnection;/// No description provided for @checkInternetConnection.@@ -2239,7 +2257,7 @@ abstract class AppLocalizations {/// No description provided for @invalidEmail.////// In en, this message translates to:- /// **'Invalid Email'**+ /// **'Invalid email'**String get invalidEmail;/// No description provided for @enterValidEmailFirst.@@ -2251,7 +2269,7 @@ abstract class AppLocalizations {/// No description provided for @lockerLoginIssueSubject.////// In en, this message translates to:- /// **'Locker Login Issue'**+ /// **'Locker login issue'**String get lockerLoginIssueSubject;/// No description provided for @unnamed.diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex 116371f334..cee8fc1be5 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -541,6 +541,16 @@ class AppLocalizationsEn extends AppLocalizations {@overrideString get saveInformation => 'Save information';+ @override+ String get saveToLocker => 'Save to Locker';++ @override+ String get saveDocumentTitle => 'Document';++ @override+ String get saveDocumentDescription =>+ 'Upload documents securely to keep everything in one place.';+@overrideString get informationDescription =>'Save important information that can be shared and passed down to loved ones.';@@ -1254,13 +1264,13 @@ class AppLocalizationsEn extends AppLocalizations {String get signUp => 'Sign up';@override- String get incorrectPassword => 'Incorrect Password';+ String get incorrectPassword => 'Incorrect password';@overrideString get pleaseTryAgain => 'Please try again';@override- String get noInternetConnection => 'No Internet Connection';+ String get noInternetConnection => 'No internet connection';@overrideString get checkInternetConnection =>@@ -1281,13 +1291,13 @@ class AppLocalizationsEn extends AppLocalizations {String get useRecoveryKey => 'Use recovery key';@override- String get invalidEmail => 'Invalid Email';+ String get invalidEmail => 'Invalid email';@overrideString get enterValidEmailFirst => 'Please enter a valid email address first';@override- String get lockerLoginIssueSubject => 'Locker Login Issue';+ String get lockerLoginIssueSubject => 'Locker login issue';@overrideString get unnamed => 'Unnamed';diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dartindex 35f3f5b560..a0e5b20f80 100644--- a/mobile/apps/locker/lib/ui/pages/home_page.dart+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart@@ -21,12 +21,11 @@ import 'package:locker/services/files/sync/models/file.dart';import "package:locker/ui/collections/collection_flex_grid_view.dart";import "package:locker/ui/collections/section_title.dart";import "package:locker/ui/components/home_empty_state_widget.dart";-import "package:locker/ui/components/menu_item_widget.dart";import 'package:locker/ui/components/recents_section_widget.dart';import 'package:locker/ui/components/search_result_view.dart';import 'package:locker/ui/mixins/search_mixin.dart';import 'package:locker/ui/pages/all_collections_page.dart';-import 'package:locker/ui/pages/information_page.dart';+import 'package:locker/ui/pages/save_page.dart';import "package:locker/ui/pages/settings_page.dart";import 'package:locker/ui/pages/uploader_page.dart';import 'package:locker/utils/collection_sort_util.dart';@@ -278,27 +277,10 @@ class _HomePageState extends UploaderPageState<HomePage>return _filterOutUncategorized(collections);}- final ValueNotifier<bool> _isFabOpen = ValueNotifier<bool>(false);- late AnimationController _animationController;- late Animation<double> _animation;-@overridevoid initState() {super.initState();_selectedCollections = SelectedCollections();- _animationController = AnimationController(- duration: const Duration(milliseconds: 300),- vsync: this,- );- _animation = Tween<double>(- begin: 0.0,- end: 1.0,- ).animate(- CurvedAnimation(- parent: _animationController,- curve: Curves.easeInOut,- ),- );_loadCollections();@@ -346,8 +328,6 @@ class _HomePageState extends UploaderPageState<HomePage>@overridevoid dispose() {- _animationController.dispose();- _isFabOpen.dispose();_searchFocusNode.dispose();disposeSharing();super.dispose();@@ -591,8 +571,17 @@ class _HomePageState extends UploaderPageState<HomePage>onSearchChanged: _handleSearchChange,),body: _buildBody(),- floatingActionButton:- isSearchActive ? const SizedBox.shrink() : _buildMultiOptionFab(),+ floatingActionButton: isSearchActive+ ? null+ : FloatingActionButton(+ onPressed: _openSavePage,+ shape: const CircleBorder(),+ backgroundColor: colorScheme.primary700,+ child: const HugeIcon(+ icon: HugeIcons.strokeRoundedPlusSign,+ color: Colors.white,+ ),+ ),),),);@@ -716,122 +705,6 @@ class _HomePageState extends UploaderPageState<HomePage>);}- Widget _buildMultiOptionFab() {- return ValueListenableBuilder<bool>(- valueListenable: _isFabOpen,- builder: (context, isFabOpen, child) {- final colorScheme = getEnteColorScheme(context);-- return Stack(- children: [- if (isFabOpen)- Positioned.fill(- child: GestureDetector(- onTap: _toggleFab,- child: Container(- color: Colors.transparent,- ),- ),- ),- Positioned(- right: 64,- bottom: 64,- child: SlideTransition(- position: Tween<Offset>(- begin: const Offset(0, 1),- end: Offset.zero,- ).animate(- CurvedAnimation(- parent: _animationController,- curve: Curves.easeOutCubic,- ),- ),- child: FadeTransition(- opacity: _animation,- child: Container(- width: 200,- decoration: BoxDecoration(- color: colorScheme.backdropBase,- borderRadius: BorderRadius.circular(16),- border: Border.all(color: colorScheme.strokeFaint),- boxShadow: [- BoxShadow(- color: Colors.black.withValues(alpha: 0.08),- blurRadius: 15,- offset: const Offset(0, 4),- ),- ],- ),- child: Column(- mainAxisSize: MainAxisSize.min,- children: [- MenuItemWidget(- label: context.l10n.saveInformation,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedFile01,- color: colorScheme.primary700,- size: 20,- ),- isFirst: true,- isLast: false,- onTap: () {- _toggleFab();- _showInformationDialog();- },- ),- MenuItemWidget(- label: context.l10n.saveDocument,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedFileUpload,- color: colorScheme.primary700,- size: 20,- ),- isFirst: false,- isLast: true,- onTap: () {- _toggleFab();- addFile();- },- ),- ],- ),- ),- ),- ),- ),- Positioned(- right: 16,- bottom: 16,- child: FloatingActionButton(- onPressed: _toggleFab,- shape: const CircleBorder(),- backgroundColor: colorScheme.primary700,- child: AnimatedRotation(- turns: isFabOpen ? 0.125 : 0.0, // 45 degrees when open- duration: const Duration(milliseconds: 300),- child: const HugeIcon(- icon: HugeIcons.strokeRoundedPlusSign,- color: Colors.white,- ),- ),- ),- ),- ],- );- },- );- }-- void _toggleFab() {- _isFabOpen.value = !_isFabOpen.value;-- if (_isFabOpen.value) {- _animationController.forward();- } else {- _animationController.reverse();- }- }-List<Widget> _buildCollectionSection({required String title,required List<Collection> collections,@@ -866,11 +739,10 @@ class _HomePageState extends UploaderPageState<HomePage>];}- void _showInformationDialog() {- Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => const InformationPage(),- ),+ void _openSavePage() {+ showSaveBottomSheet(+ context,+ onUploadDocument: addFile,);}}diff --git a/mobile/apps/locker/lib/ui/pages/information_page.dart b/mobile/apps/locker/lib/ui/pages/information_page.dartdeleted file mode 100644index 09c4f38dfe..0000000000--- a/mobile/apps/locker/lib/ui/pages/information_page.dart+++ /dev/null@@ -1,201 +0,0 @@-import "package:ente_ui/components/title_bar_title_widget.dart";-import "package:ente_ui/theme/colors.dart";-import 'package:ente_ui/theme/ente_theme.dart';-import "package:ente_ui/theme/text_style.dart";-import 'package:flutter/material.dart';-import 'package:hugeicons/hugeicons.dart';-import 'package:locker/l10n/l10n.dart';-import 'package:locker/ui/pages/account_credentials_page.dart';-import 'package:locker/ui/pages/emergency_contact_page.dart';-import 'package:locker/ui/pages/personal_note_page.dart';-import 'package:locker/ui/pages/physical_records_page.dart';--enum InformationType {- note,- physicalRecord,- credentials,- emergencyContact,-}--class InformationPage extends StatelessWidget {- const InformationPage({super.key});-- @override- Widget build(BuildContext context) {- final colorScheme = getEnteColorScheme(context);- final textTheme = getEnteTextTheme(context);-- return Scaffold(- appBar: AppBar(- backgroundColor: colorScheme.backgroundBase,- surfaceTintColor: Colors.transparent,- toolbarHeight: 48,- leadingWidth: 48,- leading: GestureDetector(- onTap: () {- Navigator.pop(context);- },- child: const Icon(- Icons.arrow_back_outlined,- ),- ),- ),- backgroundColor: colorScheme.backgroundBase,- body: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 16),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const TitleBarTitleWidget(- title: "Save Information",- ),- const SizedBox(height: 8),- Text(- "Save important information that can be shared and passed down to loved ones.",- style: textTheme.smallMuted,- ),- ],- ),- ),- SingleChildScrollView(- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),- child: Column(- children: [- _buildInformationOption(- context,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedPencilEdit02,- size: 24,- color: colorScheme.primary700,- ),- title: context.l10n.personalNote,- description: context.l10n.personalNoteDescription,- type: InformationType.note,- colorScheme: colorScheme,- textTheme: textTheme,- ),- const SizedBox(height: 16),- _buildInformationOption(- context,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedFolder02,- size: 24,- color: colorScheme.primary700,- ),- title: context.l10n.physicalRecords,- description: context.l10n.physicalRecordsDescription,- type: InformationType.physicalRecord,- colorScheme: colorScheme,- textTheme: textTheme,- ),- const SizedBox(height: 16),- _buildInformationOption(- context,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedUserEdit01,- size: 24,- color: colorScheme.primary700,- ),- title: context.l10n.accountCredentials,- description: context.l10n.accountCredentialsDescription,- type: InformationType.credentials,- colorScheme: colorScheme,- textTheme: textTheme,- ),- const SizedBox(height: 16),- _buildInformationOption(- context,- icon: HugeIcon(- icon: HugeIcons.strokeRoundedContactBook,- size: 24,- color: colorScheme.primary700,- ),- title: context.l10n.emergencyContact,- description: context.l10n.emergencyContactDescription,- type: InformationType.emergencyContact,- colorScheme: colorScheme,- textTheme: textTheme,- ),- const SizedBox(height: 32),- ],- ),- ),- ],- ),- );- }-- Widget _buildInformationOption(- BuildContext context, {- required HugeIcon icon,- required String title,- required String description,- required InformationType type,- required EnteColorScheme colorScheme,- required EnteTextTheme textTheme,- }) {- return GestureDetector(- onTap: () {- _showInformationForm(context, type);- },- child: Container(- padding: const EdgeInsets.all(16),- decoration: BoxDecoration(- borderRadius: BorderRadius.circular(20),- color: colorScheme.backdropBase,- ),- child: Row(- children: [- icon,- const SizedBox(width: 16),- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Text(- title,- style: textTheme.bodyBold,- ),- const SizedBox(height: 4),- Text(- description,- style: textTheme.smallMuted,- ),- ],- ),- ),- Icon(- Icons.chevron_right,- color: colorScheme.textBase,- ),- ],- ),- ),- );- }-- void _showInformationForm(BuildContext context, InformationType type) {- Widget page;- switch (type) {- case InformationType.note:- page = const PersonalNotePage();- break;- case InformationType.physicalRecord:- page = const PhysicalRecordsPage();- break;- case InformationType.credentials:- page = const AccountCredentialsPage();- break;- case InformationType.emergencyContact:- page = const EmergencyContactPage();- break;- }-- Navigator.of(context).push(- MaterialPageRoute(builder: (context) => page),- );- }-}diff --git a/mobile/apps/locker/lib/ui/pages/save_page.dart b/mobile/apps/locker/lib/ui/pages/save_page.dartnew file mode 100644index 0000000000..3912f12a89--- /dev/null+++ b/mobile/apps/locker/lib/ui/pages/save_page.dart@@ -0,0 +1,300 @@+import 'dart:async';++import "package:ente_ui/components/title_bar_title_widget.dart";+import "package:ente_ui/theme/colors.dart";+import 'package:ente_ui/theme/ente_theme.dart';+import "package:ente_ui/theme/text_style.dart";+import 'package:flutter/material.dart';+import 'package:hugeicons/hugeicons.dart';+import 'package:locker/l10n/l10n.dart';+import 'package:locker/ui/pages/account_credentials_page.dart';+import 'package:locker/ui/pages/emergency_contact_page.dart';+import 'package:locker/ui/pages/personal_note_page.dart';+import 'package:locker/ui/pages/physical_records_page.dart';++enum SaveOptionType {+ document,+ note,+ physicalRecord,+ credentials,+ emergencyContact,+}++Future<void> showSaveBottomSheet(+ BuildContext context, {+ required Future<void> Function() onUploadDocument,+}) {+ final colorScheme = getEnteColorScheme(context);+ return showModalBottomSheet<void>(+ context: context,+ isScrollControlled: true,+ backgroundColor: colorScheme.backdropBase,+ shape: const RoundedRectangleBorder(+ borderRadius: BorderRadius.only(+ topLeft: Radius.circular(24),+ topRight: Radius.circular(24),+ ),+ ),+ builder: (sheetContext) {+ return SaveBottomSheet(+ rootContext: context,+ onUploadDocument: onUploadDocument,+ );+ },+ );+}++class SaveBottomSheet extends StatelessWidget {+ const SaveBottomSheet({+ super.key,+ required this.rootContext,+ required this.onUploadDocument,+ });++ final BuildContext rootContext;+ final Future<void> Function() onUploadDocument;++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+ final bottomInset = MediaQuery.of(context).viewInsets.bottom;+ final maxHeight = MediaQuery.of(context).size.height * 0.75;++ return Container(+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ border: Border(top: BorderSide(color: colorScheme.strokeFaint)),+ borderRadius: const BorderRadius.only(+ topLeft: Radius.circular(24),+ topRight: Radius.circular(24),+ ),+ ),+ child: SafeArea(+ top: false,+ child: Padding(+ padding: EdgeInsets.only(+ left: 16,+ right: 16,+ top: 20,+ bottom: bottomInset + 24,+ ),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Expanded(+ child: Padding(+ padding: const EdgeInsets.only(top: 12, left: 12),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ TitleBarTitleWidget(+ title: context.l10n.saveToLocker,+ ),+ Text(+ context.l10n.informationDescription,+ style: textTheme.smallMuted,+ ),+ ],+ ),+ ),+ ),+ GestureDetector(+ onTap: () {+ Navigator.of(context).pop();+ },+ child: Container(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(50),+ color: colorScheme.backgroundElevated,+ ),+ padding: const EdgeInsets.all(8),+ child: Icon(+ Icons.close,+ size: 24,+ color: colorScheme.textBase,+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: 24),+ ConstrainedBox(+ constraints: BoxConstraints(maxHeight: maxHeight),+ child: SingleChildScrollView(+ child: Column(+ children: [+ _buildSaveOption(+ context,+ rootContext: rootContext,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedFileUpload,+ size: 24,+ color: colorScheme.primary700,+ ),+ title: context.l10n.saveDocumentTitle,+ description: context.l10n.saveDocumentDescription,+ type: SaveOptionType.document,+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ const SizedBox(height: 16),+ _buildSaveOption(+ context,+ rootContext: rootContext,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedPencilEdit02,+ size: 24,+ color: colorScheme.primary700,+ ),+ title: context.l10n.personalNote,+ description: context.l10n.personalNoteDescription,+ type: SaveOptionType.note,+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ const SizedBox(height: 16),+ _buildSaveOption(+ context,+ rootContext: rootContext,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedFolder02,+ size: 24,+ color: colorScheme.primary700,+ ),+ title: context.l10n.physicalRecords,+ description: context.l10n.physicalRecordsDescription,+ type: SaveOptionType.physicalRecord,+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ const SizedBox(height: 16),+ _buildSaveOption(+ context,+ rootContext: rootContext,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedUserEdit01,+ size: 24,+ color: colorScheme.primary700,+ ),+ title: context.l10n.accountCredentials,+ description: context.l10n.accountCredentialsDescription,+ type: SaveOptionType.credentials,+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ const SizedBox(height: 16),+ _buildSaveOption(+ context,+ rootContext: rootContext,+ icon: HugeIcon(+ icon: HugeIcons.strokeRoundedContactBook,+ size: 24,+ color: colorScheme.primary700,+ ),+ title: context.l10n.emergencyContact,+ description: context.l10n.emergencyContactDescription,+ type: SaveOptionType.emergencyContact,+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ const SizedBox(height: 32),+ ],+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }++ Widget _buildSaveOption(+ BuildContext sheetContext, {+ required BuildContext rootContext,+ required HugeIcon icon,+ required String title,+ required String description,+ required SaveOptionType type,+ required EnteColorScheme colorScheme,+ required EnteTextTheme textTheme,+ }) {+ return GestureDetector(+ onTap: () {+ Navigator.of(sheetContext).pop();+ // Push the form route after the sheet has dismissed to avoid UI jank.+ WidgetsBinding.instance.addPostFrameCallback((_) {+ _handleSaveOption(rootContext, type);+ });+ },+ child: Container(+ padding: const EdgeInsets.all(16),+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(20),+ color: colorScheme.backdropBase,+ ),+ child: Row(+ children: [+ icon,+ const SizedBox(width: 16),+ Expanded(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Text(+ title,+ style: textTheme.bodyBold,+ ),+ const SizedBox(height: 4),+ Text(+ description,+ style: textTheme.smallMuted,+ ),+ ],+ ),+ ),+ Icon(+ Icons.chevron_right,+ color: colorScheme.textBase,+ ),+ ],+ ),+ ),+ );+ }++ void _handleSaveOption(BuildContext context, SaveOptionType type) {+ switch (type) {+ case SaveOptionType.document:+ unawaited(onUploadDocument());+ return;+ case SaveOptionType.note:+ Navigator.of(context).push(+ MaterialPageRoute(builder: (context) => const PersonalNotePage()),+ );+ break;+ case SaveOptionType.physicalRecord:+ Navigator.of(context).push(+ MaterialPageRoute(builder: (context) => const PhysicalRecordsPage()),+ );+ break;+ case SaveOptionType.credentials:+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => const AccountCredentialsPage(),+ ),+ );+ break;+ case SaveOptionType.emergencyContact:+ Navigator.of(context).push(+ MaterialPageRoute(builder: (context) => const EmergencyContactPage()),+ );+ break;+ }+ }+}