0661016827
- Replace Email+Password login with Phone+OTP flow - Remove RegisterCubit and registration screens (email verification) - Remove ResetPasswordCubit and reset password screens - Add phone normalization and international dial code support - Update LoginCubit with sendCode/resend cooldown logic - Add new widgets: phone prefix selector, confirm sheet - Update all auth API endpoints: /otp/send, /phone-session - Update form inputs: Email -> Phone with E.164 validation - Update tests for new auth flow
89 lines
2.6 KiB
Dart
89 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
|
|
import '../../../../core/theme/design_tokens.dart';
|
|
|
|
class AuthField extends StatelessWidget {
|
|
const AuthField({
|
|
super.key,
|
|
this.label,
|
|
required this.hint,
|
|
required this.controller,
|
|
this.keyboardType,
|
|
this.obscureText = false,
|
|
this.suffixIcon,
|
|
this.onChanged,
|
|
this.prefix,
|
|
this.inputFormatters,
|
|
});
|
|
|
|
final String? label;
|
|
final String hint;
|
|
final TextEditingController controller;
|
|
final TextInputType? keyboardType;
|
|
final bool obscureText;
|
|
final Widget? suffixIcon;
|
|
final ValueChanged<String>? onChanged;
|
|
final Widget? prefix;
|
|
final List<TextInputFormatter>? inputFormatters;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if (label != null) ...[
|
|
Text(
|
|
label!,
|
|
style: const TextStyle(
|
|
fontSize: 13,
|
|
fontWeight: FontWeight.w700,
|
|
color: AppColors.slate700,
|
|
),
|
|
),
|
|
SizedBox(height: AppSpacing.sm),
|
|
],
|
|
Semantics(
|
|
label: label,
|
|
textField: true,
|
|
child: TextField(
|
|
controller: controller,
|
|
keyboardType: keyboardType,
|
|
obscureText: obscureText,
|
|
onChanged: onChanged,
|
|
inputFormatters: inputFormatters,
|
|
style: const TextStyle(fontSize: 16, color: AppColors.slate900),
|
|
decoration: InputDecoration(
|
|
hintText: hint,
|
|
hintStyle: const TextStyle(
|
|
fontSize: 15,
|
|
color: AppColors.slate400,
|
|
),
|
|
filled: true,
|
|
fillColor: AppColors.authInputBackground,
|
|
contentPadding: const EdgeInsets.symmetric(
|
|
horizontal: AppSpacing.lg,
|
|
vertical: AppSpacing.lg,
|
|
),
|
|
prefixIcon: prefix,
|
|
suffixIcon: suffixIcon,
|
|
border: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
borderSide: BorderSide.none,
|
|
),
|
|
enabledBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
borderSide: const BorderSide(color: AppColors.authInputBorder),
|
|
),
|
|
focusedBorder: OutlineInputBorder(
|
|
borderRadius: BorderRadius.circular(AppRadius.lg),
|
|
borderSide: const BorderSide(color: AppColors.authInputFocus),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|