Skip to content

armgit / ente

Public Imported from GitHub
0

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

fixes

AmanRajSinghMourya23330c4d1b97
diff --git a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
index d252122430..5e8e4a9e0d 100644
--- a/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/get_started_banner.dart
@@ -1,21 +1,27 @@
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:photos/generated/l10n.dart";
-import "package:photos/models/typedefs.dart";
+import "package:photos/service_locator.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/account/email_entry_page.dart";
-class GetStartedBanner extends StatelessWidget {
- final FutureVoidCallback onGetStarted;
- final VoidCallback? onDismiss;
+class GetStartedBanner extends StatefulWidget {
+ const GetStartedBanner({super.key});
- const GetStartedBanner({
- super.key,
- required this.onGetStarted,
- this.onDismiss,
- });
+ @override
+ State<GetStartedBanner> createState() => _GetStartedBannerState();
+}
+
+class _GetStartedBannerState extends State<GetStartedBanner> {
+ bool _dismissed = false;
@override
Widget build(BuildContext context) {
+ if (_dismissed) return const SizedBox.shrink();
+ if (localSettings.isOfflineGetStartedBannerDismissed) {
+ return const SizedBox.shrink();
+ }
+
const titleStyle = TextStyle(
fontFamily: "Nunito",
fontWeight: FontWeight.w800,
@@ -41,88 +47,108 @@ class GetStartedBanner extends StatelessWidget {
color: Colors.black,
);
- return Container(
- height: 165,
- clipBehavior: Clip.hardEdge,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- color: getEnteColorScheme(context).greenBase,
- ),
- child: Stack(
- clipBehavior: Clip.none,
- children: [
- Padding(
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Expanded(
- child: Text(
- AppLocalizations.of(context).moreThanJustAGallery,
- style: titleStyle,
+ return GestureDetector(
+ onTap: _onGetStarted,
+ child: Container(
+ height: 165,
+ clipBehavior: Clip.hardEdge,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(16),
+ color: getEnteColorScheme(context).greenBase,
+ ),
+ child: Stack(
+ clipBehavior: Clip.none,
+ children: [
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Expanded(
+ child: Text(
+ AppLocalizations.of(context).moreThanJustAGallery,
+ style: titleStyle,
+ ),
),
- ),
- if (onDismiss != null)
GestureDetector(
- onTap: onDismiss,
+ onTap: _onDismiss,
behavior: HitTestBehavior.opaque,
- child: const Padding(
- padding: EdgeInsets.only(left: 8),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: Colors.white,
- size: 20,
- strokeWidth: 2,
+ child: const SizedBox(
+ height: 20,
+ width: 20,
+ child: Center(
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: Colors.white,
+ size: 20,
+ strokeWidth: 2,
+ ),
),
),
),
- ],
- ),
- const SizedBox(height: 4),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 235),
- child: Text(
- AppLocalizations.of(context).encryptedBackupDescription,
- style: descriptionStyle,
+ ],
),
- ),
- const Spacer(),
- GestureDetector(
- onTap: onGetStarted,
- child: Container(
- height: 36,
- padding: const EdgeInsets.symmetric(horizontal: 24),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(12),
+ const SizedBox(height: 4),
+ ConstrainedBox(
+ constraints: const BoxConstraints(maxWidth: 235),
+ child: Text(
+ AppLocalizations.of(context).encryptedBackupDescription,
+ style: descriptionStyle,
),
- child: Center(
- widthFactor: 1,
- child: Text(
- AppLocalizations.of(context).getStarted,
- style: buttonTextStyle,
+ ),
+ const Spacer(),
+ 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(
+ AppLocalizations.of(context).getStarted,
+ style: buttonTextStyle,
+ ),
),
),
),
- ),
- ],
+ ],
+ ),
),
- ),
- Positioned(
- right: 12,
- bottom: 12,
- child: IgnorePointer(
- child: Image.asset(
- "assets/ducky_get_started.png",
- height: 100,
- fit: BoxFit.contain,
+ Positioned(
+ right: 12,
+ bottom: 12,
+ child: IgnorePointer(
+ child: Image.asset(
+ "assets/ducky_get_started.png",
+ height: 100,
+ fit: BoxFit.contain,
+ ),
),
),
- ),
- ],
+ ],
+ ),
+ ),
+ );
+ }
+
+ Future<void> _onDismiss() async {
+ setState(() {
+ _dismissed = true;
+ });
+ await localSettings.setOfflineGetStartedBannerDismissed(true);
+ }
+
+ Future<void> _onGetStarted() async {
+ await Navigator.of(context).push(
+ MaterialPageRoute(
+ builder: (_) => const EmailEntryPage(),
),
);
}
diff --git a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
index e5982ad39d..43fd9bba32 100644
--- a/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/ml_progress_banner.dart
@@ -1,5 +1,6 @@
import "dart:async";
+import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/material.dart";
import "package:hugeicons/hugeicons.dart";
import "package:intl/intl.dart";
@@ -10,6 +11,7 @@ import "package:photos/events/tab_changed_event.dart";
import "package:photos/generated/intl/app_localizations.dart";
import "package:photos/service_locator.dart";
import "package:photos/theme/ente_theme.dart";
+import "package:photos/ui/settings/ml/machine_learning_settings_page.dart";
import "package:photos/utils/ml_util.dart";
class MLProgressBanner extends StatefulWidget {
@@ -136,74 +138,83 @@ class _MLProgressBannerState extends State<MLProgressBanner> {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
- child: Container(
- decoration: BoxDecoration(
- color: colorScheme.backgroundColour,
- borderRadius: BorderRadius.circular(14),
- ),
- padding: const EdgeInsets.all(16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- l10n.mlProgressBannerTitle,
- style: TextStyle(
- fontFamily: "Montserrat",
- fontWeight: FontWeight.bold,
- fontSize: 16,
- color: colorScheme.greenBase,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ routeToPage(context, const MachineLearningSettingsPage());
+ },
+ child: Container(
+ decoration: BoxDecoration(
+ color: colorScheme.backgroundColour,
+ borderRadius: BorderRadius.circular(14),
+ ),
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ l10n.mlProgressBannerTitle,
+ style: TextStyle(
+ fontFamily: "Montserrat",
+ fontWeight: FontWeight.bold,
+ fontSize: 16,
+ color: colorScheme.greenBase,
+ ),
),
- ),
- GestureDetector(
- onTap: _onDismiss,
- behavior: HitTestBehavior.opaque,
- child: Padding(
- padding: const EdgeInsets.only(left: 8),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: colorScheme.textFaint,
- size: 20,
- strokeWidth: 2,
+ GestureDetector(
+ onTap: _onDismiss,
+ behavior: HitTestBehavior.opaque,
+ child: SizedBox(
+ width: 20,
+ height: 20,
+ child: Center(
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: colorScheme.textFaint,
+ size: 20,
+ strokeWidth: 2,
+ ),
+ ),
),
),
+ ],
+ ),
+ const SizedBox(height: 4),
+ Text(
+ l10n.mlProgressBannerDescription,
+ style: textTheme.miniMuted.copyWith(
+ fontFamily: "Montserrat",
+ fontWeight: FontWeight.w600,
),
- ],
- ),
- const SizedBox(height: 4),
- Text(
- l10n.mlProgressBannerDescription,
- style: textTheme.miniMuted.copyWith(
- fontFamily: "Montserrat",
- fontWeight: FontWeight.w600,
),
- ),
- const SizedBox(height: 8),
- Align(
- alignment: Alignment.centerRight,
- child: Text(
- l10n.mlProgressBannerStatus(
- indexed: format.format(status.indexedItems),
- total: format.format(total),
+ const SizedBox(height: 8),
+ ClipRRect(
+ borderRadius: BorderRadius.circular(2.5),
+ child: LinearProgressIndicator(
+ value: progress,
+ minHeight: 5,
+ backgroundColor: colorScheme.fillFaint,
+ valueColor: AlwaysStoppedAnimation<Color>(
+ colorScheme.greenBase,
+ ),
),
- style: textTheme.tinyMuted,
),
- ),
- const SizedBox(height: 6),
- ClipRRect(
- borderRadius: BorderRadius.circular(2.5),
- child: LinearProgressIndicator(
- value: progress,
- minHeight: 5,
- backgroundColor: colorScheme.fillFaint,
- valueColor: AlwaysStoppedAnimation<Color>(
- colorScheme.greenBase,
+ const SizedBox(height: 6),
+ Align(
+ alignment: Alignment.centerRight,
+ child: Text(
+ l10n.mlProgressBannerStatus(
+ indexed: format.format(status.indexedItems),
+ total: format.format(total),
+ ),
+ style: textTheme.tinyMuted,
),
),
- ),
- ],
+ ],
+ ),
),
),
);
diff --git a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
index f70913f099..0996a1accf 100644
--- a/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/name_face_banner.dart
@@ -93,13 +93,16 @@ class _NameFaceBannerState extends State<NameFaceBanner> {
GestureDetector(
onTap: _onDismiss,
behavior: HitTestBehavior.opaque,
- child: Padding(
- padding: const EdgeInsets.all(6),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: colorScheme.contentLight,
- size: 20,
- strokeWidth: 2,
+ child: SizedBox(
+ width: 20,
+ height: 20,
+ child: Center(
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: colorScheme.contentLight,
+ size: 20,
+ strokeWidth: 2,
+ ),
),
),
),
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
index db58620564..01b88c6cfc 100644
--- a/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/offline_settings_banner.dart
@@ -96,13 +96,16 @@ class _OfflineSettingsBannerState extends State<OfflineSettingsBanner> {
GestureDetector(
onTap: _onDismiss,
behavior: HitTestBehavior.opaque,
- child: const Padding(
- padding: EdgeInsets.only(left: 8),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: Colors.white,
- size: 20,
- strokeWidth: 2,
+ child: const SizedBox(
+ width: 20,
+ height: 20,
+ child: Center(
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: Colors.white,
+ size: 20,
+ strokeWidth: 2,
+ ),
),
),
),
diff --git a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
index 0e08b3d4c0..f2e0946726 100644
--- a/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
+++ b/mobile/apps/photos/lib/ui/components/banners/save_faces_banner.dart
@@ -59,13 +59,16 @@ class _SaveFacesBannerState extends State<SaveFacesBanner> {
GestureDetector(
onTap: _onDismiss,
behavior: HitTestBehavior.opaque,
- child: Padding(
- padding: const EdgeInsets.all(4),
- child: HugeIcon(
- icon: HugeIcons.strokeRoundedCancel01,
- color: colorScheme.contentLight,
- size: 18,
- strokeWidth: 2,
+ child: SizedBox(
+ width: 20,
+ height: 20,
+ child: Center(
+ child: HugeIcon(
+ icon: HugeIcons.strokeRoundedCancel01,
+ color: colorScheme.contentLight,
+ size: 18,
+ strokeWidth: 2,
+ ),
),
),
),