π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
refactor: Simplify PasswordReentryPage UI and enhance theme integration
AmanRajSinghMouryae1a6bf29467e
diff --git a/mobile/packages/accounts/lib/pages/password_reentry_page.dart b/mobile/packages/accounts/lib/pages/password_reentry_page.dartindex 4078cd1ffe..cf7855da55 100644--- a/mobile/packages/accounts/lib/pages/password_reentry_page.dart+++ b/mobile/packages/accounts/lib/pages/password_reentry_page.dart@@ -9,6 +9,7 @@ import 'package:ente_strings/ente_strings.dart';import 'package:ente_ui/components/buttons/button_widget.dart';import 'package:ente_ui/components/buttons/dynamic_fab.dart';import 'package:ente_ui/pages/base_home_page.dart';+import 'package:ente_ui/theme/ente_theme.dart';import 'package:ente_ui/utils/dialog_util.dart';import 'package:ente_utils/email_util.dart';import 'package:flutter/material.dart';@@ -31,9 +32,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;@@ -49,16 +48,12 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {() => verifyPassword(_volatilePassword!, usingVolatilePassword: true),);}- _passwordFocusNode.addListener(() {- setState(() {- _passwordInFocus = _passwordFocusNode.hasFocus;- });- });}@overrideWidget build(BuildContext context) {final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;+ final colorScheme = getEnteColorScheme(context);FloatingActionButtonLocation? fabLocation() {if (isKeypadOpen) {@@ -70,11 +65,18 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {return Scaffold(resizeToAvoidBottomInset: isKeypadOpen,+ backgroundColor: colorScheme.backgroundBase,appBar: AppBar(elevation: 0,+ backgroundColor: colorScheme.backgroundBase,+ centerTitle: true,+ title: Image.asset(+ 'assets/locker-logo-blue.png',+ height: 24,+ ),leading: IconButton(icon: const Icon(Icons.arrow_back),- color: Theme.of(context).iconTheme.color,+ color: colorScheme.primary700,onPressed: () {Navigator.of(context).pop();},@@ -85,7 +87,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {key: const ValueKey("verifyPasswordButton"),isKeypadOpen: isKeypadOpen,isFormValid: _passwordController.text.isNotEmpty,- buttonText: context.strings.verifyPassword,+ buttonText: context.strings.logInLabel,onPressedFunction: () async {FocusScope.of(context).unfocus();await verifyPassword(_passwordController.text);@@ -189,6 +191,9 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {}Widget _getBody() {+ final colorScheme = getEnteColorScheme(context);+ final textTheme = getEnteTextTheme(context);+return Column(children: [Expanded(@@ -196,134 +201,129 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {child: ListView(children: [Padding(- padding:- const EdgeInsets.symmetric(vertical: 30, horizontal: 20),- child: Text(- context.strings.welcomeBack,- style: Theme.of(context).textTheme.headlineMedium,- ),- ),- 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: context.strings.enterYourPasswordHint,- filled: true,- 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(() {});- },- ),- ),- const Padding(- padding: EdgeInsets.symmetric(vertical: 18),- child: Divider(- thickness: 1,- ),- ),- Padding(- padding: const EdgeInsets.symmetric(horizontal: 20),- child: Row(- mainAxisAlignment: MainAxisAlignment.spaceBetween,+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: Column(+ crossAxisAlignment: CrossAxisAlignment.start,children: [- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () {- Navigator.of(context).push(- MaterialPageRoute(- builder: (BuildContext context) {- return RecoveryPage(- widget.config,- widget.homePage,- );- },+ const SizedBox(height: 24),+ Text(+ context.strings.password,+ style: textTheme.bodyBold.copyWith(+ color: colorScheme.textBase,+ ),+ ),+ const SizedBox(height: 8),+ 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,+ ),+ ),+ TextFormField(+ key: const ValueKey("passwordInputField"),+ autofillHints: const [AutofillHints.password],+ decoration: InputDecoration(+ fillColor: colorScheme.backdropBase,+ filled: true,+ hintText: context.strings.enterYourPasswordHint,+ hintStyle: TextStyle(color: colorScheme.textMuted),+ contentPadding: const EdgeInsets.symmetric(+ horizontal: 16,+ vertical: 14,+ ),+ border: OutlineInputBorder(+ borderSide: BorderSide.none,+ borderRadius: BorderRadius.circular(8),+ ),+ enabledBorder: OutlineInputBorder(+ borderSide: BorderSide.none,+ borderRadius: BorderRadius.circular(8),+ ),+ suffixIcon: IconButton(+ icon: Icon(+ _passwordVisible+ ? Icons.visibility+ : Icons.visibility_off,+ color: colorScheme.textMuted,+ size: 20,),- );- },- child: Center(- child: Text(- context.strings.forgotPassword,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- fontSize: 14,- decoration: TextDecoration.underline,- ),+ onPressed: () {+ setState(() {+ _passwordVisible = !_passwordVisible;+ });+ },),),- ),- GestureDetector(- behavior: HitTestBehavior.opaque,- onTap: () async {- final dialog = createProgressDialog(- context,- context.strings.pleaseWait,- );- await dialog.show();- await widget.config.logout();- await dialog.hide();- Navigator.of(context)- .popUntil((route) => route.isFirst);+ style: textTheme.body.copyWith(+ color: colorScheme.textBase,+ ),+ controller: _passwordController,+ autofocus: true,+ autocorrect: false,+ obscureText: !_passwordVisible,+ keyboardType: TextInputType.visiblePassword,+ onChanged: (_) {+ setState(() {});},- child: Center(- child: Text(- context.strings.changeEmail,- style: Theme.of(context)- .textTheme- .titleMedium!- .copyWith(- fontSize: 14,- decoration: TextDecoration.underline,+ ),+ const SizedBox(height: 16),+ Row(+ mainAxisAlignment: MainAxisAlignment.spaceBetween,+ children: [+ GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () {+ Navigator.of(context).push(+ MaterialPageRoute(+ builder: (BuildContext context) {+ return RecoveryPage(+ widget.config,+ widget.homePage,+ );+ },),+ );+ },+ child: Text(+ "${context.strings.forgotPassword}?",+ style: textTheme.body.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),),- ),+ GestureDetector(+ behavior: HitTestBehavior.opaque,+ onTap: () async {+ final dialog = createProgressDialog(+ context,+ context.strings.pleaseWait,+ );+ await dialog.show();+ await widget.config.logout();+ await dialog.hide();+ Navigator.of(context)+ .popUntil((route) => route.isFirst);+ },+ child: Text(+ context.strings.changeEmail,+ style: textTheme.body.copyWith(+ color: colorScheme.primary700,+ decoration: TextDecoration.underline,+ decorationColor: colorScheme.primary700,+ ),+ ),+ ),+ ],),],),