π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update credential screen
vishnukvmdbe9929145c63
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arbindex af0606ab25..3afa8060e6 100644--- a/mobile/apps/locker/lib/l10n/app_en.arb+++ b/mobile/apps/locker/lib/l10n/app_en.arb@@ -374,7 +374,7 @@"recordLocationHint": "Where can this item be found?","recordNotes": "Notes","recordNotesHint": "Any additional information about the item?",- "credentialName": "Account name",+ "credentialName": "Item name","credentialNameHint": "Name of the service or account","username": "Username","usernameHint": "Login username or email address",diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dartindex c0e585e6b8..bf8c6c5598 100644--- a/mobile/apps/locker/lib/l10n/app_localizations.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart@@ -1165,7 +1165,7 @@ abstract class AppLocalizations {/// No description provided for @credentialName.////// In en, this message translates to:- /// **'Account name'**+ /// **'Item name'**String get credentialName;/// No description provided for @credentialNameHint.diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dartindex 26699bec7a..9234069f48 100644--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart@@ -613,7 +613,7 @@ class AppLocalizationsEn extends AppLocalizations {String get recordNotesHint => 'Any additional information about the item?';@override- String get credentialName => 'Account name';+ String get credentialName => 'Item name';@overrideString get credentialNameHint => 'Name of the service or account';diff --git a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dartindex 1bb953d7df..ddc885cfcc 100644--- a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart+++ b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart@@ -1,6 +1,5 @@import 'package:collection/collection.dart' show IterableExtension;import 'package:dotted_border/dotted_border.dart';-import 'package:ente_ui/components/title_bar_title_widget.dart';import 'package:ente_ui/theme/ente_theme.dart';import 'package:flutter/material.dart';import 'package:locker/l10n/l10n.dart';@@ -102,45 +101,120 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {final textTheme = getEnteTextTheme(context);final containsUncategorized = _uncategorizedCollection != null;+ Widget? headerWidget = widget.titleWidget;+ if (headerWidget == null) {+ headerWidget = Text(+ context.l10n.collections,+ style: textTheme.body,+ );+ }++ bool _isHiddenHeader(Widget widget) {+ if (widget is SizedBox) {+ final isZeroWidth = widget.width != null && widget.width == 0;+ final isZeroHeight = widget.height != null && widget.height == 0;+ final noChild = widget.child == null;+ if ((isZeroWidth || isZeroHeight) && noChild) {+ return true;+ }+ }+ return false;+ }++ final bool hasVisibleHeader = !_isHiddenHeader(headerWidget);++ final chipItems = <_ChipItem>[];+ if (containsUncategorized) {+ chipItems.add(+ _ChipItem(+ widget: _buildUncategorizedChip(+ name: context.l10n.uncategorized,+ isSelected: widget.selectedCollectionIds+ .contains(_uncategorizedCollection?.id ?? -1),+ onTap: () {+ if (_uncategorizedCollection != null) {+ _onCollectionTap(_uncategorizedCollection!.id);+ }+ },+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ weight: context.l10n.uncategorized.length,+ ),+ );+ }++ for (final collection in _availableCollections) {+ final collectionName = collection.name ?? context.l10n.unnamedCollection;+ chipItems.add(+ _ChipItem(+ widget: _buildCollectionChip(+ collection: collection,+ isSelected: widget.selectedCollectionIds.contains(collection.id),+ onTap: () => _onCollectionTap(collection.id),+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ weight: collectionName.length,+ ),+ );+ }++ final newCollectionChip = _ChipItem(+ widget: _buildNewCollectionChip(+ colorScheme: colorScheme,+ textTheme: textTheme,+ ),+ weight: context.l10n.collectionLabel.length,+ );++ final topRowChips = <Widget>[];+ final bottomRowChips = <Widget>[];+ var topWeight = 0;+ var bottomWeight = newCollectionChip.weight;++ for (final item in chipItems) {+ if (topWeight <= bottomWeight) {+ topRowChips.add(item.widget);+ topWeight += item.weight;+ } else {+ bottomRowChips.add(item.widget);+ bottomWeight += item.weight;+ }+ }++ bottomRowChips.add(newCollectionChip.widget);++ List<Widget> _buildChipRow(List<Widget> rowChips) {+ final children = <Widget>[];+ for (var i = 0; i < rowChips.length; i++) {+ if (i != 0) {+ children.add(const SizedBox(width: 8));+ }+ children.add(rowChips[i]);+ }+ return children;+ }+return Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- widget.titleWidget ??- TitleBarTitleWidget(- title: context.l10n.addToCollection,- ),- const SizedBox(height: 24),- Wrap(- spacing: 8,- runSpacing: 12,- children: [- if (containsUncategorized)- _buildUncategorizedChip(- name: context.l10n.uncategorized,- isSelected: widget.selectedCollectionIds- .contains(_uncategorizedCollection?.id ?? -1),- onTap: () {- if (_uncategorizedCollection != null) {- _onCollectionTap(_uncategorizedCollection!.id);- }- },- colorScheme: colorScheme,- textTheme: textTheme,- ),- for (final collection in _availableCollections)- _buildCollectionChip(- collection: collection,- isSelected:- widget.selectedCollectionIds.contains(collection.id),- onTap: () => _onCollectionTap(collection.id),- colorScheme: colorScheme,- textTheme: textTheme,- ),- _buildNewCollectionChip(- colorScheme: colorScheme,- textTheme: textTheme,- ),- ],+ if (hasVisibleHeader) ...[+ headerWidget,+ const SizedBox(height: 12),+ ],+ SingleChildScrollView(+ scrollDirection: Axis.horizontal,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Row(children: _buildChipRow(topRowChips)),+ if (bottomRowChips.isNotEmpty) ...[+ const SizedBox(height: 12),+ Row(children: _buildChipRow(bottomRowChips)),+ ],+ ],+ ),),],);@@ -238,7 +312,7 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {),const SizedBox(width: 6),Text(- context.l10n.newCollection,+ context.l10n.collectionLabel,style: textTheme.body.copyWith(color: colorScheme.textMuted,fontWeight: FontWeight.w500,@@ -252,3 +326,10 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {List<Collection> get availableCollections => _availableCollections;}++class _ChipItem {+ final Widget widget;+ final int weight;++ const _ChipItem({required this.widget, required this.weight});+}diff --git a/mobile/apps/locker/lib/ui/components/form_text_input_widget.dart b/mobile/apps/locker/lib/ui/components/form_text_input_widget.dartindex a21726c638..218487d290 100644--- a/mobile/apps/locker/lib/ui/components/form_text_input_widget.dart+++ b/mobile/apps/locker/lib/ui/components/form_text_input_widget.dart@@ -133,7 +133,7 @@ class _FormTextInputWidgetState extends State<FormTextInputWidget> {decoration: InputDecoration(hintText: widget.hintText,hintStyle:- textTheme.body.copyWith(color: colorScheme.textMuted),+ textTheme.body.copyWith(color: colorScheme.textFaint),filled: true,fillColor: colorScheme.fillFaint,contentPadding: const EdgeInsets.fromLTRB(12, 12, 12, 12),diff --git a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dartindex 52b675b807..ebac494ce9 100644--- a/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart+++ b/mobile/apps/locker/lib/ui/pages/account_credentials_page.dart@@ -125,6 +125,10 @@ class _AccountCredentialsPageStateobscureText: !_passwordVisible,shouldUseTextInputWidget: false,suffixIcon: IconButton(+ padding: EdgeInsets.zero,+ constraints: const BoxConstraints(minHeight: 0, minWidth: 0),+ iconSize: 20,+ visualDensity: VisualDensity.compact,icon: Icon(_passwordVisible ? Icons.visibility : Icons.visibility_off,),@@ -149,7 +153,6 @@ class _AccountCredentialsPageStateshouldUseTextInputWidget: false,maxLines: 3,),- const SizedBox(height: 24),];}diff --git a/mobile/apps/locker/lib/ui/pages/base_info_page.dart b/mobile/apps/locker/lib/ui/pages/base_info_page.dartindex b715cdb73e..426e104a5c 100644--- a/mobile/apps/locker/lib/ui/pages/base_info_page.dart+++ b/mobile/apps/locker/lib/ui/pages/base_info_page.dart@@ -69,6 +69,8 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>List<Widget> buildViewFields();bool validateForm();+ bool get showCollectionSelectionTitle => true;+@overridevoid initState() {super.initState();@@ -367,6 +369,11 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>surfaceTintColor: Colors.transparent,toolbarHeight: 48,leadingWidth: 48,+ centerTitle: false,+ titleSpacing: 0,+ title: TitleBarTitleWidget(+ title: pageTitle,+ ),leading: isEditMode && currentData != null? IconButton(icon: const Icon(@@ -400,12 +407,6 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>child: Column(crossAxisAlignment: CrossAxisAlignment.start,children: [- Padding(- padding: const EdgeInsets.symmetric(vertical: 4.0),- child: TitleBarTitleWidget(- title: pageTitle,- ),- ),Expanded(child: SingleChildScrollView(child: Padding(@@ -427,6 +428,9 @@ abstract class BaseInfoPageState<T extends InfoData, W extends BaseInfoPage<T>>selectedCollectionIds: _selectedCollectionIds,onToggleCollection: _onToggleCollection,onCollectionsUpdated: _onCollectionsUpdated,+ titleWidget: showCollectionSelectionTitle+ ? null+ : const SizedBox.shrink(),),],],