import 'package:flutter/material.dart';
import 'package:hello_doctor_admin_dashboard/app/models/transaction_model.dart';
import 'package:hello_doctor_admin_dashboard/app/utils/timeformat.dart';
import 'package:hello_doctor_admin_dashboard/constants.dart';

class TransactionTableSource extends DataTableSource {
  late final List<TransactionModel> listTransaction;
  TransactionTableSource(this.listTransaction);
  @override
  DataRow? getRow(int index) {
    return DataRow(
      cells: [
        DataCell(
            Text(TimeFormat().formatDate(listTransaction[index].createdAt))),
        DataCell(
            Text(TimeFormat().formatDate(listTransaction[index].updatedAt))),
        DataCell(Text(listTransaction[index].createdAt.toString())),
        DataCell(Text(listTransaction[index].type.toString())),
        DataCell(Text(currencySign + listTransaction[index].amount.toString())),
      ],
    );
  }

  @override
  // TODO: implement isRowCountApproximate
  bool get isRowCountApproximate => false;

  @override
  // TODO: implement rowCount
  int get rowCount => listTransaction.length;

  @override
  // TODO: implement selectedRowCount
  int get selectedRowCount => 0;
}
