Skip to content

armgit / ente

Public Imported from GitHub
0

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

add login cta for offline mode

AmanRajSinghMouryaee9c1a75bac7
diff --git a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_widget_new.dart b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_widget_new.dart
index 667efe9fab..32924308fc 100644
--- a/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_widget_new.dart
+++ b/mobile/apps/photos/lib/ui/components/menu_item_widget/menu_item_widget_new.dart
@@ -8,10 +8,11 @@ import 'package:photos/ui/components/menu_item_widget/menu_item_child_widgets.da
/// A menu item widget with the new design system.
/// Features:
/// - 20px border radius
-/// - 16px padding
+/// - 16px horizontal padding
/// - Background color: Light #FFFFFF, Dark #212121
class MenuItemWidgetNew extends StatefulWidget {
final String title;
+ final String? subText;
/// Color for the title text
final Color? titleColor;
@@ -59,6 +60,7 @@ class MenuItemWidgetNew extends StatefulWidget {
const MenuItemWidgetNew({
required this.title,
+ this.subText,
this.titleColor,
this.leadingIcon,
this.leadingIconColor,
@@ -144,12 +146,15 @@ class _MenuItemWidgetNewState extends State<MenuItemWidgetNew> {
isDarkMode ? const Color(0xFF212121) : const Color(0xFFFFFFFF);
final effectiveMenuItemColor = menuItemColor ?? defaultMenuItemColor;
+ final bool hasSubText =
+ widget.subText != null && widget.subText!.isNotEmpty;
+ final verticalPadding = hasSubText ? 9.0 : 16.0;
return AnimatedContainer(
duration: const Duration(milliseconds: 20),
width: double.infinity,
clipBehavior: Clip.none,
- padding: const EdgeInsets.all(16),
+ padding: EdgeInsets.symmetric(horizontal: 16, vertical: verticalPadding),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(circularRadius),
color: effectiveMenuItemColor,
@@ -165,12 +170,35 @@ class _MenuItemWidgetNewState extends State<MenuItemWidgetNew> {
leadingIconWidget: widget.leadingIconWidget,
),
Expanded(
- child: Text(
- widget.title,
- style: widget.titleColor != null
- ? textTheme.small.copyWith(color: widget.titleColor)
- : textTheme.small,
- ),
+ child: hasSubText
+ ? Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ widget.title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: widget.titleColor != null
+ ? textTheme.small.copyWith(color: widget.titleColor)
+ : textTheme.small,
+ ),
+ Text(
+ widget.subText!,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: textTheme.tinyMuted.copyWith(height: 17 / 10),
+ ),
+ ],
+ )
+ : Text(
+ widget.title,
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: widget.titleColor != null
+ ? textTheme.small.copyWith(color: widget.titleColor)
+ : textTheme.small,
+ ),
),
TrailingWidget(
executionStateNotifier: executionStateNotifier,
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 390d079fe0..3671a71c75 100644
--- a/mobile/apps/photos/lib/ui/settings_page.dart
+++ b/mobile/apps/photos/lib/ui/settings_page.dart
@@ -14,6 +14,7 @@ import "package:photos/services/local_authentication_service.dart";
import "package:photos/theme/colors.dart";
import "package:photos/theme/ente_theme.dart";
import "package:photos/theme/text_style.dart";
+import "package:photos/ui/account/login_page.dart";
import "package:photos/ui/components/banners/offline_settings_banner.dart";
import "package:photos/ui/components/menu_item_widget/menu_item_widget_new.dart";
import "package:photos/ui/components/settings/settings_grouped_card.dart";
@@ -101,6 +102,8 @@ class _SettingsBody extends StatelessWidget {
);
},
),
+ const SizedBox(height: 16),
+ _buildOfflineLoginCard(context, colorScheme),
const SizedBox(height: 8),
],
if (hasLoggedIn && !isOfflineMode) ...[
@@ -307,6 +310,36 @@ class _SettingsBody extends StatelessWidget {
);
}
+ Widget _buildOfflineLoginCard(
+ BuildContext context,
+ EnteColorScheme colorScheme,
+ ) {
+ return MenuItemWidgetNew(
+ title: AppLocalizations.of(context).alreadyHaveAnAccount,
+ subText: AppLocalizations.of(context).loginToEnte,
+ leadingIconWidget: _buildIconWidget(
+ HugeIcons.strokeRoundedLogin01,
+ colorScheme,
+ ),
+ trailingWidget: Container(
+ width: 40,
+ height: 40,
+ decoration: BoxDecoration(
+ color: colorScheme.greenBase,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: const Icon(
+ Icons.arrow_forward_rounded,
+ color: contentReverseLight,
+ size: 20,
+ ),
+ ),
+ onTap: () async {
+ await routeToPage(context, const LoginPage());
+ },
+ );
+ }
+
Widget _buildOfflineFeaturesCard(
BuildContext context,
EnteColorScheme colorScheme,