Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

refactor: Enhance TwoFactorRecoveryPage UI with improved theming and layout adjustments

AmanRajSinghMouryaf98c385db08f
diff --git a/mobile/packages/accounts/lib/pages/two_factor_recovery_page.dart b/mobile/packages/accounts/lib/pages/two_factor_recovery_page.dart
index c4ef3eec76..56d7b149c6 100644
--- a/mobile/packages/accounts/lib/pages/two_factor_recovery_page.dart
+++ b/mobile/packages/accounts/lib/pages/two_factor_recovery_page.dart
@@ -1,5 +1,6 @@
import 'package:ente_accounts/ente_accounts.dart';
import 'package:ente_strings/ente_strings.dart';
+import "package:ente_ui/components/buttons/gradient_button.dart";
import 'package:ente_ui/theme/ente_theme.dart';
import 'package:ente_utils/email_util.dart';
import 'package:flutter/material.dart';
@@ -27,84 +28,127 @@ class _TwoFactorRecoveryPageState extends State<TwoFactorRecoveryPage> {
@override
Widget build(BuildContext context) {
+ final colorScheme = getEnteColorScheme(context);
+ final textTheme = getEnteTextTheme(context);
+
return Scaffold(
+ backgroundColor: colorScheme.backgroundBase,
appBar: AppBar(
- title: Text(
- context.strings.recoverAccount,
- style: const TextStyle(
- fontSize: 18,
- ),
+ 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: colorScheme.primary700,
+ onPressed: () {
+ Navigator.of(context).pop();
+ },
),
),
- body: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- mainAxisAlignment: MainAxisAlignment.center,
- mainAxisSize: MainAxisSize.max,
- children: [
- Padding(
- padding: const EdgeInsets.fromLTRB(60, 0, 60, 0),
- child: TextFormField(
- decoration: InputDecoration(
- hintText: context.strings.enterRecoveryKeyHint,
- contentPadding: const EdgeInsets.all(20),
- ),
- style: const TextStyle(
- fontSize: 14,
- fontFeatures: [FontFeature.tabularFigures()],
+ body: SafeArea(
+ child: Column(
+ children: [
+ Expanded(
+ child: SingleChildScrollView(
+ child: Padding(
+ padding: const EdgeInsets.symmetric(horizontal: 16),
+ child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ const SizedBox(height: 24),
+ Text(
+ context.strings.recoveryKey,
+ style: textTheme.bodyBold.copyWith(
+ color: colorScheme.textBase,
+ ),
+ ),
+ const SizedBox(height: 8),
+ TextFormField(
+ decoration: InputDecoration(
+ fillColor: colorScheme.backdropBase,
+ filled: true,
+ hintText: context.strings.enterRecoveryKeyHint,
+ hintStyle: TextStyle(color: colorScheme.textMuted),
+ contentPadding: const EdgeInsets.all(16),
+ border: OutlineInputBorder(
+ borderSide: BorderSide.none,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ enabledBorder: OutlineInputBorder(
+ borderSide: BorderSide.none,
+ borderRadius: BorderRadius.circular(8),
+ ),
+ ),
+ style: textTheme.body.copyWith(
+ color: colorScheme.textBase,
+ fontFeatures: [const FontFeature.tabularFigures()],
+ ),
+ controller: _recoveryKey,
+ autofocus: false,
+ autocorrect: false,
+ keyboardType: TextInputType.multiline,
+ maxLines: 4,
+ minLines: 4,
+ onChanged: (_) {
+ setState(() {});
+ },
+ ),
+ ],
+ ),
+ ),
),
- controller: _recoveryKey,
- autofocus: false,
- autocorrect: false,
- keyboardType: TextInputType.multiline,
- maxLines: null,
- onChanged: (_) {
- setState(() {});
- },
),
- ),
- const Padding(padding: EdgeInsets.all(24)),
- Container(
- padding: const EdgeInsets.fromLTRB(80, 0, 80, 0),
- width: double.infinity,
- height: 64,
- child: OutlinedButton(
- onPressed: _recoveryKey.text.isNotEmpty
- ? () async {
- await UserService.instance.removeTwoFactor(
- context,
- widget.type,
- widget.sessionID,
- _recoveryKey.text,
- widget.encryptedSecret,
- widget.secretDecryptionNonce,
- );
- }
- : null,
- child: Text(context.strings.recover),
- ),
- ),
- GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: () async {
- await openSupportPage(null, null);
- },
- child: Container(
- padding: const EdgeInsets.all(40),
- child: Center(
- child: Text(
- context.strings.noRecoveryKeyTitle,
- style: TextStyle(
- decoration: TextDecoration.underline,
- fontSize: 12,
- color: getEnteColorScheme(context)
- .textBase
- .withValues(alpha: 0.9),
+ Padding(
+ padding: const EdgeInsets.all(16),
+ child: Column(
+ children: [
+ SizedBox(
+ width: double.infinity,
+ height: 56,
+ child: GradientButton(
+ onTap: _recoveryKey.text.isNotEmpty
+ ? () async {
+ await UserService.instance.removeTwoFactor(
+ context,
+ widget.type,
+ widget.sessionID,
+ _recoveryKey.text,
+ widget.encryptedSecret,
+ widget.secretDecryptionNonce,
+ );
+ }
+ : null,
+ text: context.strings.recover,
+ ),
),
- ),
+ const SizedBox(height: 16),
+ GestureDetector(
+ behavior: HitTestBehavior.translucent,
+ onTap: () async {
+ await openSupportPage(null, null);
+ },
+ child: Padding(
+ padding: const EdgeInsets.all(10),
+ child: Text(
+ context.strings.noRecoveryKeyTitle,
+ style: textTheme.small.copyWith(
+ color: colorScheme.primary700,
+ decoration: TextDecoration.underline,
+ decorationColor: colorScheme.primary700,
+ ),
+ ),
+ ),
+ ),
+ const SizedBox(height: 16),
+ ],
),
),
- ),
- ],
+ ],
+ ),
),
);
}