email registration updated
This commit is contained in:
@@ -12,21 +12,18 @@ class TwoFactorCodeInput extends StatelessWidget {
|
||||
Widget build(BuildContext context) => Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: 300),
|
||||
child: PinCodeTextField(
|
||||
child: MaterialPinField(
|
||||
length: 6,
|
||||
appContext: context,
|
||||
autoFocus: true,
|
||||
keyboardType: TextInputType.number,
|
||||
animationType: AnimationType.fade,
|
||||
cursorColor: Theme.of(context).colorScheme.primary,
|
||||
pinTheme: PinTheme(
|
||||
shape: PinCodeFieldShape.box,
|
||||
theme: MaterialPinTheme(
|
||||
entryAnimation: MaterialPinAnimation.fade,
|
||||
shape: MaterialPinShape.outlined,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
fieldHeight: 48,
|
||||
fieldWidth: 40,
|
||||
inactiveColor: Theme.of(context).colorScheme.primaryContainer,
|
||||
activeColor: Theme.of(context).colorScheme.primary,
|
||||
selectedColor: Theme.of(context).colorScheme.primary,
|
||||
cellSize: Size(40, 48),
|
||||
borderColor: Theme.of(context).colorScheme.primaryContainer,
|
||||
focusedBorderColor: Theme.of(context).colorScheme.primary,
|
||||
cursorColor: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
onCompleted: onCompleted,
|
||||
onChanged: (_) {},
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:email_validator/email_validator.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
//TODO check with /widgets/username.dart
|
||||
|
||||
//TODO: check with /widgets/username.dart
|
||||
class EmailField extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
|
||||
const EmailField({super.key, required this.controller});
|
||||
|
||||
static final _emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -22,7 +22,7 @@ class EmailField extends StatelessWidget {
|
||||
hintText: AppLocalizations.of(context)!.usernameHint,
|
||||
),
|
||||
validator: (value) {
|
||||
if (value == null || !_emailRegex.hasMatch(value)) {
|
||||
if (value == null || !EmailValidator.validate(value)) {
|
||||
return AppLocalizations.of(context)!.usernameErrorInvalid;
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user