|
...
|
...
|
@@ -9,7 +9,9 @@ import 'package:flutter/services.dart'; |
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
|
|
class AddSecurityEmailView extends GetView<AddSecurityEmailController> {
|
|
|
|
const AddSecurityEmailView({super.key});
|
|
|
|
const AddSecurityEmailView({super.key, this.isChangeEmail = false});
|
|
|
|
|
|
|
|
final bool isChangeEmail;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
...
|
...
|
@@ -38,7 +40,7 @@ class AddSecurityEmailView extends GetView<AddSecurityEmailController> { |
|
|
|
children: [
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
Text(
|
|
|
|
l10n.addSecurityEmail,
|
|
|
|
isChangeEmail ? l10n.changeEmail : l10n.addSecurityEmail,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textPrimary,
|
|
|
|
fontSize: 24,
|
|
...
|
...
|
@@ -47,22 +49,59 @@ class AddSecurityEmailView extends GetView<AddSecurityEmailController> { |
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
Text(
|
|
|
|
l10n.securityEmailDescription,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
height: 1.43,
|
|
|
|
if (isChangeEmail)
|
|
|
|
Text.rich(
|
|
|
|
TextSpan(
|
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.yourCurrentEmailIs,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: controller.userPrefs.preferences.value
|
|
|
|
.meUserInfo?.securityEmail
|
|
|
|
?.trim() ??
|
|
|
|
'',
|
|
|
|
style: TextStyle(
|
|
|
|
color: const Color(0xFF0F0F11),
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
TextSpan(
|
|
|
|
text: l10n.whatWouldYouLikeToUpdateItTo,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
)
|
|
|
|
else
|
|
|
|
Text(
|
|
|
|
l10n.securityEmailDescription,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
height: 1.43,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
TextField(
|
|
|
|
controller: c.emailController,
|
|
|
|
keyboardType: TextInputType.emailAddress,
|
|
|
|
autofillHints: const [AutofillHints.email],
|
|
|
|
onSubmitted: (_) => c.sendVerificationEmail(),
|
|
|
|
onSubmitted: (_) =>
|
|
|
|
c.sendVerificationEmail(isChangeEmail: isChangeEmail),
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textPrimary,
|
|
|
|
fontSize: 16,
|
|
...
|
...
|
@@ -120,8 +159,10 @@ class AddSecurityEmailView extends GetView<AddSecurityEmailController> { |
|
|
|
height: 48,
|
|
|
|
child: Obx(
|
|
|
|
() => ElevatedButton(
|
|
|
|
onPressed:
|
|
|
|
c.isEmailValid ? c.sendVerificationEmail : null,
|
|
|
|
onPressed: c.isEmailValid
|
|
|
|
? () => c.sendVerificationEmail(
|
|
|
|
isChangeEmail: isChangeEmail)
|
|
|
|
: null,
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
backgroundColor: colors.primary,
|
|
|
|
disabledBackgroundColor:
|
|
...
|
...
|
@@ -150,7 +191,9 @@ class AddSecurityEmailView extends GetView<AddSecurityEmailController> { |
|
|
|
|
|
|
|
class SecurityEmailVerificationView
|
|
|
|
extends GetView<AddSecurityEmailController> {
|
|
|
|
const SecurityEmailVerificationView({super.key});
|
|
|
|
const SecurityEmailVerificationView({super.key, this.isChangeEmail = false});
|
|
|
|
|
|
|
|
final bool isChangeEmail;
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
...
|
...
|
@@ -211,7 +254,8 @@ class SecurityEmailVerificationView |
|
|
|
// inputFormatters: const [
|
|
|
|
// _DigitsOnlyFormatter(),
|
|
|
|
// ],
|
|
|
|
onSubmitted: (_) => controller.submitCode(context),
|
|
|
|
onSubmitted: (_) => controller.submitCode(context,
|
|
|
|
isChangeEmail: isChangeEmail),
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textPrimary,
|
|
|
|
fontSize: 16,
|
|
...
|
...
|
@@ -283,7 +327,8 @@ class SecurityEmailVerificationView |
|
|
|
child: Obx(
|
|
|
|
() => ElevatedButton(
|
|
|
|
onPressed: controller.canSubmitCode
|
|
|
|
? () => controller.submitCode(context)
|
|
|
|
? () => controller.submitCode(context,
|
|
|
|
isChangeEmail: isChangeEmail)
|
|
|
|
: null,
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
backgroundColor: colors.primary,
|
|
...
|
...
|
@@ -715,3 +760,185 @@ class SetSecurityEmailPasswordView extends GetView<AddSecurityEmailController> { |
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class VerifyEmailPwdView extends GetView<AddSecurityEmailController> {
|
|
|
|
const VerifyEmailPwdView({super.key});
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
final c = Get.isRegistered<AddSecurityEmailController>()
|
|
|
|
? controller
|
|
|
|
: Get.put(AddSecurityEmailController());
|
|
|
|
final l10n = context.l10n;
|
|
|
|
final colors = context.colors;
|
|
|
|
|
|
|
|
return AnnotatedRegion<SystemUiOverlayStyle>(
|
|
|
|
value: SystemUiOverlayStyle(
|
|
|
|
statusBarColor: Colors.transparent,
|
|
|
|
statusBarIconBrightness: Brightness.dark,
|
|
|
|
statusBarBrightness: Brightness.light,
|
|
|
|
systemNavigationBarColor: colors.backgroundPage,
|
|
|
|
systemNavigationBarIconBrightness: Brightness.dark,
|
|
|
|
),
|
|
|
|
child: Scaffold(
|
|
|
|
backgroundColor: colors.backgroundPage,
|
|
|
|
appBar: const _SecurityEmailAppBar(),
|
|
|
|
body: SafeArea(
|
|
|
|
top: false,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 28),
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
const SizedBox(height: 16),
|
|
|
|
Text(
|
|
|
|
context.l10n.verifyYourPassword,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textPrimary,
|
|
|
|
fontSize: 24,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
height: 1.25,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
Text(
|
|
|
|
context.l10n.reEnterYourDoublefeelPasswordToContinue,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
color: colors.textSecondary,
|
|
|
|
fontSize: 14,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
height: 1.43,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 32),
|
|
|
|
Obx(() {
|
|
|
|
final isObscured = c.isPasswordObscured.value;
|
|
|
|
return TextField(
|
|
|
|
textInputAction: TextInputAction.next,
|
|
|
|
controller: c.passwordController,
|
|
|
|
// keyboardType: TextInputType.visiblePassword,
|
|
|
|
obscureText: isObscured,
|
|
|
|
autofillHints: const [AutofillHints.password],
|
|
|
|
obscuringCharacter: '*',
|
|
|
|
contextMenuBuilder: (BuildContext context,
|
|
|
|
EditableTextState editableTextState) {
|
|
|
|
List<ContextMenuButtonItem> buttonItems =
|
|
|
|
editableTextState.contextMenuButtonItems;
|
|
|
|
buttonItems.removeWhere(
|
|
|
|
(item) => item.type != ContextMenuButtonType.paste);
|
|
|
|
return AdaptiveTextSelectionToolbar.buttonItems(
|
|
|
|
anchors: editableTextState.contextMenuAnchors,
|
|
|
|
buttonItems: buttonItems,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
inputFormatters: [
|
|
|
|
FilteringTextInputFormatter.deny(RegExp(r'\s')),
|
|
|
|
FilteringTextInputFormatter.allow(
|
|
|
|
RegExp(r'[\x21-\x7E]'),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textPrimary,
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
decoration: InputDecoration(
|
|
|
|
hintText: l10n.emailLoginYourPassword,
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: context.colors.textTertiary,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
counterText: '',
|
|
|
|
filled: true,
|
|
|
|
fillColor: Colors.white,
|
|
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
|
|
horizontal: 20,
|
|
|
|
vertical: 16,
|
|
|
|
),
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(27),
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(27),
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
borderRadius: BorderRadius.circular(27),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: context.colors.primary,
|
|
|
|
width: 1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
suffixIconConstraints: const BoxConstraints(
|
|
|
|
minWidth: 24,
|
|
|
|
minHeight: 24,
|
|
|
|
),
|
|
|
|
suffixIcon: GestureDetector(
|
|
|
|
onTap: c.togglePasswordVisibility,
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(right: 16),
|
|
|
|
child: Image.asset(
|
|
|
|
isObscured
|
|
|
|
? 'assets/images/common/ic_hide_password.png'
|
|
|
|
: 'assets/images/common/ic_show_password.webp',
|
|
|
|
color: context.colors.textTertiary,
|
|
|
|
width: 24,
|
|
|
|
height: 24,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onSubmitted: (_) =>
|
|
|
|
Get.to(() => AddSecurityEmailView(isChangeEmail: true)),
|
|
|
|
);
|
|
|
|
}),
|
|
|
|
const SizedBox(height: 8),
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
|
|
child: Text(
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
context.l10n
|
|
|
|
.passwordMustBeAtLeast6CharactersAndInclude1NumberAnd1UppercaseLetter,
|
|
|
|
style: TextStyle(
|
|
|
|
color: context.colors.textTertiary,
|
|
|
|
fontSize: 12,
|
|
|
|
fontWeight: FontWeight.w400,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 86),
|
|
|
|
SizedBox(
|
|
|
|
width: double.infinity,
|
|
|
|
height: 48,
|
|
|
|
child: Obx(
|
|
|
|
() => ElevatedButton(
|
|
|
|
onPressed: c.isPasswordValid
|
|
|
|
? () => Get.to(
|
|
|
|
() => AddSecurityEmailView(isChangeEmail: true))
|
|
|
|
: null,
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
backgroundColor: colors.primary,
|
|
|
|
disabledBackgroundColor:
|
|
|
|
colors.primary.withValues(alpha: 0.4),
|
|
|
|
foregroundColor: Colors.white,
|
|
|
|
disabledForegroundColor: Colors.white,
|
|
|
|
elevation: 0,
|
|
|
|
shape: const StadiumBorder(),
|
|
|
|
textStyle: const TextStyle(
|
|
|
|
fontSize: 16,
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Text(l10n.watchThemeNext),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|