π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Update the login flow
AmanRajSinghMourya4f4f469584e3
diff --git a/mobile/apps/photos/lib/ui/account/login_page.dart b/mobile/apps/photos/lib/ui/account/login_page.dartindex f73278e89a..d60696ba45 100644--- a/mobile/apps/photos/lib/ui/account/login_page.dart+++ b/mobile/apps/photos/lib/ui/account/login_page.dart@@ -14,10 +14,8 @@ import "package:photos/theme/ente_theme.dart";import "package:photos/theme/text_style.dart";import "package:photos/ui/account/login_pwd_verification_page.dart";import 'package:photos/ui/common/dynamic_fab.dart';-import 'package:photos/ui/common/web_page.dart';import "package:photos/ui/components/models/text_input_type_v2.dart";import "package:photos/ui/components/text_input_widget_v2.dart";-import "package:styled_text/styled_text.dart";class LoginPage extends StatefulWidget {const LoginPage({super.key});@@ -27,7 +25,6 @@ class LoginPage extends StatefulWidget {}class _LoginPageState extends State<LoginPage> {- final _config = Configuration.instance;final _emailController = TextEditingController();bool _emailIsValid = false;bool _showValidationMessage = false;@@ -38,9 +35,7 @@ class _LoginPageState extends State<LoginPage> {@overridevoid didChangeDependencies() {super.didChangeDependencies();- if ((_config.getEmail() ?? '').isNotEmpty) {- _updateEmail(_config.getEmail()!);- } else if (kDebugMode) {+ if (kDebugMode) {_updateEmail(const String.fromEnvironment("email"));}}@@ -110,75 +105,35 @@ class _LoginPageState extends State<LoginPage> {Widget _getBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {return AutofillGroup(- child: ListView(+ child: Padding(padding: const EdgeInsets.symmetric(horizontal: 16),- children: [- const SizedBox(height: 20),- TextInputWidgetV2(- key: const ValueKey("emailInputField"),- label: AppLocalizations.of(context).email,- hintText: AppLocalizations.of(context).enterYourEmailAddress,- textEditingController: _emailController,- keyboardType: TextInputType.emailAddress,- autoCorrect: false,- autoFocus: true,- isRequired: true,- onChange: _onEmailChanged,- message: _showValidationMessage- ? (_emailIsValid- ? AppLocalizations.of(context).validEmailAddress- : AppLocalizations.of(context).invalidEmailAddress)- : null,- messageType: _showValidationMessage- ? (_emailIsValid- ? TextInputMessageType.success- : TextInputMessageType.alert)- : TextInputMessageType.guide,- ),- const SizedBox(height: 20),- StyledText(- text: AppLocalizations.of(context).loginTerms,- style: textTheme.small.copyWith(- color: colorScheme.textMuted,+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const SizedBox(height: 20),+ TextInputWidgetV2(+ key: const ValueKey("emailInputField"),+ label: AppLocalizations.of(context).email,+ hintText: AppLocalizations.of(context).enterYourEmailAddress,+ textEditingController: _emailController,+ keyboardType: TextInputType.emailAddress,+ autoCorrect: false,+ autoFocus: true,+ isRequired: true,+ onChange: _onEmailChanged,+ message: _showValidationMessage+ ? (_emailIsValid+ ? AppLocalizations.of(context).validEmailAddress+ : AppLocalizations.of(context).invalidEmailAddress)+ : null,+ messageType: _showValidationMessage+ ? (_emailIsValid+ ? TextInputMessageType.success+ : TextInputMessageType.alert)+ : TextInputMessageType.guide,),- tags: {- 'u-terms': StyledTextActionTag(- (String? text, Map<String?, String?> attrs) =>- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return WebPage(- AppLocalizations.of(context).termsOfServicesTitle,- "https://ente.io/terms",- );- },- ),- ),- style: TextStyle(- decoration: TextDecoration.underline,- color: colorScheme.textMuted,- ),- ),- 'u-policy': StyledTextActionTag(- (String? text, Map<String?, String?> attrs) =>- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return WebPage(- AppLocalizations.of(context).privacyPolicyTitle,- "https://ente.io/privacy",- );- },- ),- ),- style: TextStyle(- decoration: TextDecoration.underline,- color: colorScheme.textMuted,- ),- ),- },- ),- ],+ ],+ ),),);}diff --git a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart b/mobile/apps/photos/lib/ui/account/ott_verification_page.dartindex ac501b7550..09eb42da69 100644--- a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart+++ b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart@@ -1,11 +1,11 @@import 'package:flutter/material.dart';-import 'package:photos/ente_theme_data.dart';import "package:photos/generated/l10n.dart";import 'package:photos/services/account/user_service.dart';+import "package:photos/theme/colors.dart";import "package:photos/theme/ente_theme.dart";-import 'package:photos/ui/common/dynamic_fab.dart';-import 'package:step_progress_indicator/step_progress_indicator.dart';-import "package:styled_text/styled_text.dart";+import "package:photos/theme/text_style.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:pinput/pinput.dart";class OTTVerificationPage extends StatefulWidget {final String email;@@ -26,198 +26,170 @@ class OTTVerificationPage extends StatefulWidget {}class _OTTVerificationPageState extends State<OTTVerificationPage> {- final _verificationCodeController = TextEditingController();+ final _pinController = TextEditingController();+ String _code = "";@override- Widget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;+ void dispose() {+ _pinController.dispose();+ super.dispose();+ }- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ @override+ Widget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,+ backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,+ scrolledUnderElevation: 0,+ backgroundColor: colorScheme.backgroundColour,leading: IconButton(icon: const Icon(Icons.arrow_back),- color: Theme.of(context).iconTheme.color,+ color: colorScheme.content,onPressed: () {Navigator.of(context).pop();},),- title: widget.isCreateAccountScreen- ? Material(- type: MaterialType.transparency,- child: StepProgressIndicator(- totalSteps: 4,- currentStep: 2,- selectedColor: Theme.of(context).colorScheme.greenAlternative,- roundedEdges: const Radius.circular(10),- unselectedColor:- Theme.of(context).colorScheme.stepProgressUnselectedColor,- ),- )- : null,- ),- body: _getBody(),- floatingActionButton: DynamicFAB(- key: const ValueKey("verifyOttButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _verificationCodeController.text.isNotEmpty,- buttonText: AppLocalizations.of(context).verify,- onPressedFunction: () {- if (widget.isChangeEmail) {- UserService.instance.changeEmail(- context,- widget.email,- _verificationCodeController.text,- );- } else {- UserService.instance.verifyEmail(- context,- _verificationCodeController.text,- isResettingPasswordScreen: widget.isResetPasswordScreen,- );- }- FocusScope.of(context).unfocus();- },+ title: Text(+ "ente",+ style: textTheme.h3Bold.copyWith(+ fontFamily: "Montserrat",+ ),+ ),+ centerTitle: true,),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ body: _getBody(colorScheme, textTheme),);}- Widget _getBody() {- return ListView(+ Widget _getBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {+ final defaultPinTheme = PinTheme(+ height: 52,+ width: 48,+ textStyle: textTheme.body.copyWith(color: colorScheme.textBase),+ decoration: BoxDecoration(+ border: Border.all(color: colorScheme.strokeMuted),+ borderRadius: BorderRadius.circular(20),+ ),+ );++ final focusedPinTheme = defaultPinTheme.copyWith(+ decoration: BoxDecoration(+ border: Border.all(color: colorScheme.greenBase, width: 2),+ borderRadius: BorderRadius.circular(20),+ ),+ );++ final submittedPinTheme = defaultPinTheme.copyWith(+ textStyle: textTheme.body.copyWith(color: colorScheme.greenBase),+ decoration: BoxDecoration(+ color: colorScheme.greenLight,+ border: Border.all(color: colorScheme.greenBase, width: 2),+ borderRadius: BorderRadius.circular(20),+ ),+ );++ return Column(children: [- Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(20, 30, 20, 15),- child: Text(- AppLocalizations.of(context).verifyEmail,- style: Theme.of(context).textTheme.headlineMedium,+ Expanded(+ child: ListView(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ children: [+ Center(+ child: Image.asset(+ 'assets/ott.png',+ height: 96,+ ),),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),- child: Row(- children: [- Expanded(- child: Column(- crossAxisAlignment: CrossAxisAlignment.start,- children: [- Padding(- padding: const EdgeInsets.fromLTRB(0, 0, 0, 12),- child: StyledText(- text: AppLocalizations.of(context)- .weHaveSendEmailTo(email: widget.email),- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(fontSize: 14),- tags: {- 'green': StyledTextTag(- style: TextStyle(- color: Theme.of(context)- .colorScheme- .greenAlternative,- ),- ),- },- ),- ),- widget.isResetPasswordScreen- ? Text(- AppLocalizations.of(context).toResetVerifyEmail,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(fontSize: 14),- )- : Text(- AppLocalizations.of(context)- .checkInboxAndSpamFolder,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(fontSize: 14),- ),- ],- ),- ),- SizedBox(- width: MediaQuery.of(context).size.width * 0.2,- height: 1,- ),- ],+ const SizedBox(height: 24),+ Text(+ AppLocalizations.of(context)+ .weHaveSentCodeTo(email: widget.email),+ style: textTheme.body.copyWith(color: colorScheme.textBase),+ textAlign: TextAlign.center,),- ),- Padding(- padding: const EdgeInsets.fromLTRB(20, 16, 20, 16),- child: TextFormField(- key: const ValueKey("ottVerificationInputField"),- style: Theme.of(context).textTheme.titleMedium,- decoration: InputDecoration(- filled: true,- hintText: AppLocalizations.of(context).tapToEnterCode,- contentPadding: const EdgeInsets.all(15),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(6),- ),- fillColor: getEnteColorScheme(context).fillFaint,+ const SizedBox(height: 8),+ Text(+ widget.isResetPasswordScreen+ ? AppLocalizations.of(context).toResetVerifyEmail+ : AppLocalizations.of(context).checkInboxAndSpamFolder,+ style: textTheme.body.copyWith(color: colorScheme.textMuted),+ textAlign: TextAlign.center,+ ),+ const SizedBox(height: 32),+ Center(+ child: Pinput(+ length: 6,+ controller: _pinController,+ autofocus: true,+ defaultPinTheme: defaultPinTheme,+ focusedPinTheme: focusedPinTheme,+ submittedPinTheme: submittedPinTheme,+ followingPinTheme: defaultPinTheme,+ keyboardType: TextInputType.number,+ onChanged: (String pin) {+ setState(() {+ _code = pin;+ });+ },),- controller: _verificationCodeController,- autofocus: false,- autocorrect: false,- keyboardType: TextInputType.number,- onChanged: (_) {- setState(() {});- },),- ),- Divider(- thickness: 1,- color: getEnteColorScheme(context).strokeFaint,- ),- Padding(- padding: const EdgeInsets.all(20),- child: Row(- mainAxisAlignment: MainAxisAlignment.end,- children: [- TextButton(- onPressed: () {- UserService.instance.sendOtt(- context,- widget.email,- isCreateAccountScreen: widget.isCreateAccountScreen,- isResetPasswordScreen: widget.isResetPasswordScreen,- isChangeEmail: widget.isChangeEmail,- );- },- child: Text(- AppLocalizations.of(context).resendEmail,- style: Theme.of(context).textTheme.titleMedium!.copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),- ),- ),- ],+ const SizedBox(height: 24),+ Align(+ alignment: Alignment.centerRight,+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.link,+ labelText: AppLocalizations.of(context).resendCode,+ buttonSize: ButtonSizeV2.small,+ onTap: () async {+ // ignore: unawaited_futures+ UserService.instance.sendOtt(+ context,+ widget.email,+ isCreateAccountScreen: widget.isCreateAccountScreen,+ isResetPasswordScreen: widget.isResetPasswordScreen,+ isChangeEmail: widget.isChangeEmail,+ );+ },+ ),),+ ],+ ),+ ),+ SafeArea(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("verifyOttButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).verify,+ isDisabled: _code.length != 6,+ onTap: () async {+ if (widget.isChangeEmail) {+ // ignore: unawaited_futures+ UserService.instance.changeEmail(+ context,+ widget.email,+ _pinController.text,+ );+ } else {+ // ignore: unawaited_futures+ UserService.instance.verifyEmail(+ context,+ _pinController.text,+ isResettingPasswordScreen: widget.isResetPasswordScreen,+ );+ }+ FocusScope.of(context).unfocus();+ },),- ],+ ),),],);- // );}}diff --git a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart b/mobile/apps/photos/lib/ui/account/password_reentry_page.dartindex 0ff819bd07..9b34fcfb8d 100644--- a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart+++ b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart@@ -11,10 +11,15 @@ import 'package:photos/events/subscription_purchased_event.dart';import "package:photos/generated/l10n.dart";import "package:photos/service_locator.dart";import "package:photos/services/account/user_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/account/recovery_page.dart';import 'package:photos/ui/common/dynamic_fab.dart';-import 'package:photos/ui/components/buttons/button_widget.dart';+import 'package:photos/ui/components/buttons/button_widget.dart'+ show ButtonAction;+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/components/text_input_widget_v2.dart";import 'package:photos/ui/tabs/home_widget.dart';import 'package:photos/utils/dialog_util.dart';import 'package:photos/utils/email_util.dart';@@ -29,10 +34,7 @@ class PasswordReentryPage extends StatefulWidget {class _PasswordReentryPageState extends State<PasswordReentryPage> {final _logger = Logger((_PasswordReentryPageState).toString());final _passwordController = TextEditingController();- final FocusNode _passwordFocusNode = FocusNode();String? email;- bool _passwordInFocus = false;- bool _passwordVisible = false;String? _volatilePassword;@override@@ -47,23 +49,19 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {() => verifyPassword(_volatilePassword!),);}- _passwordFocusNode.addListener(() {- setState(() {- _passwordInFocus = _passwordFocusNode.hasFocus;- });- });}@overridevoid dispose() {_passwordController.dispose();- _passwordFocusNode.dispose();super.dispose();}@overrideWidget build(BuildContext context) {final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);FloatingActionButtonLocation? fabLocation() {if (isKeypadOpen) {@@ -75,22 +73,32 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {return Scaffold(resizeToAvoidBottomInset: isKeypadOpen,+ backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,+ scrolledUnderElevation: 0,+ backgroundColor: colorScheme.backgroundColour,leading: IconButton(icon: const Icon(Icons.arrow_back),- color: Theme.of(context).iconTheme.color,+ color: colorScheme.content,onPressed: () {Navigator.of(context).pop();},),+ title: Text(+ "ente",+ style: textTheme.h3Bold.copyWith(+ fontFamily: "Montserrat",+ ),+ ),+ centerTitle: true,),- body: _getBody(),+ body: _getBody(colorScheme, textTheme),floatingActionButton: DynamicFAB(key: const ValueKey("verifyPasswordButton"),isKeypadOpen: isKeypadOpen,isFormValid: _passwordController.text.isNotEmpty,- buttonText: AppLocalizations.of(context).verifyPassword,+ buttonText: AppLocalizations.of(context).logInLabel,onPressedFunction: () async {FocusScope.of(context).unfocus();await verifyPassword(_passwordController.text);@@ -188,142 +196,81 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {}}- Widget _getBody() {- return Column(- children: [- Expanded(- child: AutofillGroup(- child: ListView(- children: [- Padding(- padding:- const EdgeInsets.symmetric(vertical: 30, horizontal: 20),- child: Text(- AppLocalizations.of(context).welcomeBack,- style: Theme.of(context).textTheme.headlineMedium,- ),+ Widget _getBody(EnteColorScheme colorScheme, EnteTextTheme textTheme) {+ return SafeArea(+ child: AutofillGroup(+ child: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,+ children: [+ const SizedBox(height: 12),+ Visibility(+ // hidden textForm for suggesting auto-fill service for saving+ // password+ visible: false,+ child: TextFormField(+ autofillHints: const [+ AutofillHints.email,+ ],+ autocorrect: false,+ keyboardType: TextInputType.emailAddress,+ initialValue: email,+ textInputAction: TextInputAction.next,),- Visibility(- // hidden textForm for suggesting auto-fill service for saving- // password- visible: false,- child: TextFormField(- autofillHints: const [- AutofillHints.email,- ],- autocorrect: false,- keyboardType: TextInputType.emailAddress,- initialValue: email,- textInputAction: TextInputAction.next,- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),- child: TextFormField(- key: const ValueKey("passwordInputField"),- autofillHints: const [AutofillHints.password],- decoration: InputDecoration(- hintText: AppLocalizations.of(context).enterYourPassword,- filled: true,- fillColor: getEnteColorScheme(context).fillFaint,- contentPadding: const EdgeInsets.all(20),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(6),- ),- suffixIcon: _passwordInFocus- ? IconButton(- icon: Icon(- _passwordVisible- ? Icons.visibility- : Icons.visibility_off,- color: Theme.of(context).iconTheme.color,- size: 20,- ),- onPressed: () {- setState(() {- _passwordVisible = !_passwordVisible;- });- },- )- : null,- ),- style: const TextStyle(- fontSize: 14,- ),- controller: _passwordController,- autofocus: true,- autocorrect: false,- obscureText: !_passwordVisible,- keyboardType: TextInputType.visiblePassword,- focusNode: _passwordFocusNode,- onChanged: (_) {- setState(() {});+ ),+ TextInputWidgetV2(+ key: const ValueKey("passwordInputField"),+ label: AppLocalizations.of(context).password,+ isRequired: true,+ hintText: AppLocalizations.of(context).enterYourPassword,+ textEditingController: _passwordController,+ isPasswordInput: true,+ autoCorrect: false,+ onChange: (value) {+ setState(() {});+ },+ ),+ const SizedBox(height: 16),+ Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.link,+ labelText: AppLocalizations.of(context).changeEmail,+ buttonSize: ButtonSizeV2.small,+ onTap: () async {+ final dialog = createProgressDialog(+ context,+ AppLocalizations.of(context).pleaseWait,+ );+ await dialog.show();+ await Configuration.instance.logout();+ await dialog.hide();+ Navigator.of(context).popUntil((route) => route.isFirst);},),- ),- Padding(- padding: const EdgeInsets.symmetric(vertical: 18),- child: Divider(- thickness: 1,- color: getEnteColorScheme(context).strokeFaint,- ),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 20),- child: Wrap(- alignment: WrapAlignment.spaceBetween,- children: [- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return const RecoveryPage();- },- ),- );- },- child: Text(- AppLocalizations.of(context).forgotPassword,- style:- Theme.of(context).textTheme.titleMedium!.copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),- ),- ),- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () async {- final dialog = createProgressDialog(- context,- AppLocalizations.of(context).pleaseWait,- );- await dialog.show();- await Configuration.instance.logout();- await dialog.hide();- Navigator.of(context)- .popUntil((route) => route.isFirst);- },- child: Text(- AppLocalizations.of(context).changeEmail,- style:- Theme.of(context).textTheme.titleMedium!.copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),+ ButtonWidgetV2(+ buttonType: ButtonTypeV2.link,+ labelText: AppLocalizations.of(context).forgotPassword,+ buttonSize: ButtonSizeV2.small,+ onTap: () async {+ // ignore: unawaited_futures+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return const RecoveryPage();+ },),- ),- ],+ );+ },),- ),- ],- ),+ ],+ ),+ ],),),- ],+ ),);}}diff --git a/mobile/apps/photos/lib/ui/account/recovery_page.dart b/mobile/apps/photos/lib/ui/account/recovery_page.dartindex 1e76007d90..4a177f9942 100644--- a/mobile/apps/photos/lib/ui/account/recovery_page.dart+++ b/mobile/apps/photos/lib/ui/account/recovery_page.dart@@ -4,6 +4,8 @@ import "package:photos/generated/l10n.dart";import "package:photos/theme/ente_theme.dart";import 'package:photos/ui/account/password_entry_page.dart';import 'package:photos/ui/common/dynamic_fab.dart';+import "package:photos/ui/components/buttons/button_widget_v2.dart";+import "package:photos/ui/components/text_input_widget_v2.dart";import 'package:photos/ui/notification/toast.dart';import 'package:photos/utils/dialog_util.dart';@@ -15,11 +17,14 @@ class RecoveryPage extends StatefulWidget {}class _RecoveryPageState extends State<RecoveryPage> {- final _recoveryKey = TextEditingController();+ final _recoveryKeyController = TextEditingController();@overrideWidget build(BuildContext context) {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;+FloatingActionButtonLocation? fabLocation() {if (isKeypadOpen) {return null;@@ -30,148 +35,117 @@ class _RecoveryPageState extends State<RecoveryPage> {return Scaffold(resizeToAvoidBottomInset: isKeypadOpen,+ backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,+ scrolledUnderElevation: 0,+ backgroundColor: colorScheme.backgroundColour,leading: IconButton(icon: const Icon(Icons.arrow_back),- color: Theme.of(context).iconTheme.color,+ color: colorScheme.content,onPressed: () {Navigator.of(context).pop();},),+ title: Text(+ "ente",+ style: textTheme.h3Bold.copyWith(+ fontFamily: "Montserrat",+ ),+ ),+ centerTitle: true,),+ body: _getBody(),floatingActionButton: DynamicFAB(+ key: const ValueKey("recoveryButton"),isKeypadOpen: isKeypadOpen,- isFormValid: _recoveryKey.text.isNotEmpty,- buttonText: AppLocalizations.of(context).recoverButton,- onPressedFunction: () async {- FocusScope.of(context).unfocus();- final dialog = createProgressDialog(- context,- AppLocalizations.of(context).decrypting,- );- await dialog.show();- try {- await Configuration.instance.recover(_recoveryKey.text.trim());- await dialog.hide();- showShortToast(- context,- AppLocalizations.of(context).recoverySuccessful,- );- // ignore: unawaited_futures- Navigator.of(context).pushReplacement(- MaterialPageRoute(- builder: (BuildContext context) {- return const PopScope(- canPop: false,- child: PasswordEntryPage(- mode: PasswordEntryMode.reset,- ),- );- },- ),- );- } catch (e) {- await dialog.hide();- String errMessage =- AppLocalizations.of(context).incorrectRecoveryKeyBody;- if (e is AssertionError) {- errMessage = '$errMessage : ${e.message}';- }- // ignore: unawaited_futures- showErrorDialog(- context,- AppLocalizations.of(context).incorrectRecoveryKeyTitle,- errMessage,- );- }- },+ isFormValid: _recoveryKeyController.text.isNotEmpty,+ buttonText: AppLocalizations.of(context).logInLabel,+ onPressedFunction: _onRecoverPressed,),floatingActionButtonLocation: fabLocation(),floatingActionButtonAnimator: NoScalingAnimation(),- body: Column(+ );+ }++ Widget _getBody() {+ return SafeArea(+ child: ListView(+ padding: const EdgeInsets.symmetric(horizontal: 16),children: [- Expanded(- child: ListView(- children: [- Padding(- padding:- const EdgeInsets.symmetric(vertical: 30, horizontal: 20),- child: Text(- AppLocalizations.of(context).forgotPassword,- style: Theme.of(context).textTheme.headlineMedium,- ),- ),- Padding(- padding: const EdgeInsets.fromLTRB(20, 24, 20, 0),- child: TextFormField(- decoration: InputDecoration(- filled: true,- fillColor: getEnteColorScheme(context).fillFaint,- hintText:- AppLocalizations.of(context).enterYourRecoveryKey,- contentPadding: const EdgeInsets.all(20),- border: UnderlineInputBorder(- borderSide: BorderSide.none,- borderRadius: BorderRadius.circular(6),- ),- ),- style: const TextStyle(- fontSize: 14,- fontFeatures: [FontFeature.tabularFigures()],- ),- controller: _recoveryKey,- autofocus: false,- autocorrect: false,- keyboardType: TextInputType.multiline,- maxLines: null,- onChanged: (_) {- setState(() {});- },- ),- ),- Padding(- padding: const EdgeInsets.symmetric(vertical: 18),- child: Divider(- thickness: 1,- color: getEnteColorScheme(context).strokeFaint,- ),- ),- Row(- children: [- GestureDetector(- behavior: HitTestBehavior.translucent,- onTap: () {- showErrorDialog(- context,- AppLocalizations.of(context).sorry,- AppLocalizations.of(context)- .noRecoveryKeyNoDecryption,- );- },- child: Container(- padding: const EdgeInsets.symmetric(horizontal: 20),- child: Center(- child: Text(- AppLocalizations.of(context).noRecoveryKey,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),- ),- ),- ),- ),- ],- ),- ],+ const SizedBox(height: 12),+ TextInputWidgetV2(+ label: AppLocalizations.of(context).recoveryKey,+ hintText: AppLocalizations.of(context).enterYourRecoveryKey,+ textEditingController: _recoveryKeyController,+ maxLines: null,+ minLines: 5,+ autoCorrect: false,+ onChange: (value) {+ setState(() {});+ },+ ),+ const SizedBox(height: 16),+ Align(+ alignment: Alignment.centerRight,+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.link,+ labelText: AppLocalizations.of(context).noRecoveryKey,+ buttonSize: ButtonSizeV2.small,+ onTap: () async {+ // ignore: unawaited_futures+ showErrorDialog(+ context,+ AppLocalizations.of(context).sorry,+ AppLocalizations.of(context).noRecoveryKeyNoDecryption,+ );+ },),),],),);}++ Future<void> _onRecoverPressed() async {+ FocusScope.of(context).unfocus();+ final dialog = createProgressDialog(+ context,+ AppLocalizations.of(context).decrypting,+ );+ await dialog.show();+ try {+ await Configuration.instance.recover(_recoveryKeyController.text.trim());+ await dialog.hide();+ showShortToast(+ context,+ AppLocalizations.of(context).recoverySuccessful,+ );+ // ignore: unawaited_futures+ Navigator.of(context).pushReplacement(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return const PopScope(+ canPop: false,+ child: PasswordEntryPage(+ mode: PasswordEntryMode.reset,+ ),+ );+ },+ ),+ );+ } catch (e) {+ await dialog.hide();+ String errMessage = AppLocalizations.of(context).incorrectRecoveryKeyBody;+ if (e is AssertionError) {+ errMessage = '$errMessage : ${e.message}';+ }+ // ignore: unawaited_futures+ showErrorDialog(+ context,+ AppLocalizations.of(context).incorrectRecoveryKeyTitle,+ errMessage,+ );+ }+ }}