import 'package:flutter/material.dart';

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

import 'package:pweb/pages/payment_methods/icon.dart';
import 'package:pweb/utils/payment/label.dart';


class RecipientAddressBookInfoRow extends StatelessWidget {
  final PaymentType type;
  final String value;

  final double spacingWidth;
  final double spacingHeight;
  final double iconSize;
  final double titleFontSize;
  final double valueFontSize;
  final TextStyle? textStyle;

  const RecipientAddressBookInfoRow({
    super.key,
    required this.type,
    required this.value,
    this.spacingWidth = 8.0,
    this.spacingHeight = 2.0,
    this.iconSize = 20.0,
    this.titleFontSize = 16.0,
    this.valueFontSize = 12.0,
    this.textStyle,
  });

  @override
  Widget build(BuildContext context) {
    final style = textStyle ?? Theme.of(context).textTheme.bodySmall!;

    return Row(
      mainAxisAlignment: MainAxisAlignment.start,
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Icon(iconForPaymentType(type), size: iconSize),
        SizedBox(width: spacingWidth),
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Text(
              getPaymentTypeLabel(context, type),
              style: style.copyWith(fontSize: titleFontSize),
            ),
            SizedBox(height: spacingHeight),
            Text(
              value,
              style: style.copyWith(fontSize: valueFontSize),
            ),
          ],
        ),
      ],
    );
  }
}
