Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mobile][photos] improved onboarding design

Priyanshu Dangaref766c5f7f4bb
diff --git a/mobile/apps/photos/assets/2.0x/grant_permissions.png b/mobile/apps/photos/assets/2.0x/grant_permissions.png
new file mode 100644
index 0000000000..caf2d8c492
Binary files /dev/null and b/mobile/apps/photos/assets/2.0x/grant_permissions.png differ
diff --git a/mobile/apps/photos/assets/3.0x/grant_permissions.png b/mobile/apps/photos/assets/3.0x/grant_permissions.png
new file mode 100644
index 0000000000..91bd5bf733
Binary files /dev/null and b/mobile/apps/photos/assets/3.0x/grant_permissions.png differ
diff --git a/mobile/apps/photos/assets/grant_permissions.png b/mobile/apps/photos/assets/grant_permissions.png
new file mode 100644
index 0000000000..e7f1374610
Binary files /dev/null and b/mobile/apps/photos/assets/grant_permissions.png differ
diff --git a/mobile/apps/photos/assets/onboarding.riv b/mobile/apps/photos/assets/onboarding.riv
new file mode 100644
index 0000000000..6751046ae5
Binary files /dev/null and b/mobile/apps/photos/assets/onboarding.riv differ
diff --git a/mobile/apps/photos/lib/l10n/intl_en.arb b/mobile/apps/photos/lib/l10n/intl_en.arb
index 1922b9756d..5d744aa97e 100644
--- a/mobile/apps/photos/lib/l10n/intl_en.arb
+++ b/mobile/apps/photos/lib/l10n/intl_en.arb
@@ -1,5 +1,7 @@
{
"@@locale ": "en",
+ "onboardingTitle": "For everything you don't want to forget",
+ "onboardingDesc": "Save your photos and videos. Every memory, in one place.",
"enterYourEmailAddress": "Enter your email address",
"enterYourNewEmailAddress": "Enter your new email address",
"accountWelcomeBack": "Welcome back!",
@@ -3195,7 +3197,7 @@
"deleteHiddenFilesFromDeviceDescription": "Delete local copies of hidden files from your device",
"deleteOnDeviceFiles": "Delete on device files",
"noHiddenFilesOnDevice": "No hidden files on device",
- "welcome": "Welcome",
+ "grantGalleryPermissionTitle": "Let's find your favourites",
"grantGalleryPermissionDesc": "Grant permission to access and organize photos with face recognition. All processing happens on your device.",
"grantPermission": "Grant permission",
"privateAI": "Private AI",
diff --git a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
index 433fe81421..15eb876a5f 100644
--- a/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/grant_permissions_widget.dart
@@ -1,5 +1,6 @@
import "dart:async";
+import "package:ente_components/ente_components.dart";
import 'package:ente_pure_utils/ente_pure_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
@@ -102,7 +103,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
Center(
child: Padding(
padding: const EdgeInsets.only(top: 28),
- child: Image.asset("assets/photo_backup.png", height: 252),
+ child: Image.asset("assets/grant_permissions.png", height: 252),
),
),
const SizedBox(height: 22),
@@ -317,10 +318,10 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
- mainAxisAlignment: MainAxisAlignment.end,
+ mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
- "assets/ducky_permission.png",
+ "assets/grant_permissions.png",
height: 164,
errorBuilder: (context, error, stackTrace) {
return const SizedBox(height: 164);
@@ -328,12 +329,15 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
),
const SizedBox(height: 22),
Text(
- AppLocalizations.of(context).welcome,
+ AppLocalizations.of(
+ context,
+ ).grantGalleryPermissionTitle,
+ textAlign: .center,
style: TextStyle(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w900,
- fontSize: 32,
- letterSpacing: -1.4,
+ fontWeight: .w800,
+ fontFamily: TextStyles.outfitFontFamily,
+ fontSize: 36,
+ height: 1,
color: colorScheme.textBase,
),
),
@@ -347,7 +351,7 @@ class _GrantPermissionsWidgetState extends State<GrantPermissionsWidget> {
color: colorScheme.textMuted,
),
),
- const SizedBox(height: 20),
+ const SizedBox(height: 32),
ButtonWidgetV2(
buttonType: ButtonTypeV2.neutral,
labelText: AppLocalizations.of(
diff --git a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
index 5db8c428f1..d9305bd350 100644
--- a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
+++ b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart
@@ -1,13 +1,10 @@
import "dart:async";
-import 'package:dots_indicator/dots_indicator.dart';
import "package:ente_components/ente_components.dart";
import "package:ente_pure_utils/ente_pure_utils.dart";
import "package:flutter/foundation.dart";
import 'package:flutter/material.dart';
-import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
-import 'package:flutter_svg/flutter_svg.dart';
import "package:photos/app.dart";
import 'package:photos/core/configuration.dart';
import "package:photos/generated/l10n.dart";
@@ -26,6 +23,7 @@ import "package:photos/ui/settings/developer_settings_tap_area.dart";
import "package:photos/ui/settings/developer_settings_widget.dart";
import "package:photos/ui/settings/language_picker.dart";
import 'package:photos/ui/tabs/home_widget.dart';
+import "package:rive/rive.dart" as rive;
class LandingPageWidget extends StatefulWidget {
const LandingPageWidget({super.key});
@@ -35,74 +33,24 @@ class LandingPageWidget extends StatefulWidget {
}
class _LandingPageWidgetState extends State<LandingPageWidget> {
- static const _featureCount = 3;
- static const _autoScrollInterval = Duration(seconds: 4);
-
- int _currentPage = 0;
- int _activeDotIndex = 0;
- bool _autoScrollDisabled = false;
- Timer? _autoScrollTimer;
- late final PageController _pageController;
+ late final rive.FileLoader _onboardingAnimationLoader;
@override
void initState() {
super.initState();
- const initialPage = _featureCount * 1000;
- _pageController = PageController(initialPage: initialPage);
- _pageController.addListener(_handlePageControllerScroll);
- _currentPage = initialPage;
- _activeDotIndex = _currentPage % _featureCount;
- _startAutoScroll();
+ _onboardingAnimationLoader = rive.FileLoader.fromAsset(
+ "assets/onboarding.riv",
+ riveFactory: rive.Factory.flutter,
+ );
Future(_showAutoLogoutDialogIfRequired);
}
@override
void dispose() {
- _stopAutoScroll();
- _pageController.removeListener(_handlePageControllerScroll);
- _pageController.dispose();
+ _onboardingAnimationLoader.dispose();
super.dispose();
}
- void _startAutoScroll() {
- if (_autoScrollDisabled) return;
- _autoScrollTimer?.cancel();
- _autoScrollTimer = Timer.periodic(_autoScrollInterval, (_) {
- if (!_pageController.hasClients) return;
- final nextPage = _currentPage + 1;
- _pageController.animateToPage(
- nextPage,
- duration: const Duration(milliseconds: 400),
- curve: Curves.easeInOut,
- );
- });
- }
-
- void _stopAutoScroll() {
- _autoScrollTimer?.cancel();
- _autoScrollTimer = null;
- }
-
- void _handlePageControllerScroll() {
- if (!_pageController.hasClients) return;
- if (_pageController.position.userScrollDirection != ScrollDirection.idle) {
- _autoScrollDisabled = true;
- _stopAutoScroll();
- }
- }
-
- void _animateToFeature(int index) {
- if (!_pageController.hasClients) return;
- final base = _currentPage - (_currentPage % _featureCount);
- final targetPage = base + index;
- if (targetPage == _currentPage) return;
- _pageController.animateToPage(
- targetPage,
- duration: const Duration(milliseconds: 400),
- curve: Curves.easeInOut,
- );
- }
-
@override
Widget build(BuildContext context) {
final textTheme = getEnteTextTheme(context);
@@ -119,12 +67,6 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
statusBarBrightness: Brightness.dark,
),
leading: const SizedBox(),
- title: SvgPicture.asset(
- "assets/ente-branding.svg",
- height: 18,
- colorFilter: const ColorFilter.mode(Colors.white, BlendMode.srcIn),
- ),
- centerTitle: true,
),
backgroundColor: colorScheme.greenBase,
body: SafeArea(
@@ -136,46 +78,61 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
children: [
if (kDebugMode) _buildDebugLanguageButton(),
Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- _buildFeatureCarousel(),
- const SizedBox(height: 20),
- _buildPageIndicator(),
- ],
+ child: Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ children: [
+ _buildOnboardingAnimation(),
+ Text(
+ AppLocalizations.of(context).onboardingTitle,
+ textAlign: .center,
+ style: const TextStyle(
+ fontWeight: .w800,
+ fontFamily: TextStyles.outfitFontFamily,
+ fontSize: 36,
+ height: 1,
+ color: Colors.white,
+ ),
+ ),
+ const SizedBox(height: 16),
+ Text(
+ AppLocalizations.of(context).onboardingDesc,
+ textAlign: .center,
+ style: textTheme.body.copyWith(
+ color: colorScheme.greenLight,
+ ),
+ ),
+ ],
+ ),
),
),
- const SizedBox(height: 24),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Column(
children: [
Theme(
data: lightComponentTheme,
- child: Column(
- children: [
- ButtonComponent(
- variant: ButtonComponentVariant.neutral,
- label: AppLocalizations.of(
- context,
- ).createAnEnteAccount,
- onTap: _navigateToSignUpPage,
- shouldSurfaceExecutionStates: false,
- ),
- if (localSettings.showLocalGalleryModeOption) ...[
- const SizedBox(height: 12),
- ButtonComponent(
- variant: ButtonComponentVariant.secondary,
- label: AppLocalizations.of(
- context,
- ).continueWithoutAccount,
- onTap: _navigateWithoutAccount,
- shouldSurfaceExecutionStates: false,
- ),
- ],
- ],
+ child: ButtonComponent(
+ variant: ButtonComponentVariant.neutral,
+ label: AppLocalizations.of(context).createAnEnteAccount,
+ onTap: _navigateToSignUpPage,
+ shouldSurfaceExecutionStates: false,
),
),
+ if (localSettings.showLocalGalleryModeOption) ...[
+ const SizedBox(height: 12),
+ Theme(
+ data: lightComponentTheme,
+ child: ButtonComponent(
+ variant: ButtonComponentVariant.secondary,
+ label: AppLocalizations.of(
+ context,
+ ).continueWithoutAccount,
+ onTap: _navigateWithoutAccount,
+ shouldSurfaceExecutionStates: false,
+ ),
+ ),
+ ],
const SizedBox(height: 12),
TextButton(
onPressed: _navigateToSignInPage,
@@ -201,6 +158,25 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
);
}
+ Widget _buildOnboardingAnimation() {
+ return SizedBox(
+ height: 280,
+ width: double.infinity,
+ child: rive.RiveWidgetBuilder(
+ fileLoader: _onboardingAnimationLoader,
+ builder: (BuildContext context, rive.RiveState state) {
+ if (state is rive.RiveLoaded) {
+ return rive.RiveWidget(
+ controller: state.controller,
+ fit: rive.Fit.contain,
+ );
+ }
+ return const SizedBox.shrink();
+ },
+ ),
+ );
+ }
+
Widget _buildDebugLanguageButton() {
return GestureDetector(
child: const Align(
@@ -228,76 +204,6 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
);
}
- Widget _buildFeatureCarousel() {
- final l10n = AppLocalizations.of(context);
- final features = [
- (
- "assets/onboarding_1.png",
- l10n.searchAndDiscover,
- "",
- l10n.searchAndDiscoverDesc,
- ),
- (
- "assets/onboarding_2.png",
- l10n.shareYourMemories,
- "",
- l10n.shareYourMemoriesDesc,
- ),
- (
- "assets/onboarding_3.png",
- l10n.privateAndSecureBackups,
- "",
- l10n.privateAndSecureBackupsDesc,
- ),
- ];
-
- return ConstrainedBox(
- constraints: const BoxConstraints(maxHeight: 320),
- child: PageView.builder(
- controller: _pageController,
- itemBuilder: (context, index) {
- final feature = features[index % features.length];
- return FeatureItemWidget(
- feature.$1,
- feature.$2,
- feature.$3,
- feature.$4,
- );
- },
- onPageChanged: (index) {
- setState(() {
- _currentPage = index;
- _activeDotIndex = index % _featureCount;
- });
- _startAutoScroll();
- },
- ),
- );
- }
-
- Widget _buildPageIndicator() {
- const activeColor = Color.fromRGBO(33, 144, 50, 1);
- final inactiveColor = Colors.white.withValues(alpha: 0.32);
- return DotsIndicator(
- dotsCount: _featureCount,
- position: _activeDotIndex.toDouble(),
- animate: true,
- animationDuration: const Duration(milliseconds: 300),
- decorator: DotsDecorator(
- activeColor: activeColor,
- color: inactiveColor,
- activeShape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(14),
- ),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)),
- size: const Size(10, 10),
- activeSize: const Size(20, 10),
- spacing: const EdgeInsets.all(6),
- ),
- onTap: _animateToFeature,
- );
- }
-
Future<void> _navigateWithoutAccount() async {
await Navigator.of(context).push(
MaterialPageRoute(
@@ -385,67 +291,3 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {
}
}
}
-
-class FeatureItemWidget extends StatelessWidget {
- final String assetPath,
- featureTitleFirstLine,
- featureTitleSecondLine,
- subText;
-
- const FeatureItemWidget(
- this.assetPath,
- this.featureTitleFirstLine,
- this.featureTitleSecondLine,
- this.subText, {
- super.key,
- });
-
- @override
- Widget build(BuildContext context) {
- const titleStyle = TextStyle(
- fontFamily: "Nunito",
- fontWeight: FontWeight.w800,
- fontSize: 24,
- letterSpacing: -1,
- color: Colors.white,
- );
-
- final subTextStyle = TextStyles.body.copyWith(
- color: const Color(0xFFAAFFB8),
- );
-
- return Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Image.asset(assetPath, height: 200),
- const Padding(padding: EdgeInsets.all(16)),
- Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- featureTitleFirstLine,
- style: titleStyle,
- textAlign: TextAlign.center,
- ),
- if (featureTitleSecondLine.isNotEmpty)
- Text(
- featureTitleSecondLine,
- style: titleStyle,
- textAlign: TextAlign.center,
- ),
- const Padding(padding: EdgeInsets.all(2)),
- ConstrainedBox(
- constraints: const BoxConstraints(maxWidth: 320),
- child: Text(
- subText,
- textAlign: TextAlign.center,
- style: subTextStyle,
- ),
- ),
- ],
- ),
- ],
- );
- }
-}