Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add custom app bar & minor fix

AmanRajSinghMourya231dfc0aa40f
diff --git a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
index b263ddc960..b2299aa9aa 100644
--- a/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/collection_selection_widget.dart
@@ -62,189 +62,151 @@ class _CollectionSelectionWidgetState extends State<CollectionSelectionWidget> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
- 'Collections',
- style: textTheme.small.copyWith(
+ 'Add to collection',
+ style: textTheme.h3.copyWith(
color: colorScheme.textBase,
),
),
- const SizedBox(height: 8),
- Container(
- height: 150,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(8),
- border: Border.all(color: colorScheme.strokeFaint),
- ),
- child: _availableCollections.isEmpty
- ? Container(
- padding: const EdgeInsets.all(16),
- decoration: BoxDecoration(
- color: colorScheme.fillFaint,
- borderRadius: BorderRadius.circular(8),
+ const SizedBox(height: 12),
+ _availableCollections.isEmpty
+ ? InkWell(
+ onTap: _createNewCollection,
+ borderRadius: BorderRadius.circular(20),
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 18,
+ vertical: 14,
),
- child: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- 'No collections available',
- style: textTheme.body.copyWith(
- color: colorScheme.textMuted,
- ),
- ),
- const SizedBox(height: 8),
- InkWell(
- onTap: _createNewCollection,
- child: Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 12,
- vertical: 6,
- ),
- decoration: BoxDecoration(
- color: colorScheme.primary300.withOpacity(0.1),
- borderRadius: BorderRadius.circular(6),
- border: Border.all(
- color: colorScheme.primary500,
- width: 1,
- ),
- ),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- Icon(
- Icons.add,
- size: 16,
- color: colorScheme.primary700,
- ),
- const SizedBox(width: 4),
- Text(
- 'Create collection',
- style: textTheme.small.copyWith(
- color: colorScheme.primary700,
- fontWeight: FontWeight.w600,
- ),
- ),
- ],
- ),
- ),
- ),
- ],
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(
+ color: colorScheme.strokeMuted,
+ width: 1,
),
),
- )
- : Scrollbar(
- thumbVisibility: true,
- thickness: 6,
- radius: const Radius.circular(3),
- child: GridView.builder(
- gridDelegate:
- const SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2,
- childAspectRatio: 3.5,
- crossAxisSpacing: 6,
- mainAxisSpacing: 6,
- ),
- padding: const EdgeInsets.all(6),
- itemCount: _availableCollections.length +
- 1, // +1 for "Create New" option
- itemBuilder: (context, index) {
- if (index < _availableCollections.length) {
- final collection = _availableCollections[index];
- final isSelected = widget.selectedCollectionIds
- .contains(collection.id);
- final collectionName =
- collection.name ?? 'Unnamed Collection';
-
- return InkWell(
- onTap: () => widget.onToggleCollection(collection.id),
- borderRadius: BorderRadius.circular(8),
- child: Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- vertical: 4,
- ),
- decoration: BoxDecoration(
- color: isSelected
- ? colorScheme.primary300.withOpacity(0.3)
- : colorScheme.fillFaint,
- borderRadius: BorderRadius.circular(8),
- border: Border.all(
- color: isSelected
- ? colorScheme.primary500
- : colorScheme.strokeFaint,
- width: isSelected ? 2 : 1,
- ),
- ),
- child: Center(
- child: Text(
- collectionName,
- style: textTheme.small.copyWith(
- color: isSelected
- ? colorScheme.primary500
- : colorScheme.textBase,
- fontWeight: isSelected
- ? FontWeight.w600
- : FontWeight.normal,
- ),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- textAlign: TextAlign.center,
- ),
- ),
- ),
- );
- }
-
- return InkWell(
- onTap: _createNewCollection,
- borderRadius: BorderRadius.circular(8),
- child: Container(
- padding: const EdgeInsets.symmetric(
- horizontal: 6,
- vertical: 4,
- ),
- decoration: BoxDecoration(
- color: colorScheme.backgroundElevated,
- borderRadius: BorderRadius.circular(8),
- border: Border.all(
- color: colorScheme.strokeFaint.withOpacity(0.5),
- width: 1,
- style: BorderStyle.solid,
- ),
- ),
- child: Center(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Icon(
- Icons.add_outlined,
- size: 14,
- color: colorScheme.textBase,
- ),
- const SizedBox(width: 4),
- Flexible(
- child: Text(
- 'Collection',
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
- fontWeight: FontWeight.w400,
- ),
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- textAlign: TextAlign.center,
- ),
- ),
- ],
- ),
- ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ Icons.add,
+ size: 16,
+ color: colorScheme.textMuted,
+ ),
+ const SizedBox(width: 4),
+ Text(
+ 'New collection',
+ style: textTheme.small.copyWith(
+ color: colorScheme.textMuted,
+ fontWeight: FontWeight.w500,
),
- );
- },
+ ),
+ ],
),
),
- ),
+ )
+ : Wrap(
+ spacing: 8,
+ runSpacing: 8,
+ children: [
+ // Collection chips
+ for (final collection in _availableCollections)
+ _buildCollectionChip(
+ collection: collection,
+ isSelected:
+ widget.selectedCollectionIds.contains(collection.id),
+ onTap: () => widget.onToggleCollection(collection.id),
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ // "New collection" chip
+ _buildNewCollectionChip(
+ colorScheme: colorScheme,
+ textTheme: textTheme,
+ ),
+ ],
+ ),
],
);
}
+ Widget _buildCollectionChip({
+ required Collection collection,
+ required bool isSelected,
+ required VoidCallback onTap,
+ required colorScheme,
+ required textTheme,
+ }) {
+ final collectionName = collection.name ?? 'Unnamed Collection';
+
+ return InkWell(
+ onTap: onTap,
+ borderRadius: BorderRadius.circular(20),
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 18,
+ vertical: 14,
+ ),
+ decoration: BoxDecoration(
+ color: isSelected
+ ? colorScheme.primary300.withOpacity(0.15)
+ : colorScheme.fillFaint,
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(
+ color: isSelected ? colorScheme.primary700 : Colors.transparent,
+ width: 1,
+ ),
+ ),
+ child: Text(
+ collectionName,
+ style: textTheme.small.copyWith(
+ color: isSelected ? colorScheme.primary700 : colorScheme.textMuted,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ),
+ );
+ }
+
+ Widget _buildNewCollectionChip({
+ required colorScheme,
+ required textTheme,
+ }) {
+ return InkWell(
+ onTap: _createNewCollection,
+ borderRadius: BorderRadius.circular(20),
+ child: Container(
+ padding: const EdgeInsets.symmetric(
+ horizontal: 12,
+ vertical: 10,
+ ),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(20),
+ border: Border.all(
+ color: colorScheme.strokeMuted,
+ width: 1,
+ ),
+ ),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Icon(
+ Icons.add,
+ size: 16,
+ color: colorScheme.textMuted,
+ ),
+ const SizedBox(width: 4),
+ Text(
+ 'New collection',
+ style: textTheme.small.copyWith(
+ color: colorScheme.textMuted,
+ fontWeight: FontWeight.w500,
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
List<Collection> get availableCollections => _availableCollections;
}
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index fb5f063463..84b70cc3ac 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -9,6 +9,7 @@ import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_ui/utils/dialog_util.dart';
import 'package:ente_utils/email_util.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import "package:hugeicons/hugeicons.dart";
import 'package:listen_sharing_intent/listen_sharing_intent.dart';
import 'package:locker/events/collections_updated_event.dart';
@@ -31,6 +32,157 @@ import 'package:locker/utils/collection_actions.dart';
import 'package:locker/utils/collection_sort_util.dart';
import 'package:logging/logging.dart';
+class CustomLockerAppBar extends StatelessWidget
+ implements PreferredSizeWidget {
+ final GlobalKey<ScaffoldState> scaffoldKey;
+ final bool isSearchActive;
+ final TextEditingController searchController;
+ final FocusNode searchFocusNode;
+ final VoidCallback onSearchFocused;
+ final VoidCallback onClearSearch;
+ final ValueChanged<String>? onSearchChanged;
+
+ const CustomLockerAppBar({
+ super.key,
+ required this.scaffoldKey,
+ required this.isSearchActive,
+ required this.searchController,
+ required this.searchFocusNode,
+ required this.onSearchFocused,
+ required this.onClearSearch,
+ this.onSearchChanged,
+ });
+
+ @override
+ Size get preferredSize => const Size.fromHeight(156);
+
+ @override
+ Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
+ return Container(
+ decoration: BoxDecoration(
+ color: colorScheme.primary700,
+ borderRadius: const BorderRadius.only(
+ bottomLeft: Radius.circular(20),
+ bottomRight: Radius.circular(20),
+ ),
+ ),
+ child: SafeArea(
+ child: Column(
+ children: [
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ GestureDetector(
+ onTap: () {
+ scaffoldKey.currentState!.openDrawer();
+ },
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedMenu01,
+ color: colorScheme.backdropBase,
+ ),
+ ),
+ GestureDetector(
+ onLongPress: () {
+ sendLogs(
+ context,
+ subject: 'Locker logs',
+ body: 'Debug logs for Locker app.\n\n',
+ );
+ },
+ child: Text(
+ 'Locker',
+ style: textTheme.h3Bold.copyWith(
+ color: colorScheme.backdropBase,
+ ),
+ ),
+ ),
+ const SizedBox(width: 48),
+ ],
+ ),
+ ),
+ // Search bar
+ Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 20),
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundBase,
+ borderRadius: BorderRadius.circular(100),
+ ),
+ child: TextField(
+ autocorrect: false,
+ enableSuggestions: false,
+ controller: searchController,
+ focusNode: searchFocusNode,
+ onTap: onSearchFocused,
+ onChanged: onSearchChanged,
+ textAlignVertical: TextAlignVertical.center,
+ decoration: InputDecoration(
+ hintText: context.l10n.searchHint,
+ hintStyle: TextStyle(
+ color: colorScheme.primary700,
+ fontWeight: FontWeight.w600,
+ fontSize: 14,
+ ),
+ border: InputBorder.none,
+ focusedBorder: InputBorder.none,
+ isDense: true,
+ contentPadding: const EdgeInsets.symmetric(
+ horizontal: 16,
+ vertical: 14,
+ ),
+ prefixIcon: Padding(
+ padding: const EdgeInsets.only(left: 16, right: 8),
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ color: colorScheme.primary700,
+ size: 20,
+ ),
+ ),
+ prefixIconConstraints: const BoxConstraints(
+ minWidth: 44,
+ minHeight: 24,
+ ),
+ suffixIcon:
+ (isSearchActive || searchController.text.isNotEmpty)
+ ? GestureDetector(
+ onTap: onClearSearch,
+ child: Padding(
+ padding:
+ const EdgeInsets.only(right: 16, left: 8),
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: colorScheme.iconColor,
+ size: 20,
+ ),
+ ),
+ )
+ : null,
+ suffixIconConstraints: const BoxConstraints(
+ minWidth: 44,
+ minHeight: 24,
+ ),
+ ),
+ style: TextStyle(
+ color: colorScheme.primary700,
+ fontWeight: FontWeight.w600,
+ fontSize: 14,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
class HomePage extends UploaderPage {
final String? initialSearchQuery;
@@ -47,6 +199,7 @@ class _HomePageState extends UploaderPageState<HomePage>
scaffoldKey: scaffoldKey,
);
final scaffoldKey = GlobalKey<ScaffoldState>();
+ final _searchFocusNode = FocusNode();
bool _isLoading = true;
bool _isSettingsOpen = false;
@@ -189,6 +342,7 @@ class _HomePageState extends UploaderPageState<HomePage>
void dispose() {
_animationController.dispose();
_isFabOpen.dispose();
+ _searchFocusNode.dispose();
disposeSharing();
super.dispose();
}
@@ -366,6 +520,32 @@ class _HomePageState extends UploaderPageState<HomePage>
);
}
+ void _handleSearchChange(String query) {
+ // Trigger search by activating search with the current query
+ activateSearchWithQuery(query);
+ }
+
+ void _handleSearchFocused() {
+ // Activate search when TextField is tapped/focused
+ if (!isSearchActive) {
+ activateSearchWithQuery('');
+ }
+ }
+
+ void _handleClearSearch() {
+ // Clear text and unfocus to properly dismiss search
+ searchController.clear();
+ _searchFocusNode.unfocus();
+ // Simulate ESC key to deactivate search state
+ // ignore: prefer_const_constructors
+ final escapeEvent = KeyDownEvent(
+ physicalKey: PhysicalKeyboardKey.escape,
+ logicalKey: LogicalKeyboardKey.escape,
+ timeStamp: const Duration(seconds: 0),
+ );
+ handleKeyEvent(escapeEvent);
+ }
+
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
@@ -392,29 +572,14 @@ class _HomePageState extends UploaderPageState<HomePage>
),
drawerEnableOpenDragGesture: !Platform.isAndroid,
onDrawerChanged: (isOpened) => _isSettingsOpen = isOpened,
- appBar: AppBar(
- surfaceTintColor: Colors.transparent,
- leading: buildSearchLeading(),
- title: GestureDetector(
- onLongPress: () {
- sendLogs(
- context,
- subject: 'Locker logs',
- body: 'Debug logs for Locker app.\n\n',
- );
- },
- child: const Text(
- 'Locker',
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- ),
- elevation: 0,
- backgroundColor: colorScheme.backgroundBase,
- actions: [
- buildSearchAction(),
- ...buildSearchActions(),
- ],
+ appBar: CustomLockerAppBar(
+ scaffoldKey: scaffoldKey,
+ isSearchActive: isSearchActive,
+ searchController: searchController,
+ searchFocusNode: _searchFocusNode,
+ onSearchFocused: _handleSearchFocused,
+ onClearSearch: _handleClearSearch,
+ onSearchChanged: _handleSearchChange,
),
body: _buildBody(),
floatingActionButton:
diff --git a/mobile/packages/accounts/lib/pages/delete_account_page.dart b/mobile/packages/accounts/lib/pages/delete_account_page.dart
index f79e32cac8..a21045b598 100644
--- a/mobile/packages/accounts/lib/pages/delete_account_page.dart
+++ b/mobile/packages/accounts/lib/pages/delete_account_page.dart
@@ -11,6 +11,7 @@ import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_utils/email_util.dart';
import 'package:ente_utils/platform_util.dart';
import 'package:flutter/material.dart';
+import "package:hugeicons/hugeicons.dart";
class DeleteAccountPage extends StatelessWidget {
final BaseConfiguration config;
@@ -77,7 +78,7 @@ class DeleteAccountPage extends StatelessWidget {
),
GradientButton(
text: context.strings.yesSendFeedbackAction,
- iconData: Icons.check,
+ hugeIcon: const HugeIcon(icon: HugeIcons.strokeRoundedTick02),
onTap: () async {
await sendEmail(
context,
diff --git a/mobile/packages/accounts/pubspec.lock b/mobile/packages/accounts/pubspec.lock
index 498b45bfa4..6e08241166 100644
--- a/mobile/packages/accounts/pubspec.lock
+++ b/mobile/packages/accounts/pubspec.lock
@@ -492,6 +492,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.3"
+ flutter_svg:
+ dependency: transitive
+ description:
+ name: flutter_svg
+ sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678
+ url: "https://pub.dev"
+ source: hosted
+ version: "2.2.1"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -566,6 +574,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.1.0"
+ hugeicons:
+ dependency: "direct main"
+ description:
+ name: hugeicons
+ sha256: "036d917bd12e2dee331de7910a11417ebf6c80be1962c0d63ee945e3184f0937"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.1"
intl:
dependency: transitive
description:
@@ -774,6 +790,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.9.1"
+ path_parsing:
+ dependency: transitive
+ description:
+ name: path_parsing
+ sha256: "883402936929eac138ee0a45da5b0f2c80f89913e6dc3bf77eb65b84b409c6ca"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.0"
path_provider:
dependency: transitive
description:
@@ -822,6 +846,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.0"
+ petitparser:
+ dependency: transitive
+ description:
+ name: petitparser
+ sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
+ url: "https://pub.dev"
+ source: hosted
+ version: "7.0.1"
pinput:
dependency: "direct main"
description:
@@ -1211,6 +1243,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.5.1"
+ vector_graphics:
+ dependency: transitive
+ description:
+ name: vector_graphics
+ sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.19"
+ vector_graphics_codec:
+ dependency: transitive
+ description:
+ name: vector_graphics_codec
+ sha256: "99fd9fbd34d9f9a32efd7b6a6aae14125d8237b10403b422a6a6dfeac2806146"
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.13"
+ vector_graphics_compiler:
+ dependency: transitive
+ description:
+ name: vector_graphics_compiler
+ sha256: d354a7ec6931e6047785f4db12a1f61ec3d43b207fc0790f863818543f8ff0dc
+ url: "https://pub.dev"
+ source: hosted
+ version: "1.1.19"
vector_math:
dependency: transitive
description:
@@ -1275,6 +1331,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.0"
+ xml:
+ dependency: transitive
+ description:
+ name: xml
+ sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
+ url: "https://pub.dev"
+ source: hosted
+ version: "6.6.1"
xmlstream:
dependency: transitive
description:
@@ -1284,5 +1348,5 @@ packages:
source: hosted
version: "1.1.1"
sdks:
- dart: ">=3.7.2 <4.0.0"
- flutter: ">=3.24.0"
+ dart: ">=3.8.0 <4.0.0"
+ flutter: ">=3.29.0"
diff --git a/mobile/packages/accounts/pubspec.yaml b/mobile/packages/accounts/pubspec.yaml
index 1d4064ac75..c10c9e4c40 100644
--- a/mobile/packages/accounts/pubspec.yaml
+++ b/mobile/packages/accounts/pubspec.yaml
@@ -35,6 +35,7 @@ dependencies:
file_saver: ^0.3.0
flutter:
sdk: flutter
+ hugeicons: ^1.1.1
logging: ^1.2.0
password_strength: ^0.2.0
pinput: ^5.0.1