Skip to content

armgit / ente

Public Imported from GitHub
0

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

update setting screen offline state

AmanRajSinghMourya1564ad0f53b6
diff --git a/mobile/apps/photos/assets/2.0x/ducky_settings.png b/mobile/apps/photos/assets/2.0x/ducky_settings.png
new file mode 100644
index 0000000000..329f4fcc9e
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/ducky_settings.png differ
diff --git a/mobile/apps/photos/assets/3.0x/ducky_settings.png b/mobile/apps/photos/assets/3.0x/ducky_settings.png
new file mode 100644
index 0000000000..33b01ba63f
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/ducky_settings.png differ
diff --git a/mobile/apps/photos/assets/ducky_settings.png b/mobile/apps/photos/assets/ducky_settings.png
new file mode 100644
index 0000000000..25df4846a8
Binary files /dev/null and b/mobile/apps/photos/assets/ducky_settings.png differ
diff --git a/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart b/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
new file mode 100644
index 0000000000..38e6cb5df7
--- /dev/null
+++ b/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
@@ -0,0 +1,150 @@
+import "package:flutter/material.dart";
+import "package:photos/generated/l10n.dart";
+
+class OfflineSettingsBanner extends StatelessWidget {
+ final VoidCallback onGetStarted;
+
+ const OfflineSettingsBanner({
+ super.key,
+ required this.onGetStarted,
+ });
+
+ @override
+ Widget build(BuildContext context) {
+ const titleStyle = TextStyle(
+ fontFamily: "Montserrat",
+ fontWeight: FontWeight.bold,
+ fontSize: 16,
+ height: 28 / 16,
+ letterSpacing: -1,
+ color: Colors.white,
+ );
+
+ const descriptionStyle = TextStyle(
+ fontFamily: "Montserrat",
+ fontWeight: FontWeight.w600,
+ fontSize: 10,
+ height: 16 / 10,
+ color: Color.fromRGBO(165, 165, 165, 0.79),
+ );
+
+ const buttonTextStyle = TextStyle(
+ fontFamily: "Montserrat",
+ fontWeight: FontWeight.w600,
+ fontSize: 10,
+ color: Colors.black,
+ );
+
+ final l10n = AppLocalizations.of(context);
+
+ return ClipRRect(
+ borderRadius: BorderRadius.circular(15),
+ child: Container(
+ height: 156,
+ width: double.infinity,
+ decoration: const BoxDecoration(
+ gradient: LinearGradient(
+ colors: [
+ Color.fromRGBO(21, 21, 21, 1),
+ Color.fromRGBO(43, 43, 43, 1),
+ ],
+ begin: Alignment.bottomCenter,
+ end: Alignment.topCenter,
+ ),
+ ),
+ child: Stack(
+ children: [
+ Positioned.fill(
+ child: CustomPaint(
+ painter: _DotsPainter(),
+ ),
+ ),
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 235),
+ child: Text(
+ l10n.offlineSettingsBannerTitle,
+ style: titleStyle,
+ ),
+ ),
+ const SizedBox(height: 4),
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 235),
+ child: Text(
+ l10n.offlineSettingsBannerDesc,
+ style: descriptionStyle,
+ ),
+ ),
+ const SizedBox(height: 20),
+ GestureDetector(
+ onTap: onGetStarted,
+ child: Container(
+ height: 36,
+ padding: const EdgeInsets.symmetric(horizontal: 24),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ borderRadius: BorderRadius.circular(12),
+ ),
+ child: Center(
+ widthFactor: 1,
+ child: Text(
+ l10n.offlineEnableBackupAction,
+ style: buttonTextStyle,
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ Positioned(
+ right: 12,
+ bottom: 0,
+ child: IgnorePointer(
+ child: Image.asset(
+ "assets/ducky_settings.png",
+ height: 120,
+ fit: BoxFit.contain,
+ ),
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+}
+
+class _DotsPainter extends CustomPainter {
+ static const double _dotRadius = 2.0;
+ static const double _horizontalSpacing = 24.0;
+ static const double _verticalSpacing = 24.0;
+
+ @override
+ void paint(Canvas canvas, Size size) {
+ final paint = Paint()
+ ..color = Colors.white.withValues(alpha: 0.03)
+ ..style = PaintingStyle.fill;
+
+ final horizontalCount = (size.width / _horizontalSpacing).ceil() + 1;
+ final verticalCount = (size.height / _verticalSpacing).ceil() + 1;
+
+ for (int row = 0; row < verticalCount; row++) {
+ for (int col = 0; col < horizontalCount; col++) {
+ final x = col * _horizontalSpacing + (_horizontalSpacing / 2);
+ final y = row * _verticalSpacing + (_verticalSpacing / 2);
+
+ if (x <= size.width + _dotRadius && y <= size.height + _dotRadius) {
+ canvas.drawCircle(Offset(x, y), _dotRadius, paint);
+ }
+ }
+ }
+ }
+
+ @override
+ bool shouldRepaint(covariant CustomPainter oldDelegate) => false;
+}
diff --git a/mobile/apps/photos/lib/ui/settings_page.dart b/mobile/apps/photos/lib/ui/settings_page.dart
index 4448dc51ec..20fd1001c0 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/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";
import "package:photos/ui/components/settings/social_icons_row.dart";
@@ -93,7 +94,15 @@ class _SettingsBody extends StatelessWidget {
_buildEmailHeader(context, colorScheme, textTheme),
const SizedBox(height: 16),
if (showLoginEntry) ...[
- _buildLoginCard(context, colorScheme),
+ OfflineSettingsBanner(
+ onGetStarted: () {
+ Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const LandingPageWidget(),
+ ),
+ );
+ },
+ ),
const SizedBox(height: 8),
],
if (hasLoggedIn && !isOfflineMode) ...[
@@ -261,23 +270,6 @@ class _SettingsBody extends StatelessWidget {
);
}
- Widget _buildLoginCard(BuildContext context, EnteColorScheme colorScheme) {
- final title =
- "${AppLocalizations.of(context).existingUser} / ${AppLocalizations.of(context).newToEnte}";
- return MenuItemWidgetNew(
- title: title,
- leadingIconWidget: _buildIconWidget(
- HugeIcons.strokeRoundedUser,
- colorScheme,
- ),
- trailingIcon: Icons.chevron_right_outlined,
- trailingIconIsMuted: true,
- onTap: () async {
- await routeToPage(context, const LandingPageWidget());
- },
- );
- }
-
Widget _buildBackupCard(BuildContext context, EnteColorScheme colorScheme) {
return MenuItemWidgetNew(
title: AppLocalizations.of(context).backup,