π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update landing page
AmanRajSinghMouryab71aeb7ab5d5
diff --git a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart b/mobile/apps/photos/lib/ui/home/landing_page_widget.dartindex a207f9cd3a..e2f0de70d0 100644--- a/mobile/apps/photos/lib/ui/home/landing_page_widget.dart+++ b/mobile/apps/photos/lib/ui/home/landing_page_widget.dart@@ -5,13 +5,13 @@ import 'package:dots_indicator/dots_indicator.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:photos/app.dart";import 'package:photos/core/configuration.dart';import 'package:photos/ente_theme_data.dart';import "package:photos/generated/l10n.dart";import "package:photos/l10n/l10n.dart";import "package:photos/service_locator.dart";-import 'package:photos/theme/colors.dart';import "package:photos/theme/ente_theme.dart";import 'package:photos/ui/account/email_entry_page.dart';import 'package:photos/ui/account/login_page.dart';@@ -26,6 +26,7 @@ import 'package:photos/ui/payment/subscription.dart';import "package:photos/ui/settings/developer_settings_page.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:photos/utils/dialog_util.dart";class LandingPageWidget extends StatefulWidget {@@ -38,25 +39,74 @@ class LandingPageWidget extends StatefulWidget {class _LandingPageWidgetState extends State<LandingPageWidget> {static const kDeveloperModeTapCountThreshold = 7;static const _featureCount = 3;+ static const _autoScrollInterval = Duration(seconds: 4);- double _featureIndex = 0;int _currentPage = 0;+ int _activeDotIndex = 0;int _developerModeTapCount = 0;+ bool _autoScrollDisabled = false;+ Timer? _autoScrollTimer;late final PageController _pageController;@overridevoid initState() {super.initState();- _pageController = PageController();+ const initialPage = _featureCount * 1000;+ _pageController = PageController(initialPage: initialPage);+ _pageController.addListener(_handlePageControllerScroll);+ _currentPage = initialPage;+ _activeDotIndex = _currentPage % _featureCount;+ _startAutoScroll();Future(_showAutoLogoutDialogIfRequired);}@overridevoid dispose() {+ _stopAutoScroll();+ _pageController.removeListener(_handlePageControllerScroll);_pageController.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,+ );+ }+@overrideWidget build(BuildContext context) {if (isOfflineMode) {@@ -66,6 +116,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {}Widget _buildOnlineScaffold() {+ final textTheme = getEnteTextTheme(context);return Scaffold(body: GestureDetector(onTap: _handleDeveloperModeTap,@@ -102,41 +153,18 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {): const SizedBox(),const Padding(padding: EdgeInsets.all(12)),- const Text(+ Text("ente",- style: TextStyle(- fontWeight: FontWeight.bold,- fontFamily: 'Montserrat',- fontSize: 42,+ style: textTheme.h3Bold.copyWith(+ fontFamily: "Montserrat",),),const Padding(padding: EdgeInsets.all(28),),- _getFeatureSlider(),- const Padding(- padding: EdgeInsets.all(12),- ),- DotsIndicator(- dotsCount: 3,- position: _featureIndex,- decorator: DotsDecorator(- activeColor:- Theme.of(context).colorScheme.dotsIndicatorActiveColor,- color: Theme.of(context)- .colorScheme- .dotsIndicatorInactiveColor,- activeShape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(3),- ),- shape: RoundedRectangleBorder(- borderRadius: BorderRadius.circular(3),- ),- size: const Size(100, 5),- activeSize: const Size(100, 5),- spacing: const EdgeInsets.all(3),- ),- ),+ _buildFeatureCarousel(),+ const SizedBox(height: 20),+ _buildPageIndicator(),const Padding(padding: EdgeInsets.all(28),),@@ -185,56 +213,23 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {);}- Widget _getFeatureSlider() {- return ConstrainedBox(- constraints: const BoxConstraints(maxHeight: 320),- child: PageView(- children: [- FeatureItemWidget(- "assets/onboarding_lock.png",- AppLocalizations.of(context).privateBackups,- AppLocalizations.of(context).forYourMemories,- AppLocalizations.of(context).endtoendEncryptedByDefault,- ),- FeatureItemWidget(- "assets/onboarding_safe.png",- AppLocalizations.of(context).safelyStored,- AppLocalizations.of(context).atAFalloutShelter,- AppLocalizations.of(context).designedToOutlive,- ),- FeatureItemWidget(- "assets/onboarding_sync.png",- AppLocalizations.of(context).available,- AppLocalizations.of(context).everywhere,- Platform.isAndroid- ? AppLocalizations.of(context).androidIosWebDesktop- : AppLocalizations.of(context).mobileWebDesktop,- ),- ],- onPageChanged: (index) {- setState(() {- _featureIndex = double.parse(index.toString());- });- },- ),- );- }-Widget _buildOfflineScaffold() {final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);return Scaffold(appBar: AppBar(- backgroundColor: green,+ backgroundColor: colorScheme.greenBase,leading: const SizedBox(),title: Text("ente",style: textTheme.h3Bold.copyWith(fontFamily: "Montserrat",+ color: Colors.white,),),centerTitle: true,),- backgroundColor: green,+ backgroundColor: colorScheme.greenBase,body: SafeArea(child: GestureDetector(onTap: _handleDeveloperModeTap,@@ -246,7 +241,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {mainAxisAlignment: MainAxisAlignment.center,children: [_buildFeatureCarousel(),- const SizedBox(height: 12),+ const SizedBox(height: 20),_buildPageIndicator(),],),@@ -263,14 +258,16 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {onTap: _navigateToSignUpPage,shouldStickToLightTheme: true,),- const SizedBox(height: 12),- ButtonWidgetV2(- buttonType: ButtonTypeV2.secondary,- labelText:- AppLocalizations.of(context).continueWithoutAccount,- onTap: _navigateWithoutAccount,- shouldStickToLightTheme: true,- ),+ if (Platform.isAndroid) ...[+ const SizedBox(height: 12),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.secondary,+ labelText:+ AppLocalizations.of(context).continueWithoutAccount,+ onTap: _navigateWithoutAccount,+ shouldStickToLightTheme: true,+ ),+ ],const SizedBox(height: 12),TextButton(onPressed: () {@@ -280,6 +277,7 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {AppLocalizations.of(context).loginToExistingAccount,style: getEnteTextTheme(context).body.copyWith(decoration: TextDecoration.underline,+ decorationColor: Colors.white,color: Colors.white,),),@@ -331,48 +329,67 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {}Widget _buildFeatureCarousel() {+ final l10n = AppLocalizations.of(context);+ final features = [+ (+ "assets/onboarding_lock.png",+ l10n.searchAndDiscover,+ "",+ l10n.searchAndDiscoverDesc,+ ),+ (+ "assets/onboarding_safe.png",+ l10n.shareYourMemories,+ "",+ l10n.shareYourMemoriesDesc,+ ),+ (+ "assets/onboarding_sync.png",+ l10n.privateAndSecureBackups,+ "",+ l10n.privateAndSecureBackupsDesc,+ ),+ ];+return ConstrainedBox(- constraints: const BoxConstraints(maxHeight: 320),- child: PageView(+ constraints: const BoxConstraints(maxHeight: 400),+ 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();},- children: [- FeatureItemWidget(- "assets/onboarding_lock.png",- AppLocalizations.of(context).privateBackups,- AppLocalizations.of(context).forYourMemories,- AppLocalizations.of(context).endtoendEncryptedByDefault,- ),- FeatureItemWidget(- "assets/onboarding_safe.png",- AppLocalizations.of(context).safelyStored,- AppLocalizations.of(context).atAFalloutShelter,- AppLocalizations.of(context).designedToOutlive,- ),- FeatureItemWidget(- "assets/onboarding_sync.png",- AppLocalizations.of(context).available,- AppLocalizations.of(context).everywhere,- Platform.isAndroid- ? AppLocalizations.of(context).androidIosWebDesktop- : AppLocalizations.of(context).mobileWebDesktop,- ),- ],),);}Widget _buildPageIndicator() {+ final activeColor = isOfflineMode+ ? const Color.fromRGBO(33, 144, 50, 1)+ : Theme.of(context).colorScheme.dotsIndicatorActiveColor;+ final inactiveColor = isOfflineMode+ ? Colors.white.withValues(alpha: 0.32)+ : Theme.of(context).colorScheme.dotsIndicatorInactiveColor;return DotsIndicator(dotsCount: _featureCount,- position: _currentPage.toDouble(),+ position: _activeDotIndex.toDouble(),+ animate: true,+ animationDuration: const Duration(milliseconds: 300),decorator: DotsDecorator(- activeColor: Colors.white,- color: Colors.white.withValues(alpha: 0.32),+ activeColor: activeColor,+ color: inactiveColor,activeShape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14),),@@ -383,6 +400,15 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {activeSize: const Size(20, 10),spacing: const EdgeInsets.all(6),),+ onTap: _animateToFeature,+ );+ }++ Future<void> _navigateWithoutAccount() async {+ updateService.hideChangeLog().ignore();+ await Navigator.of(context).pushAndRemoveUntil(+ MaterialPageRoute(builder: (_) => const HomeWidget()),+ (route) => false,);}@@ -469,10 +495,6 @@ class _LandingPageWidgetState extends State<LandingPageWidget> {);}- Future<void> _navigateWithoutAccount() async {- // TODO: Implement navigation for continue without account- }-Future<void> _showAutoLogoutDialogIfRequired() async {final bool autoLogout = Configuration.instance.showAutoLogoutDialog();if (autoLogout) {@@ -513,8 +535,25 @@ class FeatureItemWidget extends StatelessWidget {@overrideWidget build(BuildContext context) {+ const titleStyle = TextStyle(+ fontFamily: "Nunito",+ fontWeight: FontWeight.w800,+ fontSize: 24,+ letterSpacing: -1,+ color: Colors.white,+ );++ const subTextStyle = TextStyle(+ fontFamily: "Inter",+ fontWeight: FontWeight.w500,+ fontSize: 14,+ height: 20 / 14,+ color: Color(0xFFAAFFB8),+ );+return Column(crossAxisAlignment: CrossAxisAlignment.stretch,+ mainAxisAlignment: MainAxisAlignment.end,children: [Image.asset(assetPath,@@ -523,29 +562,25 @@ class FeatureItemWidget extends StatelessWidget {const Padding(padding: EdgeInsets.all(16)),Column(crossAxisAlignment: CrossAxisAlignment.center,- mainAxisAlignment: MainAxisAlignment.start,children: [Text(featureTitleFirstLine,- style: Theme.of(context).textTheme.headlineSmall,+ style: titleStyle,textAlign: TextAlign.center,),+ if (featureTitleSecondLine.isNotEmpty)+ Text(+ featureTitleSecondLine,+ style: titleStyle,+ textAlign: TextAlign.center,+ ),const Padding(padding: EdgeInsets.all(2)),- Text(- featureTitleSecondLine,- style: Theme.of(context).textTheme.headlineSmall,- textAlign: TextAlign.center,- ),- const Padding(padding: EdgeInsets.all(12)),- Text(- subText,- textAlign: TextAlign.center,- style: TextStyle(- color: Theme.of(context)- .colorScheme- .onSurface- .withValues(alpha: 0.5),- fontSize: 16,+ ConstrainedBox(+ constraints: const BoxConstraints(maxWidth: 320),+ child: Text(+ subText,+ textAlign: TextAlign.center,+ style: subTextStyle,),),],