swap_report.dart 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // ignore_for_file: must_be_immutable, non_constant_identifier_names
  2. import 'package:flutter/material.dart';
  3. import 'package:easy_table/easy_table.dart';
  4. import 'package:gozap_package/models/swap/swap_history_model.dart';
  5. class SwapReportWidget extends StatefulWidget {
  6. SwapReportWidget({super.key, required this.SwapHistoryList});
  7. List<SwapHistoryModule> SwapHistoryList;
  8. @override
  9. State<SwapReportWidget> createState() => _SwapReportWidgetState();
  10. }
  11. class _SwapReportWidgetState extends State<SwapReportWidget> {
  12. @override
  13. Widget build(BuildContext context) {
  14. return SizedBox(
  15. width: 500,
  16. height: 200,
  17. child: EasyTable<SwapHistoryModule>(
  18. EasyTableModel<SwapHistoryModule>(
  19. rows: widget.SwapHistoryList,
  20. columns: [
  21. EasyTableColumn(
  22. name: 'Rider ID',
  23. stringValue: (row) => row.RiderID),
  24. EasyTableColumn(
  25. name: 'Return Battery ID',
  26. stringValue: (row) => row.ReturnBatterID,
  27. ),
  28. EasyTableColumn(
  29. name: 'Swap Battery ID',
  30. stringValue: (row) => row.SwappedBatterID,
  31. ),
  32. EasyTableColumn(
  33. name: 'Is FreeSwap',
  34. iconValue: (row) => row.IsFreeSwap? CellIcon(icon: Icons.done):CellIcon(icon: Icons.close)),
  35. EasyTableColumn(
  36. name: 'Date & Time',
  37. stringValue: (row) => row.SwapFormattedCreatedAt),
  38. ]),
  39. columnsFit: true,
  40. visibleRowsCount: 0),
  41. );
  42. }
  43. }