import 'package:flutter/material.dart';

import '../../../data/models/tank_model.dart';


class MyListTileItem extends StatelessWidget {
  const MyListTileItem({super.key, required this.listItem});

  final AppWriteTankModel listItem;

  @override
  Widget build(BuildContext context) {
    return _myListItem(context);
  }

  Widget _myListItem(BuildContext context) {
    var textColor = Colors.orange.shade400;
    var summePrice =
        (double.parse(listItem.liters) * double.parse(listItem.pricePerLiter))
            .toStringAsFixed(2);
    return Padding(
      padding: const EdgeInsets.all(10.0),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Wrap(
            alignment: WrapAlignment.spaceBetween,
            children: [
              Row(
                children: [
                  Icon(Icons.date_range),
                  SizedBox(width: 10),
                  Text(
                    listItem.date,
                    style: TextStyle(color: textColor, fontSize: 25),
                  ),
                ],
              ),
              Row(
                children: [
                  Image.asset('lib/icons/kilometer.png'),
                  SizedBox(width: 10),
                  Text(
                    '${listItem.odometer} km',
                    style: TextStyle(color: textColor, fontSize: 25),
                  ),
                ],
              ),
            ],
          ),
          Divider(thickness: 3, color: Colors.black),
          Row(
            children: [
              Icon(Icons.local_gas_station),
              SizedBox(width: 10),
              Text(
                '${listItem.liters} L',
                style: TextStyle(color: textColor, fontSize: 25),
              ),
            ],
          ),
          Divider(thickness: 1, color: Colors.black),
          Row(
            children: [
              Icon(Icons.euro),
              SizedBox(width: 10),
              Text(
                '${listItem.pricePerLiter} €/L ',
                style: TextStyle(color: textColor, fontSize: 25),
              ),
            ],
          ),
          Divider(thickness: 1, color: Colors.black),
          Row(
            children: [
              Icon(Icons.price_change),
              SizedBox(width: 10),
              Text('$summePrice €', style: TextStyle(color: textColor, fontSize: 25)),
            ],
          ),
          Divider(thickness: 1, color: Colors.black),
          Row(
            children: [
              Icon(Icons.pin_drop),
              SizedBox(width: 10),
              SizedBox(
                width: 250,
                child: Text(
                  listItem.location,
                  style: TextStyle(color: textColor, fontSize: 16),
                ),
              ),
            ],
          ),
        ],
      ),
    );
  }
}
