import 'package:flutter/material.dart';

import 'package:pshared/models/currency.dart';

import 'package:pweb/pages/dashboard/buttons/balance/add/constants.dart';
import 'package:pweb/pages/dashboard/buttons/balance/add/ledger/currency_item.dart';
import 'package:pweb/utils/text_field_styles.dart';

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


class LedgerFields extends StatelessWidget {
  final CurrencyCode currency;
  final ValueChanged<CurrencyCode?>? onCurrencyChanged;

  const LedgerFields({
    super.key,
    required this.currency,
    required this.onCurrencyChanged,
  });

  @override
  Widget build(BuildContext context) => DropdownButtonFormField<CurrencyCode>(
    initialValue: currency,
    decoration: getInputDecoration(context, AppLocalizations.of(context)!.currency, true),
    items: [
      currencyItem(ledgerCurrencyDefault),
      currencyItem(managedCurrencyDefault),
    ],
    onChanged: onCurrencyChanged,
  );
}
