import 'package:flutter/material.dart';

import 'package:pweb/controllers/auth/account_name.dart';


class AccountNameEditingFields extends StatelessWidget {
  const AccountNameEditingFields({
    super.key,
    required this.hintText,
    required this.lastNameHint,
    required this.inputWidth,
    required this.borderWidth,
    required this.state,
  });

  final String hintText;
  final String lastNameHint;
  final double inputWidth;
  final double borderWidth;
  final AccountNameController state;

  @override
  Widget build(BuildContext context) {
    final theme = Theme.of(context);

    return SizedBox(
      width: inputWidth,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          TextFormField(
            controller: state.firstNameController,
            style: theme.textTheme.headlineMedium?.copyWith(
              fontWeight: FontWeight.bold,
            ),
            autofocus: true,
            enabled: !state.isBusy,
            decoration: InputDecoration(
              hintText: hintText,
              labelText: hintText,
              isDense: true,
              border: UnderlineInputBorder(
                borderSide: BorderSide(
                  color: theme.colorScheme.primary,
                  width: borderWidth,
                ),
              ),
            ),
          ),
          const SizedBox(height: 8),
          TextFormField(
            controller: state.lastNameController,
            style: theme.textTheme.headlineSmall?.copyWith(
              fontWeight: FontWeight.w600,
            ),
            enabled: !state.isBusy,
            decoration: InputDecoration(
              hintText: lastNameHint,
              labelText: lastNameHint,
              isDense: true,
              border: UnderlineInputBorder(
                borderSide: BorderSide(
                  color: theme.colorScheme.primary,
                  width: borderWidth,
                ),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
