π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
update FAB with Button widget
AmanRajSinghMourya0f4629f7a42e
diff --git a/mobile/apps/photos/lib/emergency/recover_others_account.dart b/mobile/apps/photos/lib/emergency/recover_others_account.dartindex 1c2ec435e1..7229919d84 100644--- a/mobile/apps/photos/lib/emergency/recover_others_account.dart+++ b/mobile/apps/photos/lib/emergency/recover_others_account.dart@@ -10,7 +10,7 @@ import "package:photos/emergency/model.dart";import "package:photos/gateways/users/models/key_attributes.dart";import "package:photos/gateways/users/models/set_keys_request.dart";import "package:photos/generated/l10n.dart";-import 'package:photos/ui/common/dynamic_fab.dart';+import "package:photos/ui/components/buttons/button_widget_v2.dart";import 'package:photos/ui/notification/toast.dart';import 'package:photos/utils/dialog_util.dart';@@ -68,20 +68,12 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {@overrideWidget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }-String title = AppLocalizations.of(context).setPasswordTitle;title = AppLocalizations.of(context).resetPasswordTitle;+ final isFormValid = _passwordsMatch && _isPasswordValid;+return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,appBar: AppBar(leading: IconButton(icon: const Icon(Icons.arrow_back),@@ -93,17 +85,21 @@ class _RecoverOthersAccountState extends State<RecoverOthersAccount> {elevation: 0,),body: _getBody(title),- floatingActionButton: DynamicFAB(- isKeypadOpen: isKeypadOpen,- isFormValid: _passwordsMatch && _isPasswordValid,- buttonText: title,- onPressedFunction: () async {- await _updatePassword();- FocusScope.of(context).unfocus();- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: title,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ await _updatePassword();+ FocusScope.of(context).unfocus();+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/email_entry_page.dart b/mobile/apps/photos/lib/ui/account/email_entry_page.dartindex 1ba6b81c39..e5d553305e 100644--- a/mobile/apps/photos/lib/ui/account/email_entry_page.dart+++ b/mobile/apps/photos/lib/ui/account/email_entry_page.dart@@ -9,8 +9,8 @@ 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/common/dynamic_fab.dart';import 'package:photos/ui/common/web_page.dart';+import "package:photos/ui/components/buttons/button_widget_v2.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";@@ -73,18 +73,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {Widget 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;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }-return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -104,26 +94,30 @@ class _EmailEntryPageState extends State<EmailEntryPage> {centerTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("createAccountButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _isFormValid(),- buttonText: AppLocalizations.of(context).createAccount,- onPressedFunction: () async {- _config.setVolatilePassword(_passwordController1.text);- await UserService.instance.setEmail(_email!);- await UserService.instance.setRefSource(_referralSource);- await UserService.instance.sendOtt(- context,- _email!,- isCreateAccountScreen: true,- purpose: "signup",- );- FocusScope.of(context).unfocus();- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("createAccountButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).createAccount,+ isDisabled: !_isFormValid(),+ onTap: _isFormValid()+ ? () async {+ _config.setVolatilePassword(_passwordController1.text);+ await UserService.instance.setEmail(_email!);+ await UserService.instance.setRefSource(_referralSource);+ await UserService.instance.sendOtt(+ context,+ _email!,+ isCreateAccountScreen: true,+ purpose: "signup",+ );+ FocusScope.of(context).unfocus();+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}@@ -260,6 +254,7 @@ class _EmailEntryPageState extends State<EmailEntryPage> {),const SizedBox(height: 16),_getTOSAgreement(colorScheme, textTheme),+ const SizedBox(height: 80),],),);@@ -302,7 +297,12 @@ class _EmailEntryPageState extends State<EmailEntryPage> {child: Row(children: [Checkbox(- fillColor: WidgetStateProperty.all(colorScheme.greenBase),+ fillColor: WidgetStateProperty.resolveWith((states) {+ if (states.contains(WidgetState.selected)) {+ return colorScheme.greenBase;+ }+ return null;+ }),value: _hasAgreedToTOS,shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4),diff --git a/mobile/apps/photos/lib/ui/account/login_page.dart b/mobile/apps/photos/lib/ui/account/login_page.dartindex 30ec0055e0..ca177bd8da 100644--- a/mobile/apps/photos/lib/ui/account/login_page.dart+++ b/mobile/apps/photos/lib/ui/account/login_page.dart@@ -13,7 +13,7 @@ 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/login_pwd_verification_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/models/text_input_type_v2.dart";import "package:photos/ui/components/text_input_widget_v2.dart";@@ -61,18 +61,8 @@ class _LoginPageState extends State<LoginPage> {Widget 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;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }-return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -92,15 +82,17 @@ class _LoginPageState extends State<LoginPage> {centerTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("logInButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _emailIsValid,- buttonText: AppLocalizations.of(context).continueLabel,- onPressedFunction: _onLoginPressed,+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("logInButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).continueLabel,+ isDisabled: !_emailIsValid,+ onTap: _emailIsValid ? _onLoginPressed : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dartindex 965e1bc405..787f5f71df 100644--- a/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart+++ b/mobile/apps/photos/lib/ui/account/login_pwd_verification_page.dart@@ -10,7 +10,6 @@ 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/common/dynamic_fab.dart";import "package:photos/ui/components/buttons/button_widget.dart"show ButtonAction;import "package:photos/ui/components/buttons/button_widget_v2.dart";@@ -60,18 +59,9 @@ class _LoginPasswordVerificationPageStateWidget 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;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -91,18 +81,22 @@ class _LoginPasswordVerificationPageStatecenterTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("verifyPasswordButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _hasPassword,- buttonText: AppLocalizations.of(context).logInLabel,- onPressedFunction: () async {- FocusScope.of(context).unfocus();- await verifyPassword(context, _passwordController.text);- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("verifyPasswordButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).logInLabel,+ isDisabled: !_hasPassword,+ onTap: _hasPassword+ ? () async {+ FocusScope.of(context).unfocus();+ await verifyPassword(context, _passwordController.text);+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart b/mobile/apps/photos/lib/ui/account/ott_verification_page.dartindex 9769cab80d..a859f50e1b 100644--- a/mobile/apps/photos/lib/ui/account/ott_verification_page.dart+++ b/mobile/apps/photos/lib/ui/account/ott_verification_page.dart@@ -4,7 +4,6 @@ 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/common/dynamic_fab.dart";import "package:photos/ui/components/buttons/button_widget_v2.dart";import "package:pinput/pinput.dart";@@ -55,20 +54,12 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {@overrideWidget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _code.length == 6;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -88,15 +79,17 @@ class _OTTVerificationPageState extends State<OTTVerificationPage> {centerTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("verifyOttButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _code.length == 6,- buttonText: AppLocalizations.of(context).verify,- onPressedFunction: _onVerifyPressed,+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("verifyOttButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).verify,+ isDisabled: !isFormValid,+ onTap: isFormValid ? _onVerifyPressed : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/password_entry_page.dart b/mobile/apps/photos/lib/ui/account/password_entry_page.dartindex 52e914f58f..9c1aa90e88 100644--- a/mobile/apps/photos/lib/ui/account/password_entry_page.dart+++ b/mobile/apps/photos/lib/ui/account/password_entry_page.dart@@ -16,7 +16,6 @@ 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_key_page.dart';-import 'package:photos/ui/common/dynamic_fab.dart';import 'package:photos/ui/common/web_page.dart';import "package:photos/ui/components/buttons/button_widget_v2.dart";import "package:photos/ui/components/models/button_type.dart";@@ -87,7 +86,6 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {@overrideWidget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);@@ -100,16 +98,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {title = AppLocalizations.of(context).encryptionKeys;}- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _passwordsMatch && _isPasswordValid;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -135,21 +127,27 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {: _getBody(colorScheme, textTheme),floatingActionButton: _volatilePassword != null? null- : DynamicFAB(- isKeypadOpen: isKeypadOpen,- isFormValid: _passwordsMatch && _isPasswordValid,- buttonText: title,- onPressedFunction: () async {- if (widget.mode == PasswordEntryMode.set) {- await _showRecoveryCodeDialog(_passwordController1.text);- } else {- _updatePassword();- }- FocusScope.of(context).unfocus();- },+ : Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: title,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ if (widget.mode == PasswordEntryMode.set) {+ await _showRecoveryCodeDialog(+ _passwordController1.text,+ );+ } else {+ _updatePassword();+ }+ FocusScope.of(context).unfocus();+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart b/mobile/apps/photos/lib/ui/account/password_reentry_page.dartindex a0e089626d..28e4100a0a 100644--- a/mobile/apps/photos/lib/ui/account/password_reentry_page.dart+++ b/mobile/apps/photos/lib/ui/account/password_reentry_page.dart@@ -15,7 +15,6 @@ 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'show ButtonAction;import "package:photos/ui/components/buttons/button_widget_v2.dart";@@ -59,20 +58,12 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {@overrideWidget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;final colorScheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _passwordController.text.isNotEmpty;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -92,18 +83,22 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {centerTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("verifyPasswordButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _passwordController.text.isNotEmpty,- buttonText: AppLocalizations.of(context).logInLabel,- onPressedFunction: () async {- FocusScope.of(context).unfocus();- await verifyPassword(_passwordController.text);- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("verifyPasswordButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).logInLabel,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ FocusScope.of(context).unfocus();+ await verifyPassword(_passwordController.text);+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/recovery_page.dart b/mobile/apps/photos/lib/ui/account/recovery_page.dartindex feca172afb..88b67f7ff2 100644--- a/mobile/apps/photos/lib/ui/account/recovery_page.dart+++ b/mobile/apps/photos/lib/ui/account/recovery_page.dart@@ -3,7 +3,6 @@ import 'package:photos/core/configuration.dart';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';@@ -23,18 +22,10 @@ class _RecoveryPageState extends State<RecoveryPage> {Widget 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;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _recoveryKeyController.text.isNotEmpty;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -54,15 +45,17 @@ class _RecoveryPageState extends State<RecoveryPage> {centerTitle: true,),body: _getBody(),- floatingActionButton: DynamicFAB(- key: const ValueKey("recoveryButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _recoveryKeyController.text.isNotEmpty,- buttonText: AppLocalizations.of(context).logInLabel,- onPressedFunction: _onRecoverPressed,+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("recoveryButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).logInLabel,+ isDisabled: !isFormValid,+ onTap: isFormValid ? _onRecoverPressed : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/request_pwd_verification_page.dart b/mobile/apps/photos/lib/ui/account/request_pwd_verification_page.dartindex a9b5063495..c1be9def54 100644--- a/mobile/apps/photos/lib/ui/account/request_pwd_verification_page.dart+++ b/mobile/apps/photos/lib/ui/account/request_pwd_verification_page.dart@@ -7,7 +7,7 @@ import "package:logging/logging.dart";import 'package:photos/core/configuration.dart';import "package:photos/l10n/l10n.dart";import "package:photos/theme/ente_theme.dart";-import 'package:photos/ui/common/dynamic_fab.dart';+import "package:photos/ui/components/buttons/button_widget_v2.dart";import "package:photos/utils/dialog_util.dart";typedef OnPasswordVerifiedFn = Future<void> Function(Uint8List bytes);@@ -56,18 +56,10 @@ class _RequestPasswordVerificationPageState@overrideWidget build(BuildContext context) {- final isKeypadOpen = MediaQuery.of(context).viewInsets.bottom > 100;-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _passwordController.text.isNotEmpty;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,appBar: AppBar(elevation: 0,leading: IconButton(@@ -79,51 +71,60 @@ class _RequestPasswordVerificationPageState),),body: _getBody(),- floatingActionButton: DynamicFAB(- key: const ValueKey("verifyPasswordButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _passwordController.text.isNotEmpty,- buttonText: context.l10n.verifyPassword,- onPressedFunction: () async {- FocusScope.of(context).unfocus();- final dialog = createProgressDialog(context, context.l10n.pleaseWait);- await dialog.show();- try {- final attributes = Configuration.instance.getKeyAttributes()!;- final Uint8List keyEncryptionKey = await CryptoUtil.deriveKey(- utf8.encode(_passwordController.text),- CryptoUtil.base642bin(attributes.kekSalt),- attributes.memLimit!,- attributes.opsLimit!,- );- CryptoUtil.decryptSync(- CryptoUtil.base642bin(attributes.encryptedKey),- keyEncryptionKey,- CryptoUtil.base642bin(attributes.keyDecryptionNonce),- );- await dialog.show();- // pop- await widget.onPasswordVerified(keyEncryptionKey);- await dialog.hide();- Navigator.of(context).pop(true);- } catch (e, s) {- _logger.severe("Error while verifying password", e, s);- await dialog.hide();- if (widget.onPasswordError != null) {- widget.onPasswordError!();- } else {- // ignore: unawaited_futures- showErrorDialog(- context,- context.l10n.incorrectPasswordTitle,- context.l10n.pleaseTryAgain,- );- }- }- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("verifyPasswordButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: context.l10n.verifyPassword,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ FocusScope.of(context).unfocus();+ final dialog = createProgressDialog(+ context,+ context.l10n.pleaseWait,+ );+ await dialog.show();+ try {+ final attributes =+ Configuration.instance.getKeyAttributes()!;+ final Uint8List keyEncryptionKey =+ await CryptoUtil.deriveKey(+ utf8.encode(_passwordController.text),+ CryptoUtil.base642bin(attributes.kekSalt),+ attributes.memLimit!,+ attributes.opsLimit!,+ );+ CryptoUtil.decryptSync(+ CryptoUtil.base642bin(attributes.encryptedKey),+ keyEncryptionKey,+ CryptoUtil.base642bin(attributes.keyDecryptionNonce),+ );+ await dialog.show();+ // pop+ await widget.onPasswordVerified(keyEncryptionKey);+ await dialog.hide();+ Navigator.of(context).pop(true);+ } catch (e, s) {+ _logger.severe("Error while verifying password", e, s);+ await dialog.hide();+ if (widget.onPasswordError != null) {+ widget.onPasswordError!();+ } else {+ // ignore: unawaited_futures+ showErrorDialog(+ context,+ context.l10n.incorrectPasswordTitle,+ context.l10n.pleaseTryAgain,+ );+ }+ }+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart b/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dartindex a3a253a99b..fb9f4c8054 100644--- a/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart+++ b/mobile/apps/photos/lib/ui/account/two_factor_recovery_page.dart@@ -5,7 +5,6 @@ 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/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/utils/dialog_util.dart';@@ -42,18 +41,10 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {Widget 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;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }+ final isFormValid = _recoveryKey.isNotEmpty;return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,backgroundColor: colorScheme.backgroundColour,appBar: AppBar(elevation: 0,@@ -73,25 +64,29 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {centerTitle: true,),body: _getBody(colorScheme, textTheme),- floatingActionButton: DynamicFAB(- key: const ValueKey("recover2FAButton"),- isKeypadOpen: isKeypadOpen,- isFormValid: _recoveryKey.isNotEmpty,- buttonText: AppLocalizations.of(context).recover,- onPressedFunction: () async {- FocusScope.of(context).unfocus();- await UserService.instance.removeTwoFactor(- context,- widget.type,- widget.sessionID,- _recoveryKeyController.text,- widget.encryptedSecret,- widget.secretDecryptionNonce,- );- },+ floatingActionButton: Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ key: const ValueKey("recover2FAButton"),+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).recover,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ FocusScope.of(context).unfocus();+ await UserService.instance.removeTwoFactor(+ context,+ widget.type,+ widget.sessionID,+ _recoveryKeyController.text,+ widget.encryptedSecret,+ widget.secretDecryptionNonce,+ );+ }+ : null,+ ),),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,);}diff --git a/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart b/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_confirm_password.dartindex 6966cd3b37..e3f566ef30 100644--- a/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart+++ b/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_confirm_password.dart@@ -2,7 +2,7 @@ import "package:flutter/material.dart";import "package:flutter/services.dart";import "package:photos/generated/l10n.dart";import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/common/dynamic_fab.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";import "package:photos/ui/components/buttons/icon_button_widget.dart";import "package:photos/ui/components/text_input_widget.dart";import "package:photos/utils/lock_screen_settings.dart";@@ -59,18 +59,8 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {Widget build(BuildContext context) {final colorTheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);- final isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }-return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,appBar: AppBar(elevation: 0,leading: IconButton(@@ -87,18 +77,22 @@ class _LockScreenConfirmPasswordState extends State<LockScreenConfirmPassword> {floatingActionButton: ValueListenableBuilder<bool>(valueListenable: _isFormValid,builder: (context, isFormValid, child) {- return DynamicFAB(- isKeypadOpen: isKeypadOpen,- buttonText: AppLocalizations.of(context).confirm,- isFormValid: isFormValid,- onPressedFunction: () async {- _submitNotifier.value = !_submitNotifier.value;- },+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).confirm,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ _submitNotifier.value = !_submitNotifier.value;+ }+ : null,+ ),);},),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,body: SingleChildScrollView(child: Center(child: Column(diff --git a/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_password.dart b/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_password.dartindex 99c2768d21..39e476770f 100644--- a/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_password.dart+++ b/mobile/apps/photos/lib/ui/settings/lock_screen/lock_screen_password.dart@@ -6,7 +6,7 @@ import "package:flutter/services.dart";import "package:flutter_sodium/flutter_sodium.dart";import "package:photos/generated/l10n.dart";import "package:photos/theme/ente_theme.dart";-import "package:photos/ui/common/dynamic_fab.dart";+import "package:photos/ui/components/buttons/button_widget_v2.dart";import "package:photos/ui/components/buttons/icon_button_widget.dart";import "package:photos/ui/components/text_input_widget.dart";import "package:photos/ui/settings/lock_screen/lock_screen_confirm_password.dart";@@ -69,18 +69,8 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {Widget build(BuildContext context) {final colorTheme = getEnteColorScheme(context);final textTheme = getEnteTextTheme(context);- final isKeypadOpen = MediaQuery.viewInsetsOf(context).bottom > 100;-- FloatingActionButtonLocation? fabLocation() {- if (isKeypadOpen) {- return null;- } else {- return FloatingActionButtonLocation.centerFloat;- }- }-return Scaffold(- resizeToAvoidBottomInset: isKeypadOpen,+ resizeToAvoidBottomInset: true,appBar: AppBar(elevation: 0,leading: IconButton(@@ -97,18 +87,22 @@ class _LockScreenPasswordState extends State<LockScreenPassword> {floatingActionButton: ValueListenableBuilder<bool>(valueListenable: _isFormValid,builder: (context, isFormValid, child) {- return DynamicFAB(- isKeypadOpen: isKeypadOpen,- buttonText: AppLocalizations.of(context).next,- isFormValid: isFormValid,- onPressedFunction: () async {- _submitNotifier.value = !_submitNotifier.value;- },+ return Padding(+ padding: const EdgeInsets.symmetric(horizontal: 16),+ child: ButtonWidgetV2(+ buttonType: ButtonTypeV2.primary,+ labelText: AppLocalizations.of(context).next,+ isDisabled: !isFormValid,+ onTap: isFormValid+ ? () async {+ _submitNotifier.value = !_submitNotifier.value;+ }+ : null,+ ),);},),- floatingActionButtonLocation: fabLocation(),- floatingActionButtonAnimator: NoScalingAnimation(),+ floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,body: SingleChildScrollView(child: Center(child: Column(