import 'package:flutter/material.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';
import 'package:pweb/pages/address_book/form/widgets/feilds/recipient_text_field.dart';


class EmailField extends StatelessWidget {
  final TextEditingController controller;

  final double borderRadius;
  final EdgeInsetsGeometry contentPadding;

  const EmailField({
    super.key,
    required this.controller,
    this.borderRadius = 12,
    this.contentPadding = const EdgeInsets.symmetric(horizontal: 12, vertical: 14),
  });

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;

    return RecipientTextField(
      controller: controller,
      labelText: loc.username,
      hintText: loc.usernameHint,
      icon: Icons.alternate_email,
      keyboardType: TextInputType.emailAddress,
      autofillHints: const [AutofillHints.email],
      validator: (v) => v == null || v.isEmpty ? loc.usernameErrorInvalid : null,
      borderRadius: borderRadius,
      contentPadding: contentPadding,
    );
  }
}
