import 'package:flutter/material.dart';
import 'package:money2/money2.dart';

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

class PaymentSummaryRow extends StatelessWidget {
  final String Function(String) labelFactory;
  final Money? money;
  final String? value;
  final TextStyle? style;

  const PaymentSummaryRow({
    super.key,
    required this.labelFactory,
    required this.money,
    this.value,
    this.style,
  });

  @override
  Widget build(BuildContext context) {
    final formatted = value ?? formatMoneyUi(context, money);
    return Text(labelFactory(formatted), style: style);
  }
}
