π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update UI for onboarding screens
AmanRajSinghMourya75ce22a888ae
diff --git a/mobile/apps/locker/lib/ui/components/new_account_dialog.dart b/mobile/apps/locker/lib/ui/components/new_account_dialog.dartnew file mode 100644index 0000000000..baf12f1fd5--- /dev/null+++ b/mobile/apps/locker/lib/ui/components/new_account_dialog.dart@@ -0,0 +1,151 @@+import "package:ente_ui/components/buttons/button_widget.dart";+import "package:ente_ui/components/buttons/models/button_result.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";++Future<ButtonResult?> showCreateNewAccountDialog(+ BuildContext context, {+ required String title,+ required String body,+ required String buttonLabel,+ required String assetPath,+ Widget? icon,+}) {+ return showModalBottomSheet<ButtonResult>(+ context: context,+ isScrollControlled: true,+ isDismissible: true,+ builder: (context) {+ return _CreateNewAccountBottomSheet(+ title: title,+ body: body,+ buttonLabel: buttonLabel,+ assetPath: assetPath,+ icon: icon,+ );+ },+ );+}++class _CreateNewAccountBottomSheet extends StatelessWidget {+ final String title;+ final String body;+ final String buttonLabel;+ final String assetPath;+ final Widget? icon;++ const _CreateNewAccountBottomSheet({+ required this.title,+ required this.body,+ required this.buttonLabel,+ required this.assetPath,+ this.icon,+ });++ @override+ Widget build(BuildContext context) {+ return Theme(+ data: ThemeData(+ brightness: Brightness.light,+ useMaterial3: false,+ ),+ child: Builder(+ builder: (context) {+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);++ return Container(+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ border: Border(top: BorderSide(color: colorScheme.strokeFaint)),+ borderRadius: const BorderRadius.only(+ topLeft: Radius.circular(24),+ topRight: Radius.circular(24),+ ),+ ),+ child: SafeArea(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ const SizedBox(height: 8),+ Row(+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ GestureDetector(+ onTap: () => Navigator.of(context).pop(),+ child: Container(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(50),+ color: colorScheme.backgroundElevated,+ ),+ padding: const EdgeInsets.all(8),+ child: Icon(+ Icons.close,+ size: 24,+ color: colorScheme.textBase,+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: 8),+ Image.asset(assetPath),+ const SizedBox(height: 24),+ Text(+ title,+ style: textTheme.h3Bold,+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 12),+ Text(+ body,+ style: textTheme.body.copyWith(+ color: colorScheme.textMuted,+ ),+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 32),+ SizedBox(+ width: double.infinity,+ height: 56,+ child: ElevatedButton.icon(+ onPressed: () {+ Navigator.of(context).pop(+ ButtonResult(ButtonAction.first),+ );+ },+ style: ElevatedButton.styleFrom(+ backgroundColor: colorScheme.primary700,+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(12),+ ),+ elevation: 0,+ ),+ icon: icon ??+ const HugeIcon(+ icon: HugeIcons.strokeRoundedFileUpload,+ color: Colors.white,+ size: 20,+ strokeWidth: 1.9,+ ),+ label: Text(+ buttonLabel,+ style: textTheme.bodyBold.copyWith(+ color: Colors.white,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+ },+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/components/recovery_key_dialog.dart b/mobile/apps/locker/lib/ui/components/recovery_key_dialog.dartnew file mode 100644index 0000000000..d8f656cf0f--- /dev/null+++ b/mobile/apps/locker/lib/ui/components/recovery_key_dialog.dart@@ -0,0 +1,141 @@+import "package:ente_ui/components/buttons/button_widget.dart";+import "package:ente_ui/components/buttons/models/button_result.dart";+import "package:ente_ui/theme/ente_theme.dart";+import "package:flutter/material.dart";+import "package:hugeicons/hugeicons.dart";++Future<ButtonResult?> showRecoveryKeyDialog(+ BuildContext context, {+ required String title,+ required String body,+ required String buttonLabel,+ required String assetPath,+ Widget? icon,+}) {+ return showModalBottomSheet<ButtonResult>(+ context: context,+ isScrollControlled: true,+ isDismissible: true,+ builder: (context) {+ return _RecoveryKeyBottomSheet(+ title: title,+ body: body,+ buttonLabel: buttonLabel,+ assetPath: assetPath,+ icon: icon,+ );+ },+ );+}++class _RecoveryKeyBottomSheet extends StatelessWidget {+ final String title;+ final String body;+ final String buttonLabel;+ final String assetPath;+ final Widget? icon;++ const _RecoveryKeyBottomSheet({+ required this.title,+ required this.body,+ required this.buttonLabel,+ required this.assetPath,+ this.icon,+ });++ @override+ Widget build(BuildContext context) {+ final textTheme = getEnteTextTheme(context);+ final colorScheme = getEnteColorScheme(context);++ return Container(+ decoration: BoxDecoration(+ color: colorScheme.backdropBase,+ border: Border(top: BorderSide(color: colorScheme.strokeFaint)),+ borderRadius: const BorderRadius.only(+ topLeft: Radius.circular(24),+ topRight: Radius.circular(24),+ ),+ ),+ child: SafeArea(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Column(+ mainAxisSize: MainAxisSize.min,+ children: [+ const SizedBox(height: 8),+ Row(+ mainAxisAlignment: MainAxisAlignment.end,+ children: [+ GestureDetector(+ onTap: () => Navigator.of(context).pop(),+ child: Container(+ decoration: BoxDecoration(+ borderRadius: BorderRadius.circular(50),+ color: colorScheme.backgroundElevated,+ ),+ padding: const EdgeInsets.all(8),+ child: Icon(+ Icons.close,+ size: 24,+ color: colorScheme.textBase,+ ),+ ),+ ),+ ],+ ),+ const SizedBox(height: 8),+ Image.asset(assetPath),+ const SizedBox(height: 24),+ Text(+ title,+ style: textTheme.h3Bold,+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 12),+ Text(+ body,+ style: textTheme.body.copyWith(+ color: colorScheme.textMuted,+ ),+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 32),+ SizedBox(+ width: double.infinity,+ height: 56,+ child: ElevatedButton.icon(+ onPressed: () {+ Navigator.of(context).pop(+ ButtonResult(ButtonAction.first),+ );+ },+ style: ElevatedButton.styleFrom(+ backgroundColor: colorScheme.warning400,+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(12),+ ),+ elevation: 0,+ ),+ icon: icon ??+ const HugeIcon(+ icon: HugeIcons.strokeRoundedFileUpload,+ color: Colors.white,+ size: 20,+ strokeWidth: 1.9,+ ),+ label: Text(+ buttonLabel,+ style: textTheme.bodyBold.copyWith(+ color: Colors.white,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/login_page.dart b/mobile/apps/locker/lib/ui/pages/login_page.dartnew file mode 100644index 0000000000..9a6669e4aa--- /dev/null+++ b/mobile/apps/locker/lib/ui/pages/login_page.dart@@ -0,0 +1,457 @@+import 'package:dio/dio.dart';+import 'package:email_validator/email_validator.dart';+import 'package:ente_accounts/ente_accounts.dart';+import 'package:ente_accounts/models/errors.dart';+import "package:ente_crypto_dart/ente_crypto_dart.dart";+import 'package:ente_ui/components/buttons/button_widget.dart';+import 'package:ente_ui/components/buttons/gradient_button.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:ente_ui/utils/dialog_util.dart';+import 'package:flutter/material.dart';+import 'package:locker/l10n/l10n.dart';+import 'package:locker/services/configuration.dart';+import 'package:locker/ui/components/new_account_dialog.dart';+import 'package:logging/logging.dart';+import 'package:url_launcher/url_launcher.dart';++class LoginPage extends StatefulWidget {+ const LoginPage({super.key});++ @override+ State<LoginPage> createState() => _LoginPageState();+}++class _LoginPageState extends State<LoginPage> {+ final Logger _logger = Logger('LoginPageState');+ String? _email;+ bool _emailIsValid = false;+ bool _passwordVisible = false;+ bool _isLoggingIn = false;+ Color? _emailInputFieldColor;+ final _passwordController = TextEditingController();+ final FocusNode _passwordFocusNode = FocusNode();++ @override+ void initState() {+ super.initState();+ _email = Configuration.instance.getEmail();+ if (_email != null) {+ _emailIsValid = EmailValidator.validate(_email!);+ }+ }++ @override+ void dispose() {+ _passwordController.dispose();+ _passwordFocusNode.dispose();+ super.dispose();+ }++ Future<void> _handleLogin() async {+ // Prevent multiple simultaneous login attempts+ if (_isLoggingIn) return;++ setState(() {+ _isLoggingIn = true;+ });++ FocusScope.of(context).unfocus();+ final dialog = createProgressDialog(+ context,+ context.l10n.pleaseWait,+ isDismissible: true,+ );+ await dialog.show();++ try {+ await UserService.instance.setEmail(_email!);+ Configuration.instance.resetVolatilePassword();+ SrpAttributes? attr;+ bool isEmailVerificationEnabled = true;+ try {+ attr = await UserService.instance.getSrpAttributes(_email!);+ isEmailVerificationEnabled = attr.isEmailMFAEnabled;+ } catch (e) {+ if (e is! SrpSetupNotCompleteError) {+ _logger.severe('Error getting SRP attributes', e);+ }+ }++ await dialog.hide();++ final password = _passwordController.text;+ if (attr != null && !isEmailVerificationEnabled && password.isNotEmpty) {+ await _verifyPassword(attr, password);+ } else {+ await UserService.instance.sendOtt(+ context,+ _email!,+ isCreateAccountScreen: false,+ purpose: 'login',+ );+ }+ } catch (e) {+ await dialog.hide();+ _logger.severe('Login error', e);+ await showGenericErrorDialog(context: context, error: e);+ } finally {+ if (mounted) {+ setState(() {+ _isLoggingIn = false;+ });+ }+ }+ }++ Future<void> _verifyPassword(+ SrpAttributes srpAttributes,+ String password,+ ) async {+ final dialog = createProgressDialog(+ context,+ context.l10n.pleaseWait,+ isDismissible: true,+ );+ await dialog.show();++ try {+ await UserService.instance.verifyEmailViaPassword(+ context,+ srpAttributes,+ password,+ dialog,+ );+ } on DioException catch (e, s) {+ await dialog.hide();+ if (e.response != null && e.response!.statusCode == 401) {+ _logger.severe('Server reject, failed verify SRP login', e, s);+ await showErrorDialog(+ context,+ 'Incorrect Password',+ 'Please try again',+ );+ } else {+ _logger.severe('API failure during SRP login ${e.type}', e, s);+ if (e.type == DioExceptionType.connectionTimeout ||+ e.type == DioExceptionType.receiveTimeout ||+ e.type == DioExceptionType.sendTimeout) {+ await showErrorDialog(+ context,+ 'No Internet Connection',+ 'Please check your internet connection and try again',+ );+ } else {+ await showErrorDialog(+ context,+ 'Something went wrong',+ 'Verification failed, please try again',+ );+ }+ }+ } catch (e, s) {+ _logger.info('error during loginViaPassword', e);+ await dialog.hide();+ if (e is LoginKeyDerivationError) {+ _logger.severe('loginKey derivation error', e, s);+ await UserService.instance.sendOtt(+ context,+ _email!,+ isCreateAccountScreen: true,+ );+ return;+ } else if (e is KeyDerivationError) {+ final dialogChoice = await showChoiceDialog(+ context,+ title: 'Recreate password',+ body:+ 'Your device does not have enough memory to verify your password',+ firstButtonLabel: 'Use recovery key',+ );+ if (dialogChoice!.action == ButtonAction.first) {+ await UserService.instance.sendOtt(+ context,+ _email!,+ isResetPasswordScreen: true,+ );+ }+ return;+ } else {+ _logger.severe('unexpected error while verifying password', e, s);+ await _showContactSupportDialog(+ context,+ 'Oops',+ 'Verification failed, please try again',+ );+ }+ }+ }++ Future<void> _showContactSupportDialog(+ BuildContext context,+ String title,+ String message,+ ) async {+ final dialogChoice = await showChoiceDialog(+ context,+ title: title,+ body: message,+ firstButtonLabel: 'Contact support',+ secondButtonLabel: 'OK',+ );+ if (dialogChoice!.action == ButtonAction.first) {+ final Uri emailUri = Uri(+ scheme: 'mailto',+ path: '[email protected]',+ query: 'subject=Locker Login Issue',+ );+ if (await canLaunchUrl(emailUri)) {+ await launchUrl(emailUri);+ }+ }+ }++ void _handleForgotPassword() async {+ if (_email == null || !_emailIsValid) {+ await showErrorDialog(+ context,+ 'Invalid Email',+ 'Please enter a valid email address first',+ );+ return;+ }++ await UserService.instance.sendOtt(+ context,+ _email!,+ isResetPasswordScreen: true,+ );+ }++ void _handleSignUp() {+ showCreateNewAccountDialog(+ context,+ title: "Unlock locker with a paid plan",+ body:+ "Locker is available only to Ente photos paid users. Upgrade to a paid plan from Photos to use Locker",+ buttonLabel: "Checkout Ente Photos",+ assetPath: "assets/file_lock.png",+ icon: const SizedBox.shrink(),+ );+ }++ void updateEmail(String value) {+ _email = value.trim();+ _emailIsValid = EmailValidator.validate(_email!);+ }++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ title: Text(+ "Locker",+ style: textTheme.h3Bold.copyWith(+ color: colorScheme.primary700,+ ),+ ),+ backgroundColor: colorScheme.backgroundBase,+ elevation: 0,+ leading: IconButton(+ icon: Icon(+ Icons.arrow_back,+ color: colorScheme.primary700,+ ),+ onPressed: () => Navigator.of(context).pop(),+ ),+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 24.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Expanded(+ child: AutofillGroup(+ child: SingleChildScrollView(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const SizedBox(height: 24),+ Text(+ "Email id",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 8),+ TextFormField(+ key: const ValueKey("emailInputField"),+ autofillHints: const [AutofillHints.email],+ decoration: InputDecoration(+ hintText: "Enter your email id",+ hintStyle: textTheme.body.copyWith(+ color: colorScheme.textMuted,+ ),+ fillColor:+ _emailInputFieldColor ?? colorScheme.fillFaint,+ filled: true,+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 14,+ ),+ border: OutlineInputBorder(+ borderSide: BorderSide.none,+ borderRadius: BorderRadius.circular(8),+ ),+ suffixIcon: _emailIsValid+ ? Icon(+ Icons.check,+ size: 20,+ color: colorScheme.primary700,+ )+ : null,+ ),+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ onChanged: (value) {+ setState(() {+ updateEmail(value);+ if (_emailIsValid) {+ _emailInputFieldColor = colorScheme.primary300+ .withValues(alpha: 0.1);+ } else {+ _emailInputFieldColor = null;+ }+ });+ },+ onFieldSubmitted: _emailIsValid+ ? (value) => _passwordFocusNode.requestFocus()+ : null,+ autocorrect: false,+ keyboardType: TextInputType.emailAddress,+ initialValue: _email,+ autofocus: true,+ ),+ const SizedBox(height: 24),+ Text(+ "Password",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 8),+ TextFormField(+ key: const ValueKey("passwordInputField"),+ autofillHints: const [AutofillHints.password],+ decoration: InputDecoration(+ hintText: "Enter your password",+ hintStyle: textTheme.body.copyWith(+ color: colorScheme.textMuted,+ ),+ filled: true,+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 14,+ ),+ border: OutlineInputBorder(+ borderSide: BorderSide.none,+ borderRadius: BorderRadius.circular(8),+ ),+ fillColor: colorScheme.fillFaint,+ suffixIcon: IconButton(+ icon: Icon(+ _passwordVisible+ ? Icons.visibility_outlined+ : Icons.visibility_off_outlined,+ color: colorScheme.textMuted,+ size: 20,+ ),+ onPressed: () {+ setState(() {+ _passwordVisible = !_passwordVisible;+ });+ },+ ),+ ),+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ controller: _passwordController,+ autofocus: false,+ autocorrect: false,+ obscureText: !_passwordVisible,+ keyboardType: TextInputType.visiblePassword,+ focusNode: _passwordFocusNode,+ onChanged: (_) {+ setState(() {});+ },+ ),+ Align(+ alignment: Alignment.centerRight,+ child: TextButton(+ onPressed: _handleForgotPassword,+ child: Text(+ "Forgot Password?",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ SizedBox(+ width: double.infinity,+ child: GradientButton(+ onTap: _emailIsValid &&+ _passwordController.text.isNotEmpty &&+ !_isLoggingIn+ ? () async {+ await _handleLogin();+ }+ : null,+ text: "Log in",+ ),+ ),+ const SizedBox(height: 16),+ Center(+ child: TextButton(+ onPressed: _handleSignUp,+ child: RichText(+ text: TextSpan(+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ children: [+ const TextSpan(text: "Don't have an account? "),+ TextSpan(+ text: "Sign up",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ const SizedBox(height: 24),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/onboarding_page.dart b/mobile/apps/locker/lib/ui/pages/onboarding_page.dartindex f135b4ed9d..95f9df00f3 100644--- a/mobile/apps/locker/lib/ui/pages/onboarding_page.dart+++ b/mobile/apps/locker/lib/ui/pages/onboarding_page.dart@@ -1,18 +1,16 @@-import 'package:ente_accounts/pages/email_entry_page.dart';-import 'package:ente_accounts/pages/login_page.dart';+import 'package:dots_indicator/dots_indicator.dart';import 'package:ente_accounts/pages/password_entry_page.dart';import 'package:ente_accounts/pages/password_reentry_page.dart';import 'package:ente_ui/components/buttons/button_widget.dart';-import 'package:ente_ui/components/buttons/gradient_button.dart';-import 'package:ente_ui/components/developer_settings_widget.dart';import "package:ente_ui/pages/developer_settings_page.dart";-import 'package:ente_ui/theme/ente_theme.dart';-import "package:ente_ui/theme/ente_theme_data.dart";+import "package:ente_ui/theme/ente_theme.dart";import 'package:ente_ui/utils/dialog_util.dart';import 'package:flutter/material.dart';import 'package:locker/l10n/l10n.dart';import 'package:locker/services/configuration.dart';+import "package:locker/ui/components/new_account_dialog.dart";import 'package:locker/ui/pages/home_page.dart';+import 'package:locker/ui/pages/login_page.dart';class OnboardingPage extends StatefulWidget {const OnboardingPage({super.key});@@ -24,167 +22,165 @@ class OnboardingPage extends StatefulWidget {class _OnboardingPageState extends State<OnboardingPage> {static const kDeveloperModeTapCountThreshold = 7;+ double _featureIndex = 0;int _developerModeTapCount = 0;@overrideWidget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);debugPrint("Building OnboardingPage");final l10n = context.l10n;return Scaffold(- body: SafeArea(- child: GestureDetector(- onTap: () async {- _developerModeTapCount++;- if (_developerModeTapCount >= kDeveloperModeTapCountThreshold) {- _developerModeTapCount = 0;- final result = await showChoiceDialog(- context,- title: l10n.developerSettings,- firstButtonLabel: l10n.yes,- body: l10n.developerSettingsWarning,- isDismissible: false,+ backgroundColor: colorScheme.primary700,+ body: GestureDetector(+ onTap: () async {+ _developerModeTapCount++;+ if (_developerModeTapCount >= kDeveloperModeTapCountThreshold) {+ _developerModeTapCount = 0;+ final result = await showChoiceDialog(+ context,+ title: l10n.developerSettings,+ firstButtonLabel: l10n.yes,+ body: l10n.developerSettingsWarning,+ isDismissible: false,+ );+ if (result?.action == ButtonAction.first) {+ await Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return DeveloperSettingsPage(Configuration.instance);+ },+ ),);- if (result?.action == ButtonAction.first) {- await Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return DeveloperSettingsPage(Configuration.instance);- },- ),- );- setState(() {});- }+ setState(() {});}- },- child: LayoutBuilder(- builder: (context, constraints) {- return SingleChildScrollView(- child: ConstrainedBox(- constraints: BoxConstraints(- minHeight: constraints.maxHeight,- maxWidth: 450,- ),- child: IntrinsicHeight(- child: Padding(- padding: const EdgeInsets.symmetric(- vertical: 40.0,- horizontal: 40,- ),- child: Column(- children: [- Expanded(- child: Column(- mainAxisAlignment: MainAxisAlignment.center,- children: [- Image.asset(- "assets/locker.png",- width: 200,- height: 200,- ),- const SizedBox(height: 12),- Text(- "ente",- style: getEnteTextTheme(context).h1.copyWith(- fontWeight: FontWeight.bold,- fontFamily: 'Montserrat',- ),- ),- const SizedBox(height: 4),- Text(- "Locker",- style: Theme.of(context)- .textTheme- .headlineMedium,- ),- const SizedBox(height: 32),- Text(- l10n.onBoardingBody,- textAlign: TextAlign.center,- style: Theme.of(context)- .textTheme- .titleLarge!- .copyWith(- color: Theme.of(context)- .colorScheme- .onBoardingBodyColor,- ),- ),- ],- ),+ }+ },+ child: SafeArea(+ child: Column(+ children: [+ Expanded(+ child: Center(+ child: SingleChildScrollView(+ child: Column(+ children: [+ const Padding(padding: EdgeInsets.all(12)),+ const Text(+ "Locker",+ style: TextStyle(+ color: Colors.white,+ fontSize: 32,+ fontWeight: FontWeight.w600,),- const SizedBox(height: 100),- Container(- width: double.infinity,- padding: const EdgeInsets.symmetric(horizontal: 20),- child: GradientButton(- onTap: _navigateToSignUpPage,- text: l10n.newUser,+ ),+ const Padding(padding: EdgeInsets.all(28)),+ _getFeatureSlider(),+ const Padding(padding: EdgeInsets.all(12)),+ DotsIndicator(+ dotsCount: 3,+ position: _featureIndex.toInt(),+ decorator: DotsDecorator(+ activeColor: Colors.white,+ color: Colors.white.withValues(alpha: 0.32),+ activeShape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(14),),- ),- const SizedBox(height: 16),- Container(- height: 56,- width: double.infinity,- padding: const EdgeInsets.fromLTRB(20, 0, 20, 0),- child: Hero(- tag: "log_in",- child: ElevatedButton(- style: Theme.of(context)- .colorScheme- .optionalActionButtonStyle,- onPressed: _navigateToSignInPage,- child: Text(- l10n.existingUser,- style: const TextStyle(- color: Colors.black, // same for both themes- ),- ),- ),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(14),),+ size: const Size(10, 10),+ activeSize: const Size(20, 10),+ spacing: const EdgeInsets.all(6),),- const SizedBox(height: 4),- DeveloperSettingsWidget(Configuration.instance),- ],- ),+ ),+ const Padding(padding: EdgeInsets.all(28)),+ ],),),),- );- },+ ),+ Container(+ width: double.infinity,+ padding: const EdgeInsets.symmetric(horizontal: 24),+ child: ElevatedButton(+ style: ElevatedButton.styleFrom(+ backgroundColor: Colors.white,+ foregroundColor: colorScheme.primary700,+ padding: const EdgeInsets.symmetric(+ horizontal: 8,+ vertical: 18,+ ),+ shape: RoundedRectangleBorder(+ borderRadius: BorderRadius.circular(20),+ ),+ minimumSize: const Size(double.infinity, 56),+ ),+ onPressed: _navigateToSignInPage,+ child: Text(+ "Log in to your Ente account",+ style: getEnteTextTheme(context).bodyBold.copyWith(+ color: colorScheme.primary700,+ ),+ ),+ ),+ ),+ const SizedBox(height: 16),+ Center(+ child: TextButton(+ onPressed: () {+ showCreateNewAccountDialog(+ context,+ title: "Unlock locker with a paid plan",+ body:+ "Locker is available only to Ente photos paid users. Upgrade to a paid plan from Photos to use Locker",+ buttonLabel: "Checkout Ente Photos",+ assetPath: "assets/file_lock.png",+ icon: const SizedBox.shrink(),+ );+ },+ child: Text(+ "I don't have an account",+ style: getEnteTextTheme(context).bodyBold.copyWith(+ color: Colors.white,+ decoration: TextDecoration.underline,+ decorationColor: Colors.white,+ ),+ ),+ ),+ ),+ const Padding(padding: EdgeInsets.all(20)),+ ],),),),);}- void _navigateToSignUpPage() {- Widget page;- if (Configuration.instance.getEncryptedToken() == null) {- page = EmailEntryPage(Configuration.instance);- } else {- // No key- if (Configuration.instance.getKeyAttributes() == null) {- // Never had a key- page = PasswordEntryPage(- Configuration.instance,- PasswordEntryMode.set,- const HomePage(),- );- } else if (Configuration.instance.getKey() == null) {- // Yet to decrypt the key- page = PasswordReentryPage(- Configuration.instance,- const HomePage(),- );- } else {- // All is well, user just has not subscribed- page = const HomePage();- }- }- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return page;+ Widget _getFeatureSlider() {+ return ConstrainedBox(+ constraints: const BoxConstraints(maxHeight: 420),+ child: PageView(+ children: const [+ FeatureItemWidget(+ "assets/onboarding_lock.png",+ "Save your important",+ "documents and credentials",+ ),+ FeatureItemWidget(+ "assets/onboarding_file.png",+ "Pass them on automatically in",+ "emergencies",+ ),+ FeatureItemWidget(+ "assets/onboarding_share.png",+ "Share them anytime",+ "",+ ),+ ],+ onPageChanged: (index) {+ setState(() {+ _featureIndex = double.parse(index.toString());+ });},),);@@ -193,7 +189,7 @@ class _OnboardingPageState extends State<OnboardingPage> {void _navigateToSignInPage() {Widget page;if (Configuration.instance.getEncryptedToken() == null) {- page = LoginPage(Configuration.instance);+ page = const LoginPage();} else {// No keyif (Configuration.instance.getKeyAttributes() == null) {@@ -224,3 +220,54 @@ class _OnboardingPageState extends State<OnboardingPage> {);}}++class FeatureItemWidget extends StatelessWidget {+ final String assetPath;+ final String featureTitleFirstLine;+ final String featureTitleSecondLine;++ const FeatureItemWidget(+ this.assetPath,+ this.featureTitleFirstLine,+ this.featureTitleSecondLine, {+ super.key,+ });++ @override+ Widget build(BuildContext context) {+ return Column(+ crossAxisAlignment: CrossAxisAlignment.stretch,+ children: [+ Image.asset(+ assetPath,+ height: 200,+ ),+ Column(+ crossAxisAlignment: CrossAxisAlignment.center,+ mainAxisAlignment: MainAxisAlignment.start,+ children: [+ Text(+ featureTitleFirstLine,+ style: const TextStyle(+ color: Colors.white,+ fontSize: 24,+ fontWeight: FontWeight.w600,+ ),+ textAlign: TextAlign.center,+ ),+ const Padding(padding: EdgeInsets.all(2)),+ Text(+ featureTitleSecondLine,+ style: const TextStyle(+ color: Colors.white,+ fontSize: 24,+ fontWeight: FontWeight.w600,+ ),+ textAlign: TextAlign.center,+ ),+ ],+ ),+ ],+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/pages/recovery_key_page.dart b/mobile/apps/locker/lib/ui/pages/recovery_key_page.dartnew file mode 100644index 0000000000..b817d8ca40--- /dev/null+++ b/mobile/apps/locker/lib/ui/pages/recovery_key_page.dart@@ -0,0 +1,150 @@+import 'package:ente_ui/components/buttons/gradient_button.dart';+import 'package:ente_ui/components/text_input_widget.dart';+import 'package:ente_ui/theme/ente_theme.dart';+import 'package:flutter/material.dart';++class RecoveryKeyPage extends StatefulWidget {+ const RecoveryKeyPage({super.key});++ @override+ State<RecoveryKeyPage> createState() => _RecoveryKeyPageState();+}++class _RecoveryKeyPageState extends State<RecoveryKeyPage> {+ String? _recoveryKey;+ final ValueNotifier<bool> _submitNotifier = ValueNotifier(false);++ @override+ void dispose() {+ _submitNotifier.dispose();+ super.dispose();+ }++ Future<void> _handleLogin() async {+ // TODO: Implement actual recovery key validation and login logic+ // For now, just simulate a delay+ await Future.delayed(const Duration(seconds: 1));+ }++ void _handleForgotRecoveryKey() {+ // TODO: Implement forgot recovery key logic+ }++ void _handleSignUp() {+ // TODO: Implement sign up navigation or dialog+ }++ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);++ return Scaffold(+ backgroundColor: colorScheme.backgroundBase,+ appBar: AppBar(+ backgroundColor: colorScheme.backgroundBase,+ elevation: 0,+ leading: IconButton(+ icon: Icon(Icons.arrow_back, color: colorScheme.primary700),+ onPressed: () => Navigator.of(context).pop(),+ ),+ title: Text(+ "Locker",+ style: textTheme.h3.copyWith(+ color: colorScheme.primary700,+ fontWeight: FontWeight.w600,+ ),+ ),+ centerTitle: true,+ ),+ body: SafeArea(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 24.0),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ Expanded(+ child: SingleChildScrollView(+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const SizedBox(height: 48),+ TextInputWidget(+ label: "Recovery key",+ hintText: "Enter your recovery key",+ initialValue: _recoveryKey,+ autoFocus: true,+ textCapitalization: TextCapitalization.none,+ onChange: (value) {+ setState(() {+ _recoveryKey = value;+ });+ },+ submitNotifier: _submitNotifier,+ onSubmit: (value) async {+ _recoveryKey = value;+ await _handleLogin();+ },+ shouldSurfaceExecutionStates: false,+ ),+ Align(+ alignment: Alignment.centerRight,+ child: TextButton(+ onPressed: _handleForgotRecoveryKey,+ child: Text(+ "Forgot Recovery key?",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),+ ),+ ),+ ],+ ),+ ),+ ),+ SizedBox(+ width: double.infinity,+ child: GradientButton(+ onTap: _recoveryKey != null && _recoveryKey!.isNotEmpty+ ? () async {+ _submitNotifier.value = !_submitNotifier.value;+ }+ : null,+ text: "Log In",+ ),+ ),+ const SizedBox(height: 16),+ Center(+ child: TextButton(+ onPressed: _handleSignUp,+ child: RichText(+ text: TextSpan(+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ children: [+ const TextSpan(text: "Don't have an account? "),+ TextSpan(+ text: "Sign up",+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),+ ],+ ),+ ),+ ),+ ),+ const SizedBox(height: 24),+ ],+ ),+ ),+ ),+ );+ }+}diff --git a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dartindex ca2f158b51..5575242aab 100644--- a/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart+++ b/mobile/apps/locker/lib/ui/viewer/actions/file_selection_overlay_bar.dart@@ -1,4 +1,4 @@-import "package:ente_ui/components/buttons/models/button_result.dart";+import "package:ente_ui/components/buttons/button_widget.dart";import "package:ente_ui/theme/ente_theme.dart";import "package:ente_ui/utils/dialog_util.dart";import "package:flutter/material.dart";@@ -454,8 +454,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {Future<void> _showEditDialog(BuildContext context, EnteFile file) async {final allCollections = await CollectionService.instance.getCollections();- final dedupedCollections =- uniqueCollectionsById(allCollections, logger: _logger);+ final dedupedCollections = uniqueCollectionsById(allCollections);final result = await showFileEditDialog(context,@@ -552,8 +551,7 @@ class _FileSelectionOverlayBarState extends State<FileSelectionOverlayBar> {'Opening add-to dialog for ${files.length} file(s); fetching collections.',);final allCollections = await CollectionService.instance.getCollections();- final dedupedCollections =- uniqueCollectionsById(allCollections, logger: _logger);+ final dedupedCollections = uniqueCollectionsById(allCollections);_logger.info('Presenting ${dedupedCollections.length} unique collection option(s) ''to add files to.',