Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob][locker] Migrate settings to components (#10626)

Aman Raj83d46ee5ff0d
diff --git a/mobile/apps/locker/lib/l10n/app_en.arb b/mobile/apps/locker/lib/l10n/app_en.arb
index a61f8072f8..691825db3b 100644
--- a/mobile/apps/locker/lib/l10n/app_en.arb
+++ b/mobile/apps/locker/lib/l10n/app_en.arb
@@ -421,11 +421,27 @@
"downloadUpdate": "Download update",
"support": "Support",
"helpAndSupport": "Help and Support",
+ "getInTouch": "Get in touch",
+ "browseHelpPages": "Browse help pages",
"contactSupport": "Contact support",
"help": "Help",
+ "askAQuestion": "Ask a question",
"suggestFeatures": "Suggest features",
+ "requestAFeature": "Request a feature",
"reportABug": "Report a bug",
+ "reportAnIssue": "Report an issue",
"reportBug": "Report bug",
+ "viewAllHelpTopics": "View all help topics",
+ "gettingStarted": "Getting started",
+ "gettingStartedDesc": "Install Locker, create an account, and save your first item",
+ "informationTypes": "Information types",
+ "informationTypesDesc": "Documents, notes, cards, passwords, and other item types",
+ "organization": "Organization",
+ "organizationDesc": "Collections, favorites, search, and ways to keep items organized",
+ "legacyDesc": "Trusted contacts, Legacy Kit, and account recovery planning",
+ "securityDesc": "Encryption, recovery keys, app lock, and account protection",
+ "troubleshooting": "Troubleshooting",
+ "troubleshootingDesc": "Common issues and their solutions",
"logsDialogBodyLocker": "This will send logs to help us debug your issue.",
"@logsDialogBodyLocker": {
"description": "Dialog body text for sending logs in Locker app (without file name warning)"
diff --git a/mobile/apps/locker/lib/l10n/app_localizations.dart b/mobile/apps/locker/lib/l10n/app_localizations.dart
index 1800a86b40..198178f1df 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations.dart
@@ -1182,6 +1182,18 @@ abstract class AppLocalizations {
/// **'Help and Support'**
String get helpAndSupport;
+ /// No description provided for @getInTouch.
+ ///
+ /// In en, this message translates to:
+ /// **'Get in touch'**
+ String get getInTouch;
+
+ /// No description provided for @browseHelpPages.
+ ///
+ /// In en, this message translates to:
+ /// **'Browse help pages'**
+ String get browseHelpPages;
+
/// No description provided for @contactSupport.
///
/// In en, this message translates to:
@@ -1194,24 +1206,108 @@ abstract class AppLocalizations {
/// **'Help'**
String get help;
+ /// No description provided for @askAQuestion.
+ ///
+ /// In en, this message translates to:
+ /// **'Ask a question'**
+ String get askAQuestion;
+
/// No description provided for @suggestFeatures.
///
/// In en, this message translates to:
/// **'Suggest features'**
String get suggestFeatures;
+ /// No description provided for @requestAFeature.
+ ///
+ /// In en, this message translates to:
+ /// **'Request a feature'**
+ String get requestAFeature;
+
/// No description provided for @reportABug.
///
/// In en, this message translates to:
/// **'Report a bug'**
String get reportABug;
+ /// No description provided for @reportAnIssue.
+ ///
+ /// In en, this message translates to:
+ /// **'Report an issue'**
+ String get reportAnIssue;
+
/// No description provided for @reportBug.
///
/// In en, this message translates to:
/// **'Report bug'**
String get reportBug;
+ /// No description provided for @viewAllHelpTopics.
+ ///
+ /// In en, this message translates to:
+ /// **'View all help topics'**
+ String get viewAllHelpTopics;
+
+ /// No description provided for @gettingStarted.
+ ///
+ /// In en, this message translates to:
+ /// **'Getting started'**
+ String get gettingStarted;
+
+ /// No description provided for @gettingStartedDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Install Locker, create an account, and save your first item'**
+ String get gettingStartedDesc;
+
+ /// No description provided for @informationTypes.
+ ///
+ /// In en, this message translates to:
+ /// **'Information types'**
+ String get informationTypes;
+
+ /// No description provided for @informationTypesDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Documents, notes, cards, passwords, and other item types'**
+ String get informationTypesDesc;
+
+ /// No description provided for @organization.
+ ///
+ /// In en, this message translates to:
+ /// **'Organization'**
+ String get organization;
+
+ /// No description provided for @organizationDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Collections, favorites, search, and ways to keep items organized'**
+ String get organizationDesc;
+
+ /// No description provided for @legacyDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Trusted contacts, Legacy Kit, and account recovery planning'**
+ String get legacyDesc;
+
+ /// No description provided for @securityDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Encryption, recovery keys, app lock, and account protection'**
+ String get securityDesc;
+
+ /// No description provided for @troubleshooting.
+ ///
+ /// In en, this message translates to:
+ /// **'Troubleshooting'**
+ String get troubleshooting;
+
+ /// No description provided for @troubleshootingDesc.
+ ///
+ /// In en, this message translates to:
+ /// **'Common issues and their solutions'**
+ String get troubleshootingDesc;
+
/// Dialog body text for sending logs in Locker app (without file name warning)
///
/// In en, this message translates to:
diff --git a/mobile/apps/locker/lib/l10n/app_localizations_en.dart b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
index 42e041e11d..25f5cb6342 100644
--- a/mobile/apps/locker/lib/l10n/app_localizations_en.dart
+++ b/mobile/apps/locker/lib/l10n/app_localizations_en.dart
@@ -636,21 +636,74 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get helpAndSupport => 'Help and Support';
+ @override
+ String get getInTouch => 'Get in touch';
+
+ @override
+ String get browseHelpPages => 'Browse help pages';
+
@override
String get contactSupport => 'Contact support';
@override
String get help => 'Help';
+ @override
+ String get askAQuestion => 'Ask a question';
+
@override
String get suggestFeatures => 'Suggest features';
+ @override
+ String get requestAFeature => 'Request a feature';
+
@override
String get reportABug => 'Report a bug';
+ @override
+ String get reportAnIssue => 'Report an issue';
+
@override
String get reportBug => 'Report bug';
+ @override
+ String get viewAllHelpTopics => 'View all help topics';
+
+ @override
+ String get gettingStarted => 'Getting started';
+
+ @override
+ String get gettingStartedDesc =>
+ 'Install Locker, create an account, and save your first item';
+
+ @override
+ String get informationTypes => 'Information types';
+
+ @override
+ String get informationTypesDesc =>
+ 'Documents, notes, cards, passwords, and other item types';
+
+ @override
+ String get organization => 'Organization';
+
+ @override
+ String get organizationDesc =>
+ 'Collections, favorites, search, and ways to keep items organized';
+
+ @override
+ String get legacyDesc =>
+ 'Trusted contacts, Legacy Kit, and account recovery planning';
+
+ @override
+ String get securityDesc =>
+ 'Encryption, recovery keys, app lock, and account protection';
+
+ @override
+ String get troubleshooting => 'Troubleshooting';
+
+ @override
+ String get troubleshootingDesc => 'Common issues and their solutions';
+
@override
String get logsDialogBodyLocker =>
'This will send logs to help us debug your issue.';
diff --git a/mobile/apps/locker/lib/main.dart b/mobile/apps/locker/lib/main.dart
index c56c748b6d..7569e5cf28 100644
--- a/mobile/apps/locker/lib/main.dart
+++ b/mobile/apps/locker/lib/main.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:ente_accounts/services/user_service.dart';
+import 'package:ente_components/ente_components.dart' as components;
import 'package:ente_crypto_api/ente_crypto_api.dart';
import 'package:ente_crypto_dart_adapter/ente_crypto_dart_adapter.dart';
import "package:ente_legacy/services/emergency_service.dart";
@@ -97,6 +98,7 @@ Future<void> _initSystemTray() async {
Future<void> _runInForeground() async {
AppThemeConfig.initialize(EnteApp.locker);
+ components.ComponentTheme.configure(app: components.ComponentApp.locker);
final adaptiveThemeMode = await AdaptiveTheme.getThemeMode();
final savedThemeMode = _themeMode(adaptiveThemeMode);
return await _runWithLogs(() async {
diff --git a/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart
index af42a2fd84..9d44b33538 100644
--- a/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart
+++ b/mobile/apps/locker/lib/ui/components/legacy_collections_trash_widget.dart
@@ -1,11 +1,11 @@
import 'package:ente_pure_utils/ente_pure_utils.dart';
-import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/trash/trash_service.dart";
import "package:locker/ui/pages/all_collections_page.dart";
import "package:locker/ui/pages/trash_page.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
import "package:locker/ui/utils/legacy_utils.dart";
class LegacyCollectionsTrashWidget extends StatelessWidget {
@@ -36,39 +36,12 @@ class _CollectionsItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final borderRadius = BorderRadius.circular(20);
-
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
+ return SettingsItem(
+ title: context.l10n.collections,
+ icon: HugeIcons.strokeRoundedWallet05,
+ showChevron: false,
+ titleMaxLines: 1,
onTap: () => _openCollections(context),
- child: Container(
- height: 56,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: borderRadius,
- ),
- padding: const EdgeInsets.all(16),
- child: Row(
- children: [
- HugeIcon(
- icon: HugeIcons.strokeRoundedWallet05,
- color: colorScheme.textMuted,
- size: 24,
- ),
- const SizedBox(width: 12),
- Expanded(
- child: Text(
- context.l10n.collections,
- style: textTheme.small,
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- ),
- ),
- ],
- ),
- ),
);
}
@@ -82,39 +55,13 @@ class _TrashItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final borderRadius = BorderRadius.circular(20);
-
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
+ return SettingsItem(
+ title: context.l10n.trash,
+ icon: HugeIcons.strokeRoundedDelete02,
+ showChevron: false,
+ showOnlyLoadingState: true,
+ titleMaxLines: 1,
onTap: () => _openTrash(context),
- child: Container(
- height: 56,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: borderRadius,
- ),
- padding: const EdgeInsets.all(16),
- child: Row(
- children: [
- HugeIcon(
- icon: HugeIcons.strokeRoundedDelete02,
- color: colorScheme.textMuted,
- size: 24,
- ),
- const SizedBox(width: 12),
- Expanded(
- child: Text(
- context.l10n.trash,
- style: textTheme.small,
- overflow: TextOverflow.ellipsis,
- maxLines: 1,
- ),
- ),
- ],
- ),
- ),
);
}
@@ -130,33 +77,10 @@ class _LegacyItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final borderRadius = BorderRadius.circular(20);
-
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
+ return SettingsItem(
+ title: context.l10n.legacy,
+ icon: HugeIcons.strokeRoundedFavourite,
onTap: () => openLegacyPage(context),
- child: Container(
- height: 56,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: borderRadius,
- ),
- padding: const EdgeInsets.all(16),
- child: Row(
- children: [
- HugeIcon(
- icon: HugeIcons.strokeRoundedFavourite,
- color: colorScheme.textMuted,
- size: 24,
- ),
- const SizedBox(width: 12),
- Expanded(child: Text(context.l10n.legacy, style: textTheme.small)),
- Icon(Icons.chevron_right, color: colorScheme.textMuted),
- ],
- ),
- ),
);
}
}
diff --git a/mobile/apps/locker/lib/ui/components/recovery_key_sheet.dart b/mobile/apps/locker/lib/ui/components/recovery_key_sheet.dart
index 8a19096176..034fc71e22 100644
--- a/mobile/apps/locker/lib/ui/components/recovery_key_sheet.dart
+++ b/mobile/apps/locker/lib/ui/components/recovery_key_sheet.dart
@@ -1,17 +1,15 @@
import 'dart:io' as io;
import 'package:bip39/bip39.dart' as bip39;
+import 'package:ente_components/ente_components.dart';
import 'package:ente_configuration/base_configuration.dart';
import 'package:ente_configuration/constants.dart';
import 'package:ente_strings/ente_strings.dart';
-import "package:ente_ui/components/base_bottom_sheet.dart";
-import 'package:ente_ui/theme/ente_theme.dart';
-import 'package:ente_ui/utils/dialog_util.dart';
import 'package:ente_ui/utils/toast_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
+import 'package:hugeicons/hugeicons.dart';
import 'package:locker/services/configuration.dart';
-import "package:locker/ui/components/gradient_button.dart";
import "package:share_plus/share_plus.dart";
class RecoveryKeySheet extends StatefulWidget {
@@ -47,8 +45,7 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
// Convert recovery key to mnemonic words
final String recoveryKeyMnemonic = bip39.entropyToMnemonic(
@@ -67,12 +64,12 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
children: [
Text(
context.strings.recoveryKeyOnForgotPassword,
- style: textTheme.body.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 24),
Container(
decoration: BoxDecoration(
- color: colorScheme.primary700,
+ color: colors.primaryDarker,
borderRadius: BorderRadius.circular(16),
),
child: Stack(
@@ -84,10 +81,9 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
),
child: SelectableText(
recoveryKeyMnemonic,
- style: textTheme.body.copyWith(
- color: Colors.white,
+ style: TextStyles.body.copyWith(
+ color: colors.specialWhite,
fontFamily: 'monospace',
- letterSpacing: 0.5,
height: 1.5,
),
textAlign: TextAlign.justify,
@@ -96,15 +92,16 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
Positioned(
right: 0,
top: 0,
- child: IconButton(
- onPressed: () => _copyToClipboard(recoveryKeyMnemonic),
- visualDensity: VisualDensity.compact,
- icon: Icon(
- Icons.copy_rounded,
- size: 20,
- color: colorScheme.primary500,
- ),
+ child: IconButtonComponent(
+ variant: IconButtonComponentVariant.secondary,
tooltip: 'Copy to clipboard',
+ shouldSurfaceExecutionStates: false,
+ icon: HugeIcon(
+ icon: HugeIcons.strokeRoundedCopy01,
+ size: IconSizes.small,
+ color: colors.specialWhite,
+ ),
+ onTap: () => _copyToClipboard(recoveryKeyMnemonic),
),
),
],
@@ -113,15 +110,12 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
const SizedBox(height: 16),
Text(
context.strings.recoveryKeySaveDescription,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.mini.copyWith(color: colors.textLight),
),
const SizedBox(height: 24),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- onTap: () => _shareRecoveryKey(recoveryKeyMnemonic),
- text: 'Share recovery key',
- ),
+ ButtonComponent(
+ label: 'Share recovery key',
+ onTap: () => _shareRecoveryKey(recoveryKeyMnemonic),
),
],
);
@@ -146,7 +140,11 @@ class _RecoveryKeySheetState extends State<RecoveryKeySheet> {
);
} catch (e) {
if (mounted) {
- await showGenericErrorBottomSheet(context: context, error: e);
+ await showErrorBottomSheetComponent<void>(
+ context: context,
+ message: e.toString(),
+ title: context.strings.somethingWentWrong,
+ );
}
}
}
@@ -156,12 +154,14 @@ Future<void> showRecoveryKeySheet(
BuildContext context, {
required String recoveryKey,
}) {
- return showBaseBottomSheet<void>(
- context,
- title: context.strings.recoveryKey,
- headerSpacing: 20,
+ return showBottomSheetComponent<void>(
+ context: context,
isDismissible: false,
enableDrag: false,
- child: RecoveryKeySheet(recoveryKey: recoveryKey),
+ builder: (_) => BottomSheetComponent(
+ title: context.strings.recoveryKey,
+ showCloseButton: true,
+ content: RecoveryKeySheet(recoveryKey: recoveryKey),
+ ),
);
}
diff --git a/mobile/apps/locker/lib/ui/drawer/drawer_page.dart b/mobile/apps/locker/lib/ui/drawer/drawer_page.dart
index a5a76fc5c4..96eb6c5732 100644
--- a/mobile/apps/locker/lib/ui/drawer/drawer_page.dart
+++ b/mobile/apps/locker/lib/ui/drawer/drawer_page.dart
@@ -1,12 +1,13 @@
+import "package:ente_components/ente_components.dart";
import "package:ente_sharing/verify_identity_dialog.dart";
import "package:ente_strings/ente_strings.dart";
-import "package:ente_ui/theme/colors.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
+import "package:locker/l10n/l10n.dart";
import "package:locker/services/configuration.dart";
import "package:locker/ui/components/legacy_collections_trash_widget.dart";
import "package:locker/ui/components/usage_card_widget.dart";
-import "package:locker/ui/drawer/drawer_title_bar_widget.dart";
+import "package:locker/ui/settings/pages/settings_search_page.dart";
import "package:locker/ui/settings/settings_page.dart";
class DrawerPage extends StatelessWidget {
@@ -21,60 +22,19 @@ class DrawerPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final enteColorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
return Scaffold(
- backgroundColor: enteColorScheme.backgroundBase,
- body: Container(
- color: enteColorScheme.backgroundBase,
- child: _getBody(context, enteColorScheme),
- ),
+ backgroundColor: colors.backgroundBase,
+ body: Container(color: colors.backgroundBase, child: _getBody(context)),
);
}
- Widget _getBody(BuildContext context, EnteColorScheme colorScheme) {
+ Widget _getBody(BuildContext context) {
final hasLoggedIn = Configuration.instance.hasConfiguredAccount();
- final enteTextTheme = getEnteTextTheme(context);
- const sectionSpacing = SizedBox(height: 8);
final List<Widget> contents = [];
if (hasLoggedIn) {
- contents.add(
- GestureDetector(
- onDoubleTap: () => showVerifyIdentitySheet(
- context,
- self: true,
- config: Configuration.instance,
- title: context.strings.verifyIDLabel,
- ),
- onLongPress: () => showVerifyIdentitySheet(
- context,
- self: true,
- config: Configuration.instance,
- title: context.strings.verifyIDLabel,
- ),
- child: Container(
- padding: const EdgeInsets.symmetric(horizontal: 8),
- child: Align(
- alignment: Alignment.centerLeft,
- child: AnimatedBuilder(
- // [AnimatedBuilder] accepts any [Listenable] subtype.
- animation: emailNotifier,
- builder: (BuildContext context, Widget? child) {
- return Text(
- emailNotifier.value!,
- style: enteTextTheme.body.copyWith(
- color: colorScheme.textMuted,
- overflow: TextOverflow.ellipsis,
- ),
- );
- },
- ),
- ),
- ),
- ),
- );
contents.addAll([
- sectionSpacing,
const UsageCardWidget(),
const SizedBox(height: 24),
const LegacyCollectionsTrashWidget(),
@@ -87,20 +47,63 @@ class DrawerPage extends StatelessWidget {
const Padding(padding: EdgeInsets.only(bottom: 60)),
]);
- return SafeArea(
- bottom: false,
- child: SingleChildScrollView(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- DrawerTitleBarWidget(scaffoldKey: scaffoldKey),
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 24),
- child: Column(children: contents),
+ return AnimatedBuilder(
+ animation: emailNotifier,
+ builder: (context, _) {
+ final email = emailNotifier.value ?? "";
+ final title = hasLoggedIn && email.isNotEmpty
+ ? email
+ : context.l10n.settings;
+
+ return AppBarComponent(
+ title: title,
+ actions: [_buildSearchAction(context)],
+ onBack: () => scaffoldKey.currentState?.closeDrawer(),
+ onTitleDoubleTap: hasLoggedIn
+ ? () => _showVerifyIDSheet(context)
+ : null,
+ onTitleLongPress: hasLoggedIn
+ ? () => _showVerifyIDSheet(context)
+ : null,
+ slivers: [
+ SliverSafeArea(
+ top: false,
+ sliver: SliverPadding(
+ padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
+ sliver: SliverList.list(children: contents),
+ ),
),
],
- ),
+ );
+ },
+ );
+ }
+
+ Widget _buildSearchAction(BuildContext context) {
+ return IconButtonComponent(
+ variant: IconButtonComponentVariant.primary,
+ shouldSurfaceExecutionStates: false,
+ onTap: () => _openSearch(context),
+ icon: const HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: IconSizes.small,
+ strokeWidth: 1.75,
),
);
}
+
+ void _openSearch(BuildContext context) {
+ Navigator.of(
+ context,
+ ).push(MaterialPageRoute(builder: (context) => const SettingsSearchPage()));
+ }
+
+ void _showVerifyIDSheet(BuildContext context) {
+ showVerifyIdentitySheet(
+ context,
+ self: true,
+ config: Configuration.instance,
+ title: context.strings.verifyIDLabel,
+ );
+ }
}
diff --git a/mobile/apps/locker/lib/ui/drawer/drawer_title_bar_widget.dart b/mobile/apps/locker/lib/ui/drawer/drawer_title_bar_widget.dart
deleted file mode 100644
index a88b976311..0000000000
--- a/mobile/apps/locker/lib/ui/drawer/drawer_title_bar_widget.dart
+++ /dev/null
@@ -1,51 +0,0 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-import "package:locker/ui/settings/pages/settings_search_page.dart";
-
-class DrawerTitleBarWidget extends StatelessWidget {
- const DrawerTitleBarWidget({super.key, required this.scaffoldKey});
-
- final GlobalKey<ScaffoldState> scaffoldKey;
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return Container(
- padding: const EdgeInsets.symmetric(vertical: 4),
- child: Padding(
- padding: const EdgeInsets.fromLTRB(8, 0, 12, 0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- IconButton(
- visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
- onPressed: () {
- scaffoldKey.currentState?.closeDrawer();
- },
- icon: const Icon(Icons.keyboard_double_arrow_left_outlined),
- tooltip: "Close",
- ),
- IconButton(
- visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
- onPressed: () => _openSearch(context),
- icon: HugeIcon(
- icon: HugeIcons.strokeRoundedSearch01,
- color: colorScheme.textBase,
- size: 20,
- strokeWidth: 1.75,
- ),
- ),
- ],
- ),
- ),
- );
- }
-
- void _openSearch(BuildContext context) {
- Navigator.of(
- context,
- ).push(MaterialPageRoute(builder: (context) => const SettingsSearchPage()));
- }
-}
diff --git a/mobile/apps/locker/lib/ui/pages/home_page.dart b/mobile/apps/locker/lib/ui/pages/home_page.dart
index 5fe65765fa..f018f16a6b 100644
--- a/mobile/apps/locker/lib/ui/pages/home_page.dart
+++ b/mobile/apps/locker/lib/ui/pages/home_page.dart
@@ -3,6 +3,7 @@ import 'dart:io';
import "package:app_links/app_links.dart";
import "package:ente_accounts/services/user_service.dart";
+import "package:ente_components/ente_components.dart";
import 'package:ente_events/event_bus.dart';
import "package:ente_events/models/trigger_logout_event.dart";
import "package:ente_ui/components/alert_bottom_sheet.dart";
@@ -612,6 +613,7 @@ class _HomePageState extends UploaderPageState<HomePage>
@override
Widget build(BuildContext context) {
final colorScheme = getEnteColorScheme(context);
+ final componentColors = context.componentColors;
return UserDetailsStateWidget(
child: ListenableBuilder(
listenable: _selectedFiles,
@@ -647,7 +649,7 @@ class _HomePageState extends UploaderPageState<HomePage>
backgroundColor: colorScheme.backgroundBase,
drawer: Drawer(
width: 428,
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: componentColors.backgroundBase,
child: _settingsPage,
),
drawerEnableOpenDragGesture: true,
diff --git a/mobile/apps/locker/lib/ui/settings/components/settings_item.dart b/mobile/apps/locker/lib/ui/settings/components/settings_item.dart
new file mode 100644
index 0000000000..65a395ad88
--- /dev/null
+++ b/mobile/apps/locker/lib/ui/settings/components/settings_item.dart
@@ -0,0 +1,96 @@
+import "dart:async";
+
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+import "package:flutter_svg/flutter_svg.dart";
+import "package:hugeicons/hugeicons.dart";
+
+class SettingsItem extends StatelessWidget {
+ const SettingsItem({
+ super.key,
+ required this.title,
+ this.subtitle,
+ this.icon,
+ this.svgIconPath,
+ this.leading,
+ this.trailing,
+ this.onTap,
+ this.onDoubleTap,
+ this.showChevron = true,
+ this.isDestructive = false,
+ this.selected = false,
+ this.showOnlyLoadingState = false,
+ this.shouldSurfaceExecutionStates = false,
+ this.titleMaxLines = 2,
+ this.subtitleMaxLines = 1,
+ });
+
+ final String title;
+ final String? subtitle;
+ final List<List<dynamic>>? icon;
+ final String? svgIconPath;
+ final Widget? leading;
+ final Widget? trailing;
+ final FutureOr<void> Function()? onTap;
+ final FutureOr<void> Function()? onDoubleTap;
+ final bool showChevron;
+ final bool isDestructive;
+ final bool selected;
+ final bool showOnlyLoadingState;
+ final bool shouldSurfaceExecutionStates;
+ final int titleMaxLines;
+ final int subtitleMaxLines;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ final effectiveTextColor = isDestructive ? colors.warning : colors.textBase;
+ final effectiveIconColor = isDestructive
+ ? colors.warning
+ : colors.textLight;
+
+ return MenuComponent(
+ title: title,
+ subtitle: subtitle,
+ titleColor: effectiveTextColor,
+ iconColor: effectiveIconColor,
+ selected: selected,
+ leading: leading ?? _buildLeading(effectiveIconColor),
+ trailing: trailing ?? (showChevron ? _chevron(colors) : null),
+ showOnlyLoadingState: showOnlyLoadingState,
+ shouldSurfaceExecutionStates: shouldSurfaceExecutionStates,
+ titleMaxLines: titleMaxLines,
+ subtitleMaxLines: subtitleMaxLines,
+ onTap: onTap,
+ onDoubleTap: onDoubleTap,
+ );
+ }
+
+ Widget? _buildLeading(Color color) {
+ if (icon != null) {
+ return HugeIcon(
+ icon: icon!,
+ color: color,
+ size: IconSizes.small,
+ strokeWidth: 1.6,
+ );
+ }
+ if (svgIconPath != null) {
+ return SvgPicture.asset(
+ svgIconPath!,
+ colorFilter: ColorFilter.mode(color, BlendMode.srcIn),
+ width: IconSizes.small,
+ height: IconSizes.small,
+ );
+ }
+ return null;
+ }
+
+ Widget _chevron(ColorTokens colors) {
+ return Icon(
+ Icons.chevron_right_outlined,
+ color: colors.textLight,
+ size: IconSizes.medium,
+ );
+ }
+}
diff --git a/mobile/apps/locker/lib/ui/settings/components/settings_page_scaffold.dart b/mobile/apps/locker/lib/ui/settings/components/settings_page_scaffold.dart
new file mode 100644
index 0000000000..03a11c02f3
--- /dev/null
+++ b/mobile/apps/locker/lib/ui/settings/components/settings_page_scaffold.dart
@@ -0,0 +1,57 @@
+import "package:ente_components/ente_components.dart";
+import "package:flutter/material.dart";
+
+class SettingsPageScaffold extends StatelessWidget {
+ const SettingsPageScaffold({
+ super.key,
+ required this.title,
+ required this.children,
+ this.subtitle,
+ this.actions = const [],
+ this.controller,
+ this.onTitleTap,
+ this.onTitleDoubleTap,
+ this.onTitleLongPress,
+ this.bottomNavigationBar,
+ this.padding = const EdgeInsets.fromLTRB(16, 0, 16, 16),
+ });
+
+ final String title;
+ final String? subtitle;
+ final List<Widget> actions;
+ final List<Widget> children;
+ final ScrollController? controller;
+ final VoidCallback? onTitleTap;
+ final VoidCallback? onTitleDoubleTap;
+ final VoidCallback? onTitleLongPress;
+ final Widget? bottomNavigationBar;
+ final EdgeInsetsGeometry padding;
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+
+ return Scaffold(
+ backgroundColor: colors.backgroundBase,
+ bottomNavigationBar: bottomNavigationBar,
+ body: AppBarComponent(
+ title: title,
+ subtitle: subtitle,
+ actions: actions,
+ controller: controller,
+ onTitleTap: onTitleTap,
+ onTitleDoubleTap: onTitleDoubleTap,
+ onTitleLongPress: onTitleLongPress,
+ slivers: [
+ SliverSafeArea(
+ top: false,
+ sliver: SliverPadding(
+ padding: padding,
+ sliver: SliverList.list(children: children),
+ ),
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/mobile/apps/locker/lib/ui/settings/language_selector_page.dart b/mobile/apps/locker/lib/ui/settings/language_selector_page.dart
index 621ce59689..13f2f7f9eb 100644
--- a/mobile/apps/locker/lib/ui/settings/language_selector_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/language_selector_page.dart
@@ -1,14 +1,10 @@
+import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
-import "package:ente_ui/components/captioned_text_widget.dart";
-import "package:ente_ui/components/divider_widget.dart";
-import "package:ente_ui/components/menu_item_widget.dart";
-import "package:ente_ui/components/separators.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/components/title_bar_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:locker/l10n/l10n.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
class LanguageSelectorPage extends StatelessWidget {
final List<Locale> supportedLocales;
@@ -24,41 +20,12 @@ class LanguageSelectorPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Scaffold(
- body: CustomScrollView(
- primary: false,
- slivers: <Widget>[
- TitleBarWidget(
- flexibleSpaceTitle: TitleBarTitleWidget(
- title: context.l10n.selectLanguage,
- ),
- ),
- SliverList(
- delegate: SliverChildBuilderDelegate((context, index) {
- return Padding(
- padding: const EdgeInsets.symmetric(
- horizontal: 16,
- vertical: 20,
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(8)),
- child: _LanguageItemsWidget(
- supportedLocales,
- onLocaleChanged,
- currentLocale,
- ),
- ),
- ],
- ),
- );
- }, childCount: 1),
- ),
- const SliverPadding(padding: EdgeInsets.symmetric(vertical: 12)),
- ],
- ),
+ return SettingsPageScaffold(
+ title: context.l10n.selectLanguage,
+ children: [
+ _LanguageItemsWidget(supportedLocales, onLocaleChanged, currentLocale),
+ const SizedBox(height: 24),
+ ],
);
}
}
@@ -89,31 +56,22 @@ class _LanguageItemsWidgetState extends State<_LanguageItemsWidget> {
@override
Widget build(BuildContext context) {
- List<Widget> items = [];
- for (Locale locale in widget.supportedLocales) {
- items.add(_menuItemForPicker(locale));
- }
- items = addSeparators(
- items,
- DividerWidget(
- dividerType: DividerType.menuNoIcon,
- bgColor: getEnteColorScheme(context).fillFaint,
- ),
+ return MenuGroupComponent(
+ items: [
+ for (final locale in widget.supportedLocales)
+ _menuItemForPicker(locale),
+ ],
);
- return Column(mainAxisSize: MainAxisSize.min, children: items);
}
Widget _menuItemForPicker(Locale locale) {
- return MenuItemWidget(
+ return SettingsItem(
key: ValueKey(locale.toString()),
- menuItemColor: getEnteColorScheme(context).fillFaint,
- captionedTextWidget: CaptionedTextWidget(
- title: getLocaleDisplayName(locale) + (kDebugMode ? ' ($locale)' : ''),
- ),
- trailingIcon: currentLocale == locale ? Icons.check : null,
- alignCaptionedTextToLeft: true,
- isTopBorderRadiusRemoved: true,
- isBottomBorderRadiusRemoved: true,
+ title: getLocaleDisplayName(locale) + (kDebugMode ? ' ($locale)' : ''),
+ showChevron: false,
+ trailing: currentLocale == locale
+ ? Icon(Icons.check, color: context.componentColors.primary)
+ : null,
showOnlyLoadingState: true,
onTap: () async {
widget.onLocaleChanged(locale);
diff --git a/mobile/apps/locker/lib/ui/settings/pages/about_page.dart b/mobile/apps/locker/lib/ui/settings/pages/about_page.dart
index ffcbed6306..7ecee43723 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/about_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/about_page.dart
@@ -1,13 +1,12 @@
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/utils/dialog_util.dart";
import "package:ente_ui/utils/toast_util.dart";
import "package:ente_utils/platform_util.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/update_service.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
import "package:locker/ui/settings/widgets/app_update_dialog.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
import "package:url_launcher/url_launcher.dart";
class AboutPage extends StatelessWidget {
@@ -16,59 +15,57 @@ class AboutPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
+ return SettingsPageScaffold(
+ title: l10n.about,
+ children: [
+ SettingsItem(
+ title: l10n.weAreOpenSource,
+ icon: HugeIcons.strokeRoundedGithub,
+ showOnlyLoadingState: true,
+ onTap: () => _onOpenSourceTapped(),
),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.about),
- const SizedBox(height: 24),
- SettingsItem(
- title: l10n.weAreOpenSource,
- onTap: () => _onOpenSourceTapped(),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.privacy,
- onTap: () => _onPrivacyTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.termsOfServicesTitle,
- onTap: () => _onTermsTapped(context),
- ),
- if (UpdateService.instance.isIndependent()) ...[
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.checkForUpdates,
- onTap: () => _onCheckForUpdatesTapped(context),
- ),
- ],
- ],
- ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.blog,
+ icon: HugeIcons.strokeRoundedPencilEdit01,
+ showOnlyLoadingState: true,
+ onTap: () => _onBlogTapped(context),
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.privacy,
+ icon: HugeIcons.strokeRoundedShield01,
+ showOnlyLoadingState: true,
+ onTap: () => _onPrivacyTapped(context),
),
- ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.termsOfServicesTitle,
+ icon: HugeIcons.strokeRoundedFile01,
+ showOnlyLoadingState: true,
+ onTap: () => _onTermsTapped(context),
+ ),
+ if (UpdateService.instance.isIndependent()) ...[
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.checkForUpdates,
+ icon: HugeIcons.strokeRoundedDownload04,
+ showOnlyLoadingState: true,
+ onTap: () => _onCheckForUpdatesTapped(context),
+ ),
+ ],
+ ],
);
}
- void _onOpenSourceTapped() {
- // ignore: unawaited_futures
- launchUrl(Uri.parse("https://github.com/ente-io/ente"));
+ Future<void> _onOpenSourceTapped() async {
+ await launchUrl(Uri.parse("https://github.com/ente-io/ente"));
+ }
+
+ Future<void> _onBlogTapped(BuildContext context) async {
+ final l10n = context.l10n;
+ await PlatformUtil.openWebView(context, l10n.blog, "https://ente.com/blog");
}
Future<void> _onPrivacyTapped(BuildContext context) async {
@@ -91,11 +88,8 @@ class AboutPage extends StatelessWidget {
Future<void> _onCheckForUpdatesTapped(BuildContext context) async {
final l10n = context.l10n;
- final dialog = createProgressDialog(context, l10n.checkingForUpdates);
- await dialog.show();
final shouldUpdate = await UpdateService.instance.shouldUpdate();
final latestVersion = UpdateService.instance.getLatestVersionInfo();
- await dialog.hide();
if (!context.mounted) {
return;
}
diff --git a/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart
index 85a335a248..4222a02a81 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/account_settings_page.dart
@@ -1,18 +1,21 @@
import "package:ente_accounts/pages/change_email_dialog.dart";
import "package:ente_accounts/pages/password_entry_page.dart";
+import "package:ente_components/ente_components.dart";
import "package:ente_crypto_api/ente_crypto_api.dart";
import "package:ente_lock_screen/local_authentication_service.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_strings/extensions.dart";
import "package:ente_ui/utils/dialog_util.dart";
+import "package:ente_utils/email_util.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/configuration.dart";
import "package:locker/ui/components/recovery_key_sheet.dart";
import "package:locker/ui/pages/delete_account_page.dart";
import "package:locker/ui/pages/home_page.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
class AccountSettingsPage extends StatelessWidget {
const AccountSettingsPage({super.key});
@@ -20,52 +23,38 @@ class AccountSettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
+ return SettingsPageScaffold(
+ title: l10n.account,
+ children: [
+ SettingsItem(
+ title: l10n.changeEmail,
+ icon: HugeIcons.strokeRoundedMail01,
+ showOnlyLoadingState: true,
+ onTap: () => _onChangeEmailTapped(context),
),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.account),
- const SizedBox(height: 24),
- SettingsItem(
- title: l10n.changeEmail,
- onTap: () => _onChangeEmailTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.recoveryKey,
- onTap: () => _onRecoveryKeyTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.changePassword,
- onTap: () => _onChangePasswordTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.deleteAccount,
- textColor: colorScheme.warning500,
- onTap: () => _onDeleteAccountTapped(context),
- ),
- ],
- ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.recoveryKey,
+ icon: HugeIcons.strokeRoundedKey01,
+ showOnlyLoadingState: true,
+ onTap: () => _onRecoveryKeyTapped(context),
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.changePassword,
+ icon: HugeIcons.strokeRoundedLockPassword,
+ showOnlyLoadingState: true,
+ onTap: () => _onChangePasswordTapped(context),
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.deleteAccount,
+ icon: HugeIcons.strokeRoundedDelete02,
+ isDestructive: true,
+ onTap: () => _onDeleteAccountTapped(context),
),
- ),
+ ],
);
}
@@ -90,8 +79,20 @@ class AccountSettingsPage extends StatelessWidget {
Configuration.instance.getRecoveryKey(),
);
} catch (e) {
- // ignore: unawaited_futures
- showGenericErrorBottomSheet(context: context, error: e);
+ await showErrorBottomSheetComponent<void>(
+ context: context,
+ message: parseErrorForUI(
+ context,
+ context.strings.itLooksLikeSomethingWentWrongPleaseRetryAfterSome,
+ error: e,
+ surfaceError: false,
+ ),
+ title: context.strings.error,
+ actionLabel: context.strings.contactSupport,
+ onActionTap: () async {
+ await sendLogs(context, "[email protected]", postShare: () {});
+ },
+ );
return;
}
await showRecoveryKeySheet(context, recoveryKey: recoveryKey);
diff --git a/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart
index 7ae23760a6..3a42234ee0 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/general_settings_page.dart
@@ -1,11 +1,11 @@
-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:hugeicons/hugeicons.dart";
import "package:locker/app.dart";
import "package:locker/core/locale.dart";
import "package:locker/l10n/l10n.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
import "package:locker/ui/settings/language_selector_page.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
class GeneralSettingsPage extends StatelessWidget {
const GeneralSettingsPage({super.key});
@@ -13,36 +13,16 @@ class GeneralSettingsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
+ return SettingsPageScaffold(
+ title: l10n.general,
+ children: [
+ SettingsItem(
+ title: l10n.selectLanguage,
+ icon: HugeIcons.strokeRoundedLanguageSquare,
+ onTap: () => _onLanguageTapped(context),
),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.general),
- const SizedBox(height: 24),
- SettingsItem(
- title: l10n.selectLanguage,
- onTap: () => _onLanguageTapped(context),
- ),
- ],
- ),
- ),
- ),
+ ],
);
}
diff --git a/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart
index 70d795d545..0e60759c41 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/security_settings_page.dart
@@ -5,21 +5,18 @@ import "package:ente_accounts/pages/request_pwd_verification_page.dart";
import "package:ente_accounts/pages/sessions_page.dart";
import "package:ente_accounts/services/passkey_service.dart";
import "package:ente_accounts/services/user_service.dart";
+import "package:ente_components/ente_components.dart";
import "package:ente_crypto_api/ente_crypto_api.dart";
import "package:ente_lock_screen/local_authentication_service.dart";
import "package:ente_lock_screen/lock_screen_settings.dart";
import "package:ente_lock_screen/ui/lock_screen_options.dart";
-import "package:ente_ui/components/alert_bottom_sheet.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/components/toggle_switch_widget.dart";
-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:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/configuration.dart";
-import "package:locker/ui/components/gradient_button.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
import "package:logging/logging.dart";
class SecuritySettingsPage extends StatefulWidget {
@@ -43,43 +40,22 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
-
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
- ),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.security),
- const SizedBox(height: 24),
- if (_hasLoggedIn) ...[
- _buildEmailVerificationItem(context),
- const SizedBox(height: 12),
- _buildPasskeyItem(context),
- const SizedBox(height: 12),
- ],
- _buildAppLockItem(context),
- if (_hasLoggedIn) ...[
- const SizedBox(height: 12),
- _buildActiveSessionsItem(context),
- ],
- ],
- ),
- ),
- ),
+
+ return SettingsPageScaffold(
+ title: l10n.security,
+ children: [
+ if (_hasLoggedIn) ...[
+ _buildEmailVerificationItem(context),
+ const SizedBox(height: 8),
+ _buildPasskeyItem(context),
+ const SizedBox(height: 8),
+ ],
+ _buildAppLockItem(context),
+ if (_hasLoggedIn) ...[
+ const SizedBox(height: 8),
+ _buildActiveSessionsItem(context),
+ ],
+ ],
);
}
@@ -88,8 +64,9 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
return SettingsItem(
title: l10n.emailVerificationToggle,
+ icon: HugeIcons.strokeRoundedMailSecure01,
showChevron: false,
- trailing: ToggleSwitchWidget(
+ trailing: ToggleSwitchComponent.async(
value: () => UserService.instance.hasEmailMFAEnabled(),
onChanged: () => _onEmailMFAToggle(context),
),
@@ -112,6 +89,8 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final l10n = context.l10n;
return SettingsItem(
title: l10n.passkey,
+ icon: HugeIcons.strokeRoundedFingerAccess,
+ showOnlyLoadingState: true,
onTap: () => _onPasskeyClick(context),
);
}
@@ -120,6 +99,8 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final l10n = context.l10n;
return SettingsItem(
title: l10n.viewActiveSessions,
+ icon: HugeIcons.strokeRoundedSmartPhone01,
+ showOnlyLoadingState: true,
onTap: () async {
final hasAuthenticated = await LocalAuthenticationService.instance
.requestLocalAuthentication(
@@ -144,6 +125,8 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
final l10n = context.l10n;
return SettingsItem(
title: l10n.appLock,
+ icon: HugeIcons.strokeRoundedSquareLock02,
+ showOnlyLoadingState: true,
onTap: () => _onAppLockTapped(context),
);
}
@@ -166,19 +149,24 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
);
}
} else {
- await showAlertBottomSheet(
- context,
- title: l10n.noSystemLockFound,
- message: l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen,
- assetPath: "assets/warning-grey.png",
- buttons: [
- GradientButton(
- text: context.l10n.contactSupport,
- onTap: () async {
- await sendLogs(context, "[email protected]", postShare: () {});
- },
- ),
- ],
+ await showBottomSheetComponent<void>(
+ context: context,
+ builder: (sheetContext) => BottomSheetComponent(
+ title: l10n.noSystemLockFound,
+ message: l10n.toEnableAppLockPleaseSetupDevicePasscodeOrScreen,
+ illustration: Image.asset("assets/warning-grey.png"),
+ actions: [
+ ButtonComponent(
+ label: context.l10n.contactSupport,
+ onTap: () async {
+ await sendLogs(context, "[email protected]", postShare: () {});
+ if (sheetContext.mounted) {
+ Navigator.of(sheetContext).pop();
+ }
+ },
+ ),
+ ],
+ ),
);
}
}
@@ -210,7 +198,11 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
await PasskeyService.instance.openPasskeyPage(buildContext);
} catch (e, s) {
_logger.severe("failed to open passkey page", e, s);
- await showGenericErrorBottomSheet(context: context, error: e);
+ await showErrorBottomSheetComponent<void>(
+ context: context,
+ message: e.toString(),
+ title: context.l10n.somethingWentWrong,
+ );
}
}
@@ -241,7 +233,11 @@ class _SecuritySettingsPageState extends State<SecuritySettingsPage> {
}
await UserService.instance.updateEmailMFA(isEnabled);
} catch (e) {
- await showGenericErrorBottomSheet(context: context, error: e);
+ await showErrorBottomSheetComponent<void>(
+ context: context,
+ message: e.toString(),
+ title: context.l10n.somethingWentWrong,
+ );
}
}
}
diff --git a/mobile/apps/locker/lib/ui/settings/pages/settings_search_page.dart b/mobile/apps/locker/lib/ui/settings/pages/settings_search_page.dart
index ac61f2aeb1..edf91964cb 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/settings_search_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/settings_search_page.dart
@@ -2,24 +2,20 @@ import "dart:async";
import "dart:io";
import "package:ente_accounts/services/user_service.dart";
-import "package:ente_ui/components/alert_bottom_sheet.dart";
-import "package:ente_ui/components/buttons/gradient_button.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:ente_components/ente_components.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/configuration.dart";
import "package:locker/services/update_service.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
import "package:locker/ui/settings/pages/about_page.dart";
import "package:locker/ui/settings/pages/account_settings_page.dart";
import "package:locker/ui/settings/pages/general_settings_page.dart";
import "package:locker/ui/settings/pages/security_settings_page.dart";
import "package:locker/ui/settings/pages/support_page.dart";
import "package:locker/ui/settings/pages/theme_settings_page.dart";
-import "package:locker/ui/settings/widgets/suggestion_chip.dart";
class SettingsSearchPage extends StatefulWidget {
const SettingsSearchPage({super.key});
@@ -137,49 +133,49 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
page: const SupportPage(),
),
_SearchableSetting(
- title: l10n.contactSupport,
+ title: l10n.askAQuestion,
category: l10n.helpAndSupport,
page: const SupportPage(),
),
_SearchableSetting(
- title: l10n.help,
+ title: l10n.requestAFeature,
category: l10n.helpAndSupport,
page: const SupportPage(),
),
_SearchableSetting(
- title: l10n.suggestFeatures,
+ title: l10n.reportAnIssue,
category: l10n.helpAndSupport,
page: const SupportPage(),
),
_SearchableSetting(
- title: l10n.reportABug,
- category: l10n.helpAndSupport,
- page: const SupportPage(),
+ title: l10n.about,
+ category: l10n.about,
+ page: const AboutPage(),
),
_SearchableSetting(
- title: l10n.aboutUs,
- category: l10n.aboutUs,
+ title: l10n.weAreOpenSource,
+ category: l10n.about,
page: const AboutPage(),
),
_SearchableSetting(
- title: l10n.weAreOpenSource,
- category: l10n.aboutUs,
+ title: l10n.blog,
+ category: l10n.about,
page: const AboutPage(),
),
_SearchableSetting(
title: l10n.privacy,
- category: l10n.aboutUs,
+ category: l10n.about,
page: const AboutPage(),
),
_SearchableSetting(
title: l10n.termsOfServicesTitle,
- category: l10n.aboutUs,
+ category: l10n.about,
page: const AboutPage(),
),
if (UpdateService.instance.isIndependent())
_SearchableSetting(
title: l10n.checkForUpdates,
- category: l10n.aboutUs,
+ category: l10n.about,
page: const AboutPage(),
),
if (hasLoggedIn)
@@ -238,103 +234,54 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
return words.any((word) => word.startsWith(query));
}
- void _onSettingTapped(_SearchableSetting setting) {
+ Future<void> _onSettingTapped(_SearchableSetting setting) async {
if (setting.onTap != null) {
setting.onTap!();
} else if (setting.page != null) {
- Navigator.of(
+ await Navigator.of(
context,
).push(MaterialPageRoute(builder: (_) => setting.page!));
}
}
void _onLogoutTapped() {
- showAlertBottomSheet(
- context,
- title: context.l10n.warning,
- message: context.l10n.areYouSureYouWantToLogout,
- assetPath: "assets/warning-grey.png",
- buttons: [
- GradientButton(
- buttonType: GradientButtonType.critical,
- text: context.l10n.yesLogout,
- onTap: () async {
- await UserService.instance.logout(context);
- },
- ),
- ],
+ showBottomSheetComponent<void>(
+ context: context,
+ builder: (sheetContext) => BottomSheetComponent(
+ title: context.l10n.warning,
+ message: context.l10n.areYouSureYouWantToLogout,
+ illustration: Image.asset("assets/warning-grey.png"),
+ actions: [
+ ButtonComponent(
+ label: context.l10n.yesLogout,
+ variant: ButtonComponentVariant.critical,
+ onTap: () async {
+ await UserService.instance.logout(context);
+ if (sheetContext.mounted) {
+ Navigator.of(sheetContext).pop();
+ }
+ },
+ ),
+ ],
+ ),
);
}
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
- final l10n = context.l10n;
+ final colors = context.componentColors;
return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
+ backgroundColor: colors.backgroundBase,
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 0),
- child: Container(
- height: 48,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: BorderRadius.circular(16),
- ),
- padding: const EdgeInsets.only(left: 8, right: 16),
- child: Row(
- children: [
- Padding(
- padding: const EdgeInsets.all(8),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedSearch01,
- color: colorScheme.textMuted,
- size: 20,
- strokeWidth: 1.75,
- ),
- ),
- Expanded(
- child: TextField(
- controller: _searchController,
- focusNode: _focusNode,
- onChanged: _onSearchChanged,
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
- ),
- decoration: InputDecoration(
- hintText: l10n.searchSettings,
- hintStyle: textTheme.small.copyWith(
- color: colorScheme.textMuted,
- ),
- border: InputBorder.none,
- contentPadding: EdgeInsets.zero,
- isDense: true,
- ),
- ),
- ),
- GestureDetector(
- onTap: () => Navigator.of(context).pop(),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: colorScheme.textMuted,
- size: 20,
- strokeWidth: 1.75,
- ),
- ),
- ],
- ),
- ),
- ),
- const SizedBox(height: 24),
+ _buildSearchBar(),
Expanded(
child: _searchQuery.isEmpty
- ? _buildSuggestions(colorScheme, textTheme, l10n)
- : _buildSearchResults(colorScheme, textTheme),
+ ? _buildSuggestions()
+ : _buildSearchResults(),
),
],
),
@@ -342,29 +289,71 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
);
}
- Widget _buildSuggestions(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- AppLocalizations l10n,
- ) {
+ Widget _buildSearchBar() {
+ final colors = context.componentColors;
return Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
+ child: TextInputComponent(
+ controller: _searchController,
+ focusNode: _focusNode,
+ hintText: context.l10n.searchSettings,
+ onChanged: _onSearchChanged,
+ prefix: HugeIcon(
+ icon: HugeIcons.strokeRoundedSearch01,
+ size: 20,
+ color: colors.textLight,
+ strokeWidth: 1.6,
+ ),
+ suffix: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: _searchController.text.isNotEmpty
+ ? _clearSearch
+ : () => Navigator.of(context).pop(),
+ child: SizedBox.square(
+ dimension: 24,
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ size: 18,
+ color: colors.textLight,
+ strokeWidth: 1.6,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+
+ void _clearSearch() {
+ _searchController.clear();
+ _debounceTimer?.cancel();
+ setState(() {
+ _searchQuery = "";
+ _searchResults = [];
+ });
+ }
+
+ Widget _buildSuggestions() {
+ return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
+ const SizedBox(height: 8),
Text(
- l10n.suggestions,
- style: textTheme.small.copyWith(color: colorScheme.textBase),
+ context.l10n.suggestions,
+ style: TextStyles.bodyBold.copyWith(
+ color: context.componentColors.textBase,
+ ),
),
- const SizedBox(height: 13),
+ const SizedBox(height: 12),
Wrap(
spacing: 8,
runSpacing: 8,
children: _suggestions
.map(
- (setting) => SuggestionChip(
+ (setting) => FilterChipComponent(
label: setting.title,
- onTap: () => _onSettingTapped(setting),
+ onChanged: (_) => _onSettingTapped(setting),
),
)
.toList(),
@@ -374,15 +363,17 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
);
}
- Widget _buildSearchResults(
- EnteColorScheme colorScheme,
- EnteTextTheme textTheme,
- ) {
+ Widget _buildSearchResults() {
if (_searchResults.isEmpty) {
return Center(
- child: Text(
- context.l10n.noResultsFound,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ child: Padding(
+ padding: const EdgeInsets.all(32),
+ child: Text(
+ context.l10n.noResultsFound,
+ style: TextStyles.body.copyWith(
+ color: context.componentColors.textLight,
+ ),
+ ),
),
);
}
@@ -393,43 +384,11 @@ class _SettingsSearchPageState extends State<SettingsSearchPage> {
separatorBuilder: (context, index) => const SizedBox(height: 8),
itemBuilder: (context, index) {
final setting = _searchResults[index];
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
+ return SettingsItem(
+ title: setting.title,
+ subtitle: setting.title != setting.category ? setting.category : null,
+ showOnlyLoadingState: true,
onTap: () => _onSettingTapped(setting),
- child: Container(
- height: 56,
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: BorderRadius.circular(20),
- ),
- padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- setting.title,
- style: textTheme.small.copyWith(
- color: colorScheme.textBase,
- ),
- ),
- if (setting.title != setting.category)
- Text(
- setting.category,
- style: textTheme.mini.copyWith(
- color: colorScheme.textMuted,
- ),
- ),
- ],
- ),
- ),
- Icon(Icons.chevron_right, color: colorScheme.textMuted),
- ],
- ),
- ),
);
},
);
diff --git a/mobile/apps/locker/lib/ui/settings/pages/support_page.dart b/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
index 01fd34b54b..5937ac323e 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/support_page.dart
@@ -1,82 +1,171 @@
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
+import "package:ente_logging/logging.dart";
+import "package:ente_strings/extensions.dart";
+import "package:ente_ui/pages/log_file_viewer.dart";
+import "package:ente_ui/utils/toast_util.dart";
import "package:ente_utils/email_util.dart";
import "package:ente_utils/platform_util.dart";
+import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/core/constants.dart";
import "package:locker/l10n/l10n.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
import "package:url_launcher/url_launcher_string.dart";
class SupportPage extends StatelessWidget {
+ static final _logger = Logger("SupportPage");
+ static const _helpUrl = "https://ente.com/help/locker";
+ static const _lockerFaqBaseUrl = "https://ente.com/help/locker/faq";
+ static const _gettingStartedFaqUrl = "$_lockerFaqBaseUrl/getting-started";
+ static const _informationTypesFaqUrl = "$_lockerFaqBaseUrl/information-types";
+ static const _organizationFaqUrl = "$_lockerFaqBaseUrl/organization";
+ static const _legacyFaqUrl = "$_lockerFaqBaseUrl/legacy";
+ static const _securityFaqUrl = "$_lockerFaqBaseUrl/security";
+ static const _troubleshootingFaqUrl = "$_lockerFaqBaseUrl/troubleshooting";
+
const SupportPage({super.key});
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
+ return SettingsPageScaffold(
+ title: l10n.helpAndSupport,
+ children: [
+ _sectionTitle(context, l10n.getInTouch),
+ SettingsItem(
+ title: l10n.askAQuestion,
+ icon: HugeIcons.strokeRoundedHelpCircle,
+ showOnlyLoadingState: true,
+ onTap: () => _onAskQuestionTapped(context),
),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.support),
- const SizedBox(height: 24),
- SettingsItem(
- title: l10n.contactSupport,
- onTap: () => _onContactSupportTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.help,
- onTap: () => _onHelpTapped(context),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.suggestFeatures,
- onTap: () => _onSuggestFeaturesTapped(),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.reportABug,
- onTap: () => _onReportBugTapped(context),
- ),
- ],
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.requestAFeature,
+ icon: HugeIcons.strokeRoundedIdea01,
+ showOnlyLoadingState: true,
+ onTap: () => _onRequestFeatureTapped(),
+ ),
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: l10n.reportAnIssue,
+ icon: HugeIcons.strokeRoundedBug01,
+ showOnlyLoadingState: true,
+ onTap: () => _onReportIssueTapped(context),
+ ),
+ if (kDebugMode) ...[
+ const SizedBox(height: 8),
+ SettingsItem(
+ title: context.strings.viewLogs,
+ icon: HugeIcons.strokeRoundedNote01,
+ showOnlyLoadingState: true,
+ onTap: () => _viewLogs(context),
),
+ ],
+ _SupportLink(
+ label: context.strings.exportLogs,
+ onTap: () => _exportLogs(context),
+ ),
+ const SizedBox(height: 24),
+ _sectionTitle(context, l10n.browseHelpPages),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.gettingStarted,
+ subText: l10n.gettingStartedDesc,
+ icon: HugeIcons.strokeRoundedRocket01,
+ faqUrl: _gettingStartedFaqUrl,
+ ),
+ const SizedBox(height: 8),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.informationTypes,
+ subText: l10n.informationTypesDesc,
+ icon: HugeIcons.strokeRoundedFile01,
+ faqUrl: _informationTypesFaqUrl,
+ ),
+ const SizedBox(height: 8),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.organization,
+ subText: l10n.organizationDesc,
+ icon: HugeIcons.strokeRoundedWallet05,
+ faqUrl: _organizationFaqUrl,
+ ),
+ const SizedBox(height: 8),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.legacy,
+ subText: l10n.legacyDesc,
+ icon: HugeIcons.strokeRoundedFavourite,
+ faqUrl: _legacyFaqUrl,
+ ),
+ const SizedBox(height: 8),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.security,
+ subText: l10n.securityDesc,
+ icon: HugeIcons.strokeRoundedSecurityCheck,
+ faqUrl: _securityFaqUrl,
),
+ const SizedBox(height: 8),
+ _buildHelpTopicItem(
+ context,
+ title: l10n.troubleshooting,
+ subText: l10n.troubleshootingDesc,
+ icon: HugeIcons.strokeRoundedWrench01,
+ faqUrl: _troubleshootingFaqUrl,
+ ),
+ _SupportLink(
+ label: l10n.viewAllHelpTopics,
+ onTap: () => _openHelpPage(context, title: l10n.helpAndSupport),
+ ),
+ const SizedBox(height: 24),
+ ],
+ );
+ }
+
+ Widget _sectionTitle(BuildContext context, String title) {
+ final colors = context.componentColors;
+ return Padding(
+ padding: const EdgeInsets.only(left: Spacing.sm, top: 6, bottom: 6),
+ child: Text(
+ title.toUpperCase(),
+ style: TextStyles.mini.copyWith(color: colors.textLight),
),
);
}
- Future<void> _onContactSupportTapped(BuildContext context) async {
- await sendEmail(context, to: supportEmail);
+ Widget _buildHelpTopicItem(
+ BuildContext context, {
+ required String title,
+ required String subText,
+ required List<List<dynamic>> icon,
+ required String faqUrl,
+ }) {
+ return SettingsItem(
+ title: title,
+ subtitle: subText,
+ subtitleMaxLines: 2,
+ icon: icon,
+ showOnlyLoadingState: true,
+ onTap: () => _openHelpPage(context, title: title, url: faqUrl),
+ );
}
- Future<void> _onHelpTapped(BuildContext context) async {
- final l10n = context.l10n;
- await PlatformUtil.openWebView(context, l10n.help, "https://ente.com/help");
+ Future<void> _onAskQuestionTapped(BuildContext context) async {
+ await sendEmail(context, to: supportEmail);
}
- void _onSuggestFeaturesTapped() {
- // ignore: unawaited_futures
- launchUrlString(githubDiscussionsUrl, mode: LaunchMode.externalApplication);
+ Future<void> _onRequestFeatureTapped() async {
+ await launchUrlString(
+ githubDiscussionsUrl,
+ mode: LaunchMode.externalApplication,
+ );
}
- Future<void> _onReportBugTapped(BuildContext context) async {
+ Future<void> _onReportIssueTapped(BuildContext context) async {
final l10n = context.l10n;
await sendLogs(
context,
@@ -84,4 +173,73 @@ class SupportPage extends StatelessWidget {
dialogBody: l10n.logsDialogBodyLocker,
);
}
+
+ Future<void> _openHelpPage(
+ BuildContext context, {
+ required String title,
+ String url = _helpUrl,
+ }) async {
+ await PlatformUtil.openWebView(context, title, url);
+ }
+
+ Future<void> _viewLogs(BuildContext context) async {
+ final logFile = SuperLogging.logFile;
+ if (logFile == null) {
+ showShortToast(context, context.l10n.somethingWentWrong);
+ return;
+ }
+ await Navigator.of(
+ context,
+ ).push(MaterialPageRoute(builder: (context) => LogFileViewer(logFile)));
+ }
+
+ Future<void> _exportLogs(BuildContext context) async {
+ try {
+ final zipFilePath = await getZippedLogsFile();
+ if (!context.mounted) {
+ return;
+ }
+ await exportLogs(context, zipFilePath);
+ } catch (e, s) {
+ _logger.severe("Failed to export logs", e, s);
+ if (context.mounted) {
+ showShortToast(context, context.l10n.somethingWentWrong);
+ }
+ }
+ }
+}
+
+class _SupportLink extends StatelessWidget {
+ final String label;
+ final Future<void> Function() onTap;
+
+ const _SupportLink({required this.label, required this.onTap});
+
+ @override
+ Widget build(BuildContext context) {
+ final colors = context.componentColors;
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: onTap,
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 12),
+ child: Row(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ Text(
+ label,
+ style: TextStyles.bodyBold.copyWith(color: colors.primary),
+ ),
+ const SizedBox(width: 4),
+ HugeIcon(
+ icon: HugeIcons.strokeRoundedArrowRight01,
+ color: colors.primary,
+ size: 16,
+ strokeWidth: 1.6,
+ ),
+ ],
+ ),
+ ),
+ );
+ }
}
diff --git a/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart b/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart
index cea8054256..48c69716e9 100644
--- a/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/pages/theme_settings_page.dart
@@ -1,9 +1,10 @@
import "package:adaptive_theme/adaptive_theme.dart";
-import "package:ente_ui/components/title_bar_title_widget.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
+import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
+import "package:locker/ui/settings/components/settings_page_scaffold.dart";
class ThemeSettingsPage extends StatefulWidget {
const ThemeSettingsPage({super.key});
@@ -29,58 +30,43 @@ class _ThemeSettingsPageState extends State<ThemeSettingsPage> {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
- return Scaffold(
- backgroundColor: colorScheme.backgroundBase,
- 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),
+ return SettingsPageScaffold(
+ title: l10n.theme,
+ children: [
+ MenuGroupComponent(
+ items: [
+ SettingsItem(
+ title: l10n.systemTheme,
+ icon: HugeIcons.strokeRoundedSmartPhone01,
+ showChevron: false,
+ trailing: currentThemeMode == AdaptiveThemeMode.system
+ ? Icon(Icons.check, color: colors.primary)
+ : null,
+ onTap: () => _setTheme(AdaptiveThemeMode.system),
+ ),
+ SettingsItem(
+ title: l10n.lightTheme,
+ icon: HugeIcons.strokeRoundedSun03,
+ showChevron: false,
+ trailing: currentThemeMode == AdaptiveThemeMode.light
+ ? Icon(Icons.check, color: colors.primary)
+ : null,
+ onTap: () => _setTheme(AdaptiveThemeMode.light),
+ ),
+ SettingsItem(
+ title: l10n.darkTheme,
+ icon: HugeIcons.strokeRoundedMoon02,
+ showChevron: false,
+ trailing: currentThemeMode == AdaptiveThemeMode.dark
+ ? Icon(Icons.check, color: colors.primary)
+ : null,
+ onTap: () => _setTheme(AdaptiveThemeMode.dark),
+ ),
+ ],
),
- ),
- body: SafeArea(
- child: Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- TitleBarTitleWidget(title: l10n.theme),
- const SizedBox(height: 24),
- SettingsItem(
- title: l10n.systemTheme,
- showChevron: false,
- trailing: currentThemeMode == AdaptiveThemeMode.system
- ? Icon(Icons.check, color: colorScheme.primary700)
- : null,
- onTap: () => _setTheme(AdaptiveThemeMode.system),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.lightTheme,
- showChevron: false,
- trailing: currentThemeMode == AdaptiveThemeMode.light
- ? Icon(Icons.check, color: colorScheme.primary700)
- : null,
- onTap: () => _setTheme(AdaptiveThemeMode.light),
- ),
- const SizedBox(height: 8),
- SettingsItem(
- title: l10n.darkTheme,
- showChevron: false,
- trailing: currentThemeMode == AdaptiveThemeMode.dark
- ? Icon(Icons.check, color: colorScheme.primary700)
- : null,
- onTap: () => _setTheme(AdaptiveThemeMode.dark),
- ),
- ],
- ),
- ),
- ),
+ ],
);
}
diff --git a/mobile/apps/locker/lib/ui/settings/settings_page.dart b/mobile/apps/locker/lib/ui/settings/settings_page.dart
index 7340f3035e..cc888a5c0b 100644
--- a/mobile/apps/locker/lib/ui/settings/settings_page.dart
+++ b/mobile/apps/locker/lib/ui/settings/settings_page.dart
@@ -1,13 +1,12 @@
import "dart:io";
import "package:ente_accounts/services/user_service.dart";
-import "package:ente_ui/components/alert_bottom_sheet.dart";
-import "package:ente_ui/components/buttons/gradient_button.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:locker/l10n/l10n.dart";
+import "package:locker/ui/settings/components/settings_item.dart";
import "package:locker/ui/settings/pages/about_page.dart";
import "package:locker/ui/settings/pages/account_settings_page.dart";
import "package:locker/ui/settings/pages/general_settings_page.dart";
@@ -15,7 +14,6 @@ import "package:locker/ui/settings/pages/security_settings_page.dart";
import "package:locker/ui/settings/pages/support_page.dart";
import "package:locker/ui/settings/pages/theme_settings_page.dart";
import "package:locker/ui/settings/widgets/app_version_widget.dart";
-import "package:locker/ui/settings/widgets/settings_widget.dart";
import "package:locker/ui/settings/widgets/social_icons_row.dart";
class SettingsWidget extends StatelessWidget {
@@ -82,7 +80,7 @@ class SettingsWidget extends StatelessWidget {
contents.add(
SettingsItem(
icon: HugeIcons.strokeRoundedInformationCircle,
- title: l10n.aboutUs,
+ title: l10n.about,
onTap: () => _navigateTo(context, const AboutPage()),
),
);
@@ -93,8 +91,7 @@ class SettingsWidget extends StatelessWidget {
SettingsItem(
icon: HugeIcons.strokeRoundedLogout05,
title: l10n.logout,
- iconColor: getEnteColorScheme(context).warning400,
- textColor: getEnteColorScheme(context).warning400,
+ isDestructive: true,
onTap: () => _onLogoutTapped(context),
),
);
@@ -122,20 +119,25 @@ class SettingsWidget extends StatelessWidget {
}
void _onLogoutTapped(BuildContext context) {
- showAlertBottomSheet(
- context,
- title: context.l10n.warning,
- message: context.l10n.areYouSureYouWantToLogout,
- assetPath: "assets/warning-grey.png",
- buttons: [
- GradientButton(
- buttonType: GradientButtonType.critical,
- text: context.l10n.yesLogout,
- onTap: () async {
- await UserService.instance.logout(context);
- },
- ),
- ],
+ showBottomSheetComponent<void>(
+ context: context,
+ builder: (sheetContext) => BottomSheetComponent(
+ title: context.l10n.warning,
+ message: context.l10n.areYouSureYouWantToLogout,
+ illustration: Image.asset("assets/warning-grey.png"),
+ actions: [
+ ButtonComponent(
+ label: context.l10n.yesLogout,
+ variant: ButtonComponentVariant.critical,
+ onTap: () async {
+ await UserService.instance.logout(context);
+ if (sheetContext.mounted) {
+ Navigator.of(sheetContext).pop();
+ }
+ },
+ ),
+ ],
+ ),
);
}
}
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/app_update_dialog.dart b/mobile/apps/locker/lib/ui/settings/widgets/app_update_dialog.dart
index 682ebcfc87..13447d7cf2 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/app_update_dialog.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/app_update_dialog.dart
@@ -1,10 +1,9 @@
import "dart:async";
-import "package:ente_ui/components/alert_bottom_sheet.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:locker/l10n/l10n.dart";
import "package:locker/services/update_service.dart";
-import "package:locker/ui/components/gradient_button.dart";
import "package:url_launcher/url_launcher_string.dart";
Future<void> showAppUpdateBottomSheet(
@@ -21,28 +20,31 @@ Future<void> showAppUpdateBottomSheet(
? l10n.criticalUpdateAvailable
: l10n.updateAvailable;
- await showAlertBottomSheet<void>(
- context,
- title: title,
- message: updateMessage,
- assetPath: "assets/warning-blue.png",
+ await showBottomSheetComponent<void>(
+ context: context,
isDismissible: !shouldForceUpdate,
- showCloseButton: !shouldForceUpdate,
- buttons: [
- GradientButton(
- text: l10n.downloadUpdate,
- onTap: () {
- unawaited(
- launchUrlString(
- latestVersionInfo.url,
- mode: LaunchMode.externalApplication,
- ),
- );
- if (!shouldForceUpdate) {
- navigator.pop();
- }
- },
- ),
- ],
+ enableDrag: !shouldForceUpdate,
+ builder: (_) => BottomSheetComponent(
+ title: title,
+ message: updateMessage,
+ illustration: Image.asset("assets/warning-blue.png"),
+ showCloseButton: !shouldForceUpdate,
+ actions: [
+ ButtonComponent(
+ label: l10n.downloadUpdate,
+ onTap: () {
+ unawaited(
+ launchUrlString(
+ latestVersionInfo.url,
+ mode: LaunchMode.externalApplication,
+ ),
+ );
+ if (!shouldForceUpdate) {
+ navigator.pop();
+ }
+ },
+ ),
+ ],
+ ),
);
}
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart b/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart
index 62596ea696..c08defb419 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/app_version_widget.dart
@@ -1,5 +1,6 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:ente_ui/utils/dialog_util.dart";
+import "dart:async";
+
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:package_info_plus/package_info_plus.dart";
@@ -22,8 +23,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
@override
Widget build(BuildContext context) {
- final textTheme = getEnteTextTheme(context);
- final colorScheme = getEnteColorScheme(context);
+ final colors = context.componentColors;
return GestureDetector(
behavior: HitTestBehavior.translucent,
@@ -33,15 +33,43 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
_kConsecutiveTapTimeWindowInMilliseconds) {
_consecutiveTaps++;
if (_consecutiveTaps == _kTapThresholdForInspector) {
- final dialog = createProgressDialog(
- context,
- "Starting network inspector...",
+ unawaited(
+ showBottomSheetComponent<void>(
+ context: context,
+ isDismissible: false,
+ enableDrag: false,
+ builder: (_) => BottomSheetComponent(
+ title: "Starting network inspector...",
+ showCloseButton: false,
+ content: Row(
+ children: [
+ SizedBox.square(
+ dimension: 20,
+ child: CircularProgressIndicator(
+ strokeWidth: 2,
+ color: colors.primary,
+ ),
+ ),
+ const SizedBox(width: 12),
+ Expanded(
+ child: Text(
+ "Please wait",
+ style: TextStyles.body.copyWith(
+ color: colors.textLight,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ ),
);
- await dialog.show();
await Future.delayed(
const Duration(milliseconds: _kDummyDelayDurationInMilliseconds),
);
- await dialog.hide();
+ if (context.mounted) {
+ Navigator.of(context).pop();
+ }
}
} else {
_consecutiveTaps = 1;
@@ -57,7 +85,7 @@ class _AppVersionWidgetState extends State<AppVersionWidget> {
child: Center(
child: Text(
"Version ${snapshot.data!}",
- style: textTheme.mini.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.mini.copyWith(color: colors.textLight),
),
),
);
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart b/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
index 90fc797b9c..6401714337 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/change_log_sheet.dart
@@ -1,7 +1,5 @@
-import "package:ente_ui/components/base_bottom_sheet.dart";
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
-import "package:locker/ui/components/gradient_button.dart";
import "package:locker/ui/settings/widgets/change_log_strings.dart";
class _ChangeLogEntry {
@@ -13,12 +11,18 @@ class _ChangeLogEntry {
Future<void> showChangeLogSheet(BuildContext context) {
final strings = ChangeLogStrings.forLocale(Localizations.localeOf(context));
- return showBaseBottomSheet<void>(
- context,
- title: strings.sheetTitle,
- showCloseButton: true,
- headerSpacing: 20,
- child: _ChangeLogSheetBody(strings: strings),
+ return showBottomSheetComponent<void>(
+ context: context,
+ builder: (sheetContext) => BottomSheetComponent(
+ title: strings.sheetTitle,
+ content: _ChangeLogSheetBody(strings: strings),
+ actions: [
+ ButtonComponent(
+ label: strings.continueLabel,
+ onTap: () => Navigator.of(sheetContext).pop(),
+ ),
+ ],
+ ),
);
}
@@ -29,8 +33,7 @@ class _ChangeLogSheetBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
final maxHeight = MediaQuery.sizeOf(context).height * 0.5;
final entries =
<_ChangeLogEntry>[
@@ -51,7 +54,7 @@ class _ChangeLogSheetBody extends StatelessWidget {
children: [
Text(
strings.sheetSubtitle,
- style: textTheme.body.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
const SizedBox(height: 16),
ConstrainedBox(
@@ -67,14 +70,6 @@ class _ChangeLogSheetBody extends StatelessWidget {
itemCount: entries.length,
),
),
- const SizedBox(height: 20),
- SizedBox(
- width: double.infinity,
- child: GradientButton(
- text: strings.continueLabel,
- onTap: () => Navigator.of(context).pop(),
- ),
- ),
],
);
}
@@ -87,14 +82,13 @@ class _ChangeLogEntryTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
+ final colors = context.componentColors;
return Container(
width: double.infinity,
padding: const EdgeInsets.all(14),
decoration: BoxDecoration(
- color: colorScheme.fillFaint,
+ color: colors.fillLight,
borderRadius: BorderRadius.circular(12),
),
child: Column(
@@ -102,12 +96,12 @@ class _ChangeLogEntryTile extends StatelessWidget {
children: [
Text(
entry.title,
- style: textTheme.bodyBold.copyWith(color: colorScheme.textBase),
+ style: TextStyles.bodyBold.copyWith(color: colors.textBase),
),
const SizedBox(height: 6),
Text(
entry.description,
- style: textTheme.small.copyWith(color: colorScheme.textMuted),
+ style: TextStyles.body.copyWith(color: colors.textLight),
),
],
),
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dart b/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dart
deleted file mode 100644
index 660f94c582..0000000000
--- a/mobile/apps/locker/lib/ui/settings/widgets/settings_widget.dart
+++ /dev/null
@@ -1,68 +0,0 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-
-class SettingsItem extends StatelessWidget {
- final dynamic icon;
- final String title;
- final VoidCallback? onTap;
- final Widget? trailing;
- final Color? textColor;
- final Color? iconColor;
- final bool showChevron;
-
- const SettingsItem({
- this.icon,
- required this.title,
- this.onTap,
- this.trailing,
- this.textColor,
- this.iconColor,
- this.showChevron = true,
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Container(
- constraints: const BoxConstraints(minHeight: 56),
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: BorderRadius.circular(20),
- ),
- padding: const EdgeInsets.all(16),
- child: Row(
- children: [
- if (icon != null) ...[
- HugeIcon(
- icon: icon,
- color: iconColor ?? colorScheme.textMuted,
- size: 24,
- ),
- const SizedBox(width: 12),
- ],
- Expanded(
- child: Text(
- title,
- maxLines: 2,
- overflow: TextOverflow.ellipsis,
- style: textTheme.small.copyWith(
- color: textColor ?? colorScheme.textBase,
- ),
- ),
- ),
- if (trailing != null) trailing!,
- if (trailing == null && showChevron)
- Icon(Icons.chevron_right, color: colorScheme.textMuted),
- ],
- ),
- ),
- );
- }
-}
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart b/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart
index 5955d0de86..eb27b80007 100644
--- a/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart
+++ b/mobile/apps/locker/lib/ui/settings/widgets/social_icons_row.dart
@@ -1,4 +1,4 @@
-import "package:ente_ui/theme/ente_theme.dart";
+import "package:ente_components/ente_components.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:url_launcher/url_launcher_string.dart";
@@ -9,45 +9,37 @@ class SocialIconsRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
-
- return Row(
+ return const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
_SocialIconButton(
icon: HugeIcons.strokeRoundedDiscord,
url: "https://ente.com/discord",
- color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
+ SizedBox(width: 8),
_SocialIconButton(
icon: HugeIcons.strokeRoundedYoutube,
url: "https://www.youtube.com/@entestudio",
- color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
+ SizedBox(width: 8),
_SocialIconButton(
icon: HugeIcons.strokeRoundedGithub,
url: "https://github.com/ente-io",
- color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
+ SizedBox(width: 8),
_SocialIconButton(
icon: HugeIcons.strokeRoundedNewTwitter,
url: "https://twitter.com/enteio",
- color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
+ SizedBox(width: 8),
_SocialIconButton(
icon: HugeIcons.strokeRoundedMastodon,
url: "https://fosstodon.org/@ente",
- color: colorScheme.textMuted,
),
- const SizedBox(width: 8),
+ SizedBox(width: 8),
_SocialIconButton(
icon: HugeIcons.strokeRoundedReddit,
url: "https://reddit.com/r/enteio",
- color: colorScheme.textMuted,
),
],
);
@@ -55,30 +47,20 @@ class SocialIconsRow extends StatelessWidget {
}
class _SocialIconButton extends StatelessWidget {
- final dynamic icon;
+ final List<List<dynamic>> icon;
final String url;
- final Color color;
- const _SocialIconButton({
- required this.icon,
- required this.url,
- required this.color,
- });
+ const _SocialIconButton({required this.icon, required this.url});
@override
Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- launchUrlString(url, mode: LaunchMode.externalApplication);
+ return IconButtonComponent(
+ variant: IconButtonComponentVariant.secondary,
+ shouldSurfaceExecutionStates: false,
+ icon: HugeIcon(icon: icon, size: IconSizes.small, strokeWidth: 1.6),
+ onTap: () async {
+ await launchUrlString(url, mode: LaunchMode.externalApplication);
},
- child: Container(
- width: 32,
- height: 32,
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(8)),
- child: Center(
- child: HugeIcon(icon: icon, color: color, size: 20),
- ),
- ),
);
}
}
diff --git a/mobile/apps/locker/lib/ui/settings/widgets/suggestion_chip.dart b/mobile/apps/locker/lib/ui/settings/widgets/suggestion_chip.dart
deleted file mode 100644
index 028999a67a..0000000000
--- a/mobile/apps/locker/lib/ui/settings/widgets/suggestion_chip.dart
+++ /dev/null
@@ -1,43 +0,0 @@
-import "package:ente_ui/theme/ente_theme.dart";
-import "package:flutter/material.dart";
-import "package:hugeicons/hugeicons.dart";
-
-class SuggestionChip extends StatelessWidget {
- final String label;
- final VoidCallback? onTap;
-
- const SuggestionChip({required this.label, this.onTap, super.key});
-
- @override
- Widget build(BuildContext context) {
- final colorScheme = getEnteColorScheme(context);
- final textTheme = getEnteTextTheme(context);
-
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: onTap,
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backdropBase,
- borderRadius: BorderRadius.circular(16),
- ),
- padding: const EdgeInsets.symmetric(horizontal: 13, vertical: 12),
- child: Row(
- mainAxisSize: MainAxisSize.min,
- children: [
- HugeIcon(
- icon: HugeIcons.strokeRoundedSparkles,
- color: colorScheme.textBase,
- size: 20,
- ),
- const SizedBox(width: 10),
- Text(
- label,
- style: textTheme.small.copyWith(color: colorScheme.textBase),
- ),
- ],
- ),
- ),
- );
- }
-}
diff --git a/mobile/apps/locker/pubspec.lock b/mobile/apps/locker/pubspec.lock
index 6ca6d27a81..7bae87a504 100644
--- a/mobile/apps/locker/pubspec.lock
+++ b/mobile/apps/locker/pubspec.lock
@@ -287,6 +287,13 @@ packages:
relative: true
source: path
version: "1.0.0"
+ ente_components:
+ dependency: "direct main"
+ description:
+ path: "../../packages/ente_components"
+ relative: true
+ source: path
+ version: "0.1.0"
ente_configuration:
dependency: "direct main"
description:
diff --git a/mobile/apps/locker/pubspec.yaml b/mobile/apps/locker/pubspec.yaml
index 473a7796a4..2537b32122 100644
--- a/mobile/apps/locker/pubspec.yaml
+++ b/mobile/apps/locker/pubspec.yaml
@@ -20,6 +20,8 @@ dependencies:
path: ../../packages/accounts
ente_base:
path: ../../packages/base
+ ente_components:
+ path: ../../packages/ente_components
ente_configuration:
path: ../../packages/configuration
ente_contacts:
diff --git a/mobile/apps/locker/pubspec_overrides.yaml b/mobile/apps/locker/pubspec_overrides.yaml
index 85a365bb0f..2e3524cfa8 100644
--- a/mobile/apps/locker/pubspec_overrides.yaml
+++ b/mobile/apps/locker/pubspec_overrides.yaml
@@ -1,9 +1,11 @@
-# melos_managed_dependency_overrides: ente_accounts,ente_base,ente_configuration,ente_events,ente_lock_screen,ente_logging,ente_network,ente_strings,ente_ui,ente_utils,ente_sharing,ente_legacy,ente_crypto_api,ente_crypto_dart_adapter,ente_pure_utils,ente_icons,ente_contacts,ente_rust
+# melos_managed_dependency_overrides: ente_accounts,ente_base,ente_configuration,ente_events,ente_lock_screen,ente_logging,ente_network,ente_strings,ente_ui,ente_utils,ente_sharing,ente_legacy,ente_crypto_api,ente_crypto_dart_adapter,ente_pure_utils,ente_icons,ente_contacts,ente_rust,ente_components
dependency_overrides:
ente_accounts:
path: ../../packages/accounts
ente_base:
path: ../../packages/base
+ ente_components:
+ path: ../../packages/ente_components
ente_configuration:
path: ../../packages/configuration
ente_contacts:
diff --git a/mobile/packages/ente_components/example/lib/main.dart b/mobile/packages/ente_components/example/lib/main.dart
index c065cd477c..21250a11e6 100644
--- a/mobile/packages/ente_components/example/lib/main.dart
+++ b/mobile/packages/ente_components/example/lib/main.dart
@@ -2789,15 +2789,10 @@ class _BottomSheetPreview extends StatelessWidget {
message:
'It looks like something went wrong. Please retry after some time.',
illustration: const _WarningIllustration(),
- actions: [
- ButtonComponent(
- label: 'Contact support',
- variant: ButtonComponentVariant.secondary,
- onTap: () async {
- await Navigator.of(context).maybePop();
- },
- ),
- ],
+ actionLabel: 'Contact support',
+ onActionTap: () async {
+ await Navigator.of(context).maybePop();
+ },
);
}
}
diff --git a/mobile/packages/ente_components/lib/components/bottom_sheet/error_bottom_sheet_component.dart b/mobile/packages/ente_components/lib/components/bottom_sheet/error_bottom_sheet_component.dart
index bff5bb5adc..85bda56fe6 100644
--- a/mobile/packages/ente_components/lib/components/bottom_sheet/error_bottom_sheet_component.dart
+++ b/mobile/packages/ente_components/lib/components/bottom_sheet/error_bottom_sheet_component.dart
@@ -1,16 +1,18 @@
import 'dart:async';
import 'package:ente_components/components/bottom_sheet/bottom_sheet_component.dart';
+import 'package:ente_components/components/buttons/button_component.dart';
import 'package:flutter/material.dart';
-/// Shows the standard error sheet while leaving app-specific
-/// localization, parsing, logging, and support actions to the caller.
+/// Shows the standard error sheet while leaving app-specific localization,
+/// parsing, and logging to the caller.
Future<T?> showErrorBottomSheetComponent<T>({
required BuildContext context,
required String message,
String title = 'Error',
Widget? illustration,
- List<Widget> actions = const [],
+ String? actionLabel,
+ FutureOr<void> Function()? onActionTap,
/// Called when the close button is pressed, before the sheet is dismissed.
///
@@ -32,7 +34,14 @@ Future<T?> showErrorBottomSheetComponent<T>({
title: title,
message: message,
illustration: illustration,
- actions: actions,
+ actions: [
+ if (actionLabel != null)
+ ButtonComponent(
+ label: actionLabel,
+ variant: ButtonComponentVariant.secondary,
+ onTap: onActionTap,
+ ),
+ ],
onClose: onClose,
showCloseButton: showCloseButton,
),
diff --git a/mobile/packages/ente_components/lib/components/chip_surface.dart b/mobile/packages/ente_components/lib/components/chip_surface.dart
index 4284505e3c..53427a6e44 100644
--- a/mobile/packages/ente_components/lib/components/chip_surface.dart
+++ b/mobile/packages/ente_components/lib/components/chip_surface.dart
@@ -47,12 +47,11 @@ class ChipSurface extends StatelessWidget {
minWidth: minWidth ?? 0,
),
padding: padding,
- alignment: Alignment.center,
decoration: BoxDecoration(
color: background,
borderRadius: borderRadius,
),
- child: child,
+ child: Center(widthFactor: 1, heightFactor: 1, child: child),
),
),
);
diff --git a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart
index 8912dd7f71..8352fbc683 100644
--- a/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart
+++ b/mobile/packages/ente_components/test/components/bottom_sheet_component_test.dart
@@ -200,12 +200,7 @@ void main() {
context: context,
message: 'Something went wrong.',
onClose: () => closeCount += 1,
- actions: const [
- ButtonComponent(
- label: 'Contact support',
- variant: ButtonComponentVariant.secondary,
- ),
- ],
+ actionLabel: 'Contact support',
),
label: 'Show error',
);