π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[mob][photos] Use new app bar on settings page
AmanRajSinghMourya969066ee38b9
diff --git a/mobile/apps/photos/lib/ui/settings/components/settings_page_scaffold.dart b/mobile/apps/photos/lib/ui/settings/components/settings_page_scaffold.dartindex 7c198b0f99..03a11c02f3 100644--- a/mobile/apps/photos/lib/ui/settings/components/settings_page_scaffold.dart+++ b/mobile/apps/photos/lib/ui/settings/components/settings_page_scaffold.dart@@ -10,6 +10,8 @@ class SettingsPageScaffold extends StatelessWidget {this.actions = const [],this.controller,this.onTitleTap,+ this.onTitleDoubleTap,+ this.onTitleLongPress,this.bottomNavigationBar,this.padding = const EdgeInsets.fromLTRB(16, 0, 16, 16),});@@ -20,6 +22,8 @@ class SettingsPageScaffold extends StatelessWidget {final List<Widget> children;final ScrollController? controller;final VoidCallback? onTitleTap;+ final VoidCallback? onTitleDoubleTap;+ final VoidCallback? onTitleLongPress;final Widget? bottomNavigationBar;final EdgeInsetsGeometry padding;@@ -36,6 +40,8 @@ class SettingsPageScaffold extends StatelessWidget {actions: actions,controller: controller,onTitleTap: onTitleTap,+ onTitleDoubleTap: onTitleDoubleTap,+ onTitleLongPress: onTitleLongPress,slivers: [SliverSafeArea(top: false,diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dartindex 84268d0a8e..d670d1d594 100644--- a/mobile/apps/photos/lib/ui/settings_page.dart+++ b/mobile/apps/photos/lib/ui/settings_page.dart@@ -24,6 +24,7 @@ import "package:photos/ui/settings/appearance/appearance_settings_page.dart";import "package:photos/ui/settings/backup/backup_settings_page.dart";import "package:photos/ui/settings/backup/free_space_options.dart";import "package:photos/ui/settings/components/settings_item.dart";+import "package:photos/ui/settings/components/settings_page_scaffold.dart";import "package:photos/ui/settings/debug/debug_settings_page.dart";import "package:photos/ui/settings/debug/ml_debug_settings_page.dart";import "package:photos/ui/settings/inherited_settings_state.dart";@@ -47,10 +48,8 @@ class SettingsPage extends StatelessWidget {@overrideWidget build(BuildContext context) {- return Scaffold(- body: SettingsStateContainer(- child: _SettingsBody(emailNotifier: emailNotifier),- ),+ return SettingsStateContainer(+ child: _SettingsBody(emailNotifier: emailNotifier),);}}@@ -67,243 +66,174 @@ class _SettingsBody extends StatelessWidget {final hasConfiguredAccount = Configuration.instance.hasConfiguredAccount();final showLoginEntry = isLocalGalleryMode && !hasConfiguredAccount;- return Container(- color: colors.backgroundBase,- child: SafeArea(- bottom: false,- child: SingleChildScrollView(- physics: const BouncingScrollPhysics(),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 16),- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- _buildTitleBar(context, colors),- if (hasLoggedIn)- _buildEmailHeaderSection(context, colors)- else- const SizedBox(height: 8),- if (showLoginEntry) ...[- OfflineSettingsBanner(- onGetStarted: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (_) => const EmailEntryPage(- showReferralSourceField: false,- referralSource: "Offline",- ),- ),- );- },- ),- const SizedBox(height: 16),- _buildOfflineLoginCard(context, colors),- const SizedBox(height: 8),- ],- if (hasLoggedIn && !isLocalGalleryMode) ...[- // Account section- const StorageCardWidget(),- const SizedBox(height: 16),- _buildMenuItem(- title: AppLocalizations.of(context).account,- icon: HugeIcons.strokeRoundedUser,- onTap: () async {- await routeToPage(context, const AccountSettingsPage());- },- ),- const SizedBox(height: 8),- _buildMenuItem(- title: AppLocalizations.of(context).backup,- icon: HugeIcons.strokeRoundedCloudUpload,- onTap: () async {- await routeToPage(context, const BackupSettingsPage());- },- ),- const SizedBox(height: 8),- ],- // Privacy and personalization section- _buildMenuItem(- title: AppLocalizations.of(context).security,- icon: HugeIcons.strokeRoundedSecurityCheck,- onTap: () async {- await routeToPage(context, const SecuritySettingsPage());- },- ),- const SizedBox(height: 8),- _buildMenuItem(- title: AppLocalizations.of(context).appearance,- icon: HugeIcons.strokeRoundedPaintBoard,- onTap: () async {- await routeToPage(context, const AppearanceSettingsPage());- },- ),- const SizedBox(height: 8),- if (isLocalGalleryMode) ...[- // Local gallery section- _buildOfflineFeaturesCard(context),- const SizedBox(height: 8),- ],- if (hasLoggedIn && !isLocalGalleryMode) ...[- // Product features section- _buildPersonalFeaturesCard(context),- const SizedBox(height: 8),- _buildFeaturesAndPlansCard(context),- const SizedBox(height: 8),- ],- // Engagement section- _buildEngagementCard(context),- const SizedBox(height: 8),- // Support section- _buildMenuItem(- title: AppLocalizations.of(context).helpAndSupport,- icon: HugeIcons.strokeRoundedHelpCircle,- onTap: () async {- await routeToPage(context, const HelpSupportPage());- },- ),- const SizedBox(height: 8),- _buildMenuItem(- title: AppLocalizations.of(context).about,- icon: HugeIcons.strokeRoundedInformationCircle,- onTap: () async {- await routeToPage(context, const AboutUsPage());- },- ),- const SizedBox(height: 8),- if (hasLoggedIn && !isLocalGalleryMode) ...[- // Account actions section- _buildLogoutCard(context),- ],- const Padding(- padding: EdgeInsets.symmetric(vertical: 28),- child: SocialIconsRow(),- ),- const AppVersionWidget(),- if (hasLoggedIn &&- !isLocalGalleryMode &&- (flagService.flags.internalUser || kDebugMode)) ...[- // Debug section- _buildMenuItem(- title: "Debug",- icon: HugeIcons.strokeRoundedBug02,- onTap: () async {- await routeToPage(context, const DebugSettingsPage());- },- ),- const SizedBox(height: 8),- _buildMenuItem(- title: "ML Debug",- icon: HugeIcons.strokeRoundedAiBrain01,- onTap: () async {- await routeToPage(context, const MLDebugSettingsPage());- },- ),- const SizedBox(height: 16),- ],- const SizedBox(height: 60),- ],- ),- ),- ),- ),- );- }+ return AnimatedBuilder(+ animation: emailNotifier,+ builder: (context, _) {+ final email = hasLoggedIn ? emailNotifier.value ?? "" : "";- Widget _buildTitleBar(BuildContext context, ColorTokens colors) {- return Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,- children: [- GestureDetector(- onTap: () => Navigator.of(context).pop(),- child: Container(- padding: const EdgeInsets.all(8),- child: Icon(- Icons.keyboard_double_arrow_left,- size: 24,- color: colors.iconColor,- ),- ),- ),- Row(- mainAxisSize: MainAxisSize.min,+ return SettingsPageScaffold(+ title: email,+ actions: _buildHeaderActions(context),+ onTitleDoubleTap: email.isEmpty+ ? null+ : () => _showVerifyIdentityDialog(context),+ onTitleLongPress: email.isEmpty+ ? null+ : () => _showVerifyIdentityDialog(context),children: [- IconButtonComponent(- variant: IconButtonComponentVariant.unfilled,- shouldSurfaceExecutionStates: false,- icon: const Icon(Icons.search_rounded),- onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (context) => const SettingsSearchPage(),- ),- );- },- ),- if (localSettings.enableDatabaseLogging)- IconButtonComponent(- variant: IconButtonComponentVariant.unfilled,- shouldSurfaceExecutionStates: false,- icon: const Icon(Icons.bug_report),- onTap: () {+ if (showLoginEntry) ...[+ OfflineSettingsBanner(+ onGetStarted: () {Navigator.of(context).push(MaterialPageRoute(- builder: (context) => const LogViewerPage(),+ builder: (_) => const EmailEntryPage(+ showReferralSourceField: false,+ referralSource: "Offline",+ ),),);},),+ const SizedBox(height: 16),+ _buildOfflineLoginCard(context, colors),+ const SizedBox(height: 8),+ ],+ if (hasLoggedIn && !isLocalGalleryMode) ...[+ // Account section+ const StorageCardWidget(),+ const SizedBox(height: 16),+ _buildMenuItem(+ title: AppLocalizations.of(context).account,+ icon: HugeIcons.strokeRoundedUser,+ onTap: () async {+ await routeToPage(context, const AccountSettingsPage());+ },+ ),+ const SizedBox(height: 8),+ _buildMenuItem(+ title: AppLocalizations.of(context).backup,+ icon: HugeIcons.strokeRoundedCloudUpload,+ onTap: () async {+ await routeToPage(context, const BackupSettingsPage());+ },+ ),+ const SizedBox(height: 8),+ ],+ // Privacy and personalization section+ _buildMenuItem(+ title: AppLocalizations.of(context).security,+ icon: HugeIcons.strokeRoundedSecurityCheck,+ onTap: () async {+ await routeToPage(context, const SecuritySettingsPage());+ },+ ),+ const SizedBox(height: 8),+ _buildMenuItem(+ title: AppLocalizations.of(context).appearance,+ icon: HugeIcons.strokeRoundedPaintBoard,+ onTap: () async {+ await routeToPage(context, const AppearanceSettingsPage());+ },+ ),+ const SizedBox(height: 8),+ if (isLocalGalleryMode) ...[+ // Local gallery section+ _buildOfflineFeaturesCard(context),+ const SizedBox(height: 8),+ ],+ if (hasLoggedIn && !isLocalGalleryMode) ...[+ // Product features section+ _buildPersonalFeaturesCard(context),+ const SizedBox(height: 8),+ _buildFeaturesAndPlansCard(context),+ const SizedBox(height: 8),+ ],+ // Engagement section+ _buildEngagementCard(context),+ const SizedBox(height: 8),+ // Support section+ _buildMenuItem(+ title: AppLocalizations.of(context).helpAndSupport,+ icon: HugeIcons.strokeRoundedHelpCircle,+ onTap: () async {+ await routeToPage(context, const HelpSupportPage());+ },+ ),+ const SizedBox(height: 8),+ _buildMenuItem(+ title: AppLocalizations.of(context).about,+ icon: HugeIcons.strokeRoundedInformationCircle,+ onTap: () async {+ await routeToPage(context, const AboutUsPage());+ },+ ),+ const SizedBox(height: 8),+ if (hasLoggedIn && !isLocalGalleryMode) ...[+ // Account actions section+ _buildLogoutCard(context),+ ],+ const Padding(+ padding: EdgeInsets.symmetric(vertical: 28),+ child: SocialIconsRow(),+ ),+ const AppVersionWidget(),+ if (hasLoggedIn &&+ !isLocalGalleryMode &&+ (flagService.flags.internalUser || kDebugMode)) ...[+ // Debug section+ _buildMenuItem(+ title: "Debug",+ icon: HugeIcons.strokeRoundedBug02,+ onTap: () async {+ await routeToPage(context, const DebugSettingsPage());+ },+ ),+ const SizedBox(height: 8),+ _buildMenuItem(+ title: "ML Debug",+ icon: HugeIcons.strokeRoundedAiBrain01,+ onTap: () async {+ await routeToPage(context, const MLDebugSettingsPage());+ },+ ),+ const SizedBox(height: 16),+ ],+ const SizedBox(height: 60),],- ),- ],+ );+ },);}- Widget _buildEmailHeader(- BuildContext context,- ColorTokens colors,- ) {- return GestureDetector(- onDoubleTap: () => _showVerifyIdentityDialog(context),- onLongPress: () => _showVerifyIdentityDialog(context),- child: Padding(- padding: const EdgeInsets.symmetric(horizontal: 8),- child: AnimatedBuilder(- animation: emailNotifier,- builder: (BuildContext context, Widget? child) {- return Text(- emailNotifier.value ?? "",- style: TextStyles.body.copyWith(- color: colors.textLight,- overflow: TextOverflow.ellipsis,+ List<Widget> _buildHeaderActions(BuildContext context) {+ return [+ IconButtonComponent(+ variant: IconButtonComponentVariant.primary,+ shouldSurfaceExecutionStates: false,+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedSearch01),+ onTap: () {+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => const SettingsSearchPage(),+ ),+ );+ },+ ),+ if (localSettings.enableDatabaseLogging) ...[+ IconButtonComponent(+ variant: IconButtonComponentVariant.primary,+ shouldSurfaceExecutionStates: false,+ icon: const HugeIcon(icon: HugeIcons.strokeRoundedBug02),+ onTap: () {+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (context) => const LogViewerPage(),),);},),- ),- );- }-- Widget _buildEmailHeaderSection(- BuildContext context,- ColorTokens colors,- ) {- return AnimatedBuilder(- animation: emailNotifier,- builder: (BuildContext context, Widget? child) {- final email = emailNotifier.value ?? "";- if (email.isEmpty) {- return const SizedBox(height: 8);- }- return Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- const SizedBox(height: 16),- _buildEmailHeader(context, colors),- const SizedBox(height: 16),- ],- );- },- );+ ],+ ];}SettingsItem _buildMenuItem({diff --git a/mobile/packages/ente_components/lib/components/app_bar_component.dart b/mobile/packages/ente_components/lib/components/app_bar_component.dartindex b53f7fb0f4..8fd8bb4a54 100644--- a/mobile/packages/ente_components/lib/components/app_bar_component.dart+++ b/mobile/packages/ente_components/lib/components/app_bar_component.dart@@ -21,6 +21,8 @@ class AppBarComponent extends StatefulWidget {required this.title,required this.slivers,this.onTitleTap,+ this.onTitleDoubleTap,+ this.onTitleLongPress,this.subtitle,this.leading,this.backButton,@@ -37,6 +39,8 @@ class AppBarComponent extends StatefulWidget {final String title;final VoidCallback? onTitleTap;+ final VoidCallback? onTitleDoubleTap;+ final VoidCallback? onTitleLongPress;final String? subtitle;final Widget? leading;final Widget? backButton;@@ -200,6 +204,8 @@ class _AppBarComponentState extends State<AppBarComponent> {SliverAppBarComponent(title: widget.title,onTitleTap: widget.onTitleTap,+ onTitleDoubleTap: widget.onTitleDoubleTap,+ onTitleLongPress: widget.onTitleLongPress,subtitle: widget.subtitle,leading: widget.leading,backButton: widget.backButton,@@ -250,6 +256,8 @@ class SliverAppBarComponent extends StatelessWidget {super.key,required this.title,this.onTitleTap,+ this.onTitleDoubleTap,+ this.onTitleLongPress,this.subtitle,this.leading,this.backButton,@@ -264,6 +272,8 @@ class SliverAppBarComponent extends StatelessWidget {final String title;final VoidCallback? onTitleTap;+ final VoidCallback? onTitleDoubleTap;+ final VoidCallback? onTitleLongPress;final String? subtitle;final Widget? leading;final Widget? backButton;@@ -290,6 +300,8 @@ class SliverAppBarComponent extends StatelessWidget {delegate: _HeaderAppBarDelegate(title: title,onTitleTap: onTitleTap,+ onTitleDoubleTap: onTitleDoubleTap,+ onTitleLongPress: onTitleLongPress,subtitle: subtitle,leading: leading,backButton: backButton,@@ -314,6 +326,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {const _HeaderAppBarDelegate({required this.title,required this.onTitleTap,+ required this.onTitleDoubleTap,+ required this.onTitleLongPress,required this.subtitle,required this.leading,required this.backButton,@@ -333,6 +347,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {final String title;final VoidCallback? onTitleTap;+ final VoidCallback? onTitleDoubleTap;+ final VoidCallback? onTitleLongPress;final String? subtitle;final Widget? leading;final Widget? backButton;@@ -381,7 +397,7 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {_expandedContentTop +_centerOffset(expandedTextBlockHeight, _headerControlSize);final actionsTop = lerpDouble(- _expandedContentTop,+ leadingTop,collapsedControlTop,titleProgress,)!;@@ -437,6 +453,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {_MovingHeaderTitle(title: title,onTap: onTitleTap,+ onDoubleTap: onTitleDoubleTap,+ onLongPress: onTitleLongPress,top: titleTop,left: titleLeft,right: titleRight,@@ -490,6 +508,8 @@ class _HeaderAppBarDelegate extends SliverPersistentHeaderDelegate {bool shouldRebuild(covariant _HeaderAppBarDelegate oldDelegate) {return oldDelegate.title != title ||oldDelegate.onTitleTap != onTitleTap ||+ oldDelegate.onTitleDoubleTap != onTitleDoubleTap ||+ oldDelegate.onTitleLongPress != onTitleLongPress ||oldDelegate.subtitle != subtitle ||oldDelegate.leading != leading ||oldDelegate.backButton != backButton ||@@ -723,6 +743,8 @@ class _MovingHeaderTitle extends StatelessWidget {const _MovingHeaderTitle({required this.title,required this.onTap,+ required this.onDoubleTap,+ required this.onLongPress,required this.top,required this.left,required this.right,@@ -731,6 +753,8 @@ class _MovingHeaderTitle extends StatelessWidget {final String title;final VoidCallback? onTap;+ final VoidCallback? onDoubleTap;+ final VoidCallback? onLongPress;final double top;final double left;final double right;@@ -754,11 +778,13 @@ class _MovingHeaderTitle extends StatelessWidget {left: left,right: right,top: top,- child: onTap == null+ child: onTap == null && onDoubleTap == null && onLongPress == null? IgnorePointer(child: titleText): GestureDetector(behavior: HitTestBehavior.opaque,onTap: onTap,+ onDoubleTap: onDoubleTap,+ onLongPress: onLongPress,child: titleText,),);