import 'package:flutter/material.dart';

import 'package:pshared/models/payment/type.dart';

import 'package:pweb/utils/text_field_styles.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class AssetTypeField extends StatelessWidget {
  final PaymentType value;
  final ValueChanged<PaymentType?>? onChanged;

  const AssetTypeField({
    super.key,
    required this.value,
    required this.onChanged,
  });

  @override
  Widget build(BuildContext context) {
    final l10n = AppLocalizations.of(context)!;
    return DropdownButtonFormField<PaymentType>(
      initialValue: value,
      decoration: getInputDecoration(context, l10n.paymentType, true),
      items: [
        DropdownMenuItem(
          value: PaymentType.managedWallet,
          child: Text(l10n.paymentTypeManagedWallet),
        ),
        DropdownMenuItem(
          value: PaymentType.ledger,
          child: Text(l10n.paymentTypeLedger),
        ),
      ],
      onChanged: onChanged,
    );
  }
}
