import 'package:flutter/material.dart';

import 'package:uco_mobile_poc/app/res/app_colors.dart';

class HistoryListViewWidget extends StatelessWidget {
  bool isCredit = false;
  String type = "";
  String title = "";
  String shortTitle = "";
  String description = "";
  String dateTime = "";
  String balance = "";
  String dateMonth = "";
  String dateOfMonth = "";
  String year = "";
  String transactionId = "";
  String transactionIdNumber = "";
  Function()? onTap;

  HistoryListViewWidget({
    Key? key,
    this.isCredit = false,
    this.type = "",
    this.title = "",
    this.dateTime = "",
    this.balance = "",
    this.shortTitle = "",
    this.description = "",
    this.year = "",
    this.dateMonth = "",
    this.dateOfMonth = "",
    this.transactionId = "",
    this.transactionIdNumber = "",
    this.onTap,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: onTap,
      child: Padding(
        padding: EdgeInsets.symmetric(horizontal: 0.0, vertical: 3),
        child: Card(
          elevation: 3,
          color: AppColors.colorGrey50,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(10),
          ),
          child: Container(
            /**/ decoration: BoxDecoration(
                color: AppColors.colorText.withOpacity(0.03),
                borderRadius: BorderRadius.all(Radius.circular(50))),
            child: Padding(
              padding:
                  EdgeInsets.only(left: 10.0, top: 5, right: 10.0, bottom: 5),
              child: Column(
                children: [
                  Row(
                    children: [
                      Container(
                        padding: EdgeInsets.only(top: 5),
                        decoration: BoxDecoration(
                          color: AppColors.colorGrey100,
                          borderRadius: BorderRadius.all(Radius.circular(10)),
                        ),
                        child: Column(
                          children: [
                            Text(dateMonth,
                                style: Theme.of(context).textTheme.labelSmall),
                            Text(dateOfMonth,
                                style: Theme.of(context).textTheme.titleMedium),
                            Container(
                              decoration: BoxDecoration(
                                color: AppColors.colorGrey300,
                                borderRadius: BorderRadius.only(
                                    bottomRight: Radius.circular(10),
                                    bottomLeft: Radius.circular(10)),
                              ),
                              padding: EdgeInsets.symmetric(
                                  vertical: 3, horizontal: 15),
                              height: 20,
                              child: Text(year,
                                  style:
                                      Theme.of(context).textTheme.labelSmall),
                            )
                          ],
                        ),
                      ),
                      Padding(
                        padding: EdgeInsets.symmetric(horizontal: 10),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            LimitedBox(
                                maxWidth: 120,
                                child: Text("\$ $balance",
                                    overflow: TextOverflow.ellipsis,
                                    style: Theme.of(context)
                                        .textTheme
                                        .titleSmall)),
                            Row(
                              children: [
                                Container(
                                  height: 25,
                                  width: 2.2,
                                  color: AppColors.colorButton,
                                ),
                                Padding(
                                  padding: EdgeInsets.symmetric(horizontal: 10),
                                  child: Column(
                                    crossAxisAlignment:
                                        CrossAxisAlignment.start,
                                    children: [
                                      LimitedBox(
                                          maxWidth: 120,
                                          child: Text("Transaction ID",
                                              overflow: TextOverflow.ellipsis,
                                              style: Theme.of(context)
                                                  .textTheme
                                                  .labelSmall)),
                                      LimitedBox(
                                          maxWidth: 120,
                                          child: Text(transactionIdNumber,
                                              overflow: TextOverflow.ellipsis,
                                              style: Theme.of(context)
                                                  .textTheme
                                                  .labelSmall)),
                                    ],
                                  ),
                                ),
                              ],
                            ),
                          ],
                        ),
                      ),
                      const Expanded(child: SizedBox()),
                      Icon(Icons.arrow_forward_ios_outlined,
                          size: 20, color: AppColors.colorText),
                    ],
                  ),
                ],
              ),
            ),
          ),
        ),
      ),
    );
  }
}
