import 'package:flutter/material.dart';
import 'package:test_sa/models/gas_refill/gas_refill_details.dart';
import 'package:test_sa/views/app_style/colors.dart';
class GasRefillCreateDetailsItem extends StatelessWidget {

  final GasRefillDetails model;
  final VoidCallback onDelete;

  const GasRefillCreateDetailsItem({Key key, this.model, this.onDelete}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        Row(
          children: [
            Expanded(child: Text(model.type.name)),
            IconButton(
              onPressed: onDelete,
              color: AColors.red,
              icon: const Icon(Icons.delete)
            )
          ],
        ),
        Wrap(
          spacing: 10,
          children: [
            Text("Quantity: ${model.requestedQuantity.toStringAsFixed(0)}"),
            Text("Cylinder Size: ${model.cylinderSize.name}"),
            Text("Cylinder Type: ${model.cylinderType.name}"),
          ],
        ),
        if(model.deliveredQuantity != null)
        Row(
          children: [
            const Text("Delivered Quantity"),
            Text(model.deliveredQuantity.toStringAsFixed(0)),
          ],
        ),
        const Divider(),
      ],
    );
  }
}
