view.dart 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import 'package:flutter/material.dart';
  2. import 'package:get/get.dart';
  3. import 'package:pull_to_refresh/pull_to_refresh.dart';
  4. import '../../../../common/style/index.dart';
  5. import 'index.dart';
  6. class ExceptionDataPage extends GetView<ExceptionDataController> {
  7. const ExceptionDataPage({Key? key}) : super(key: key);
  8. // 主视图
  9. Widget _buildView() {
  10. return Obx(() => SmartRefresher(
  11. enablePullDown: true,
  12. enablePullUp: controller.state.hasMoreData,
  13. controller: controller.refreshController,
  14. onRefresh: () => controller.refreshMyAppealList(),
  15. onLoading: () => controller.loadMoreMyAppealList(),
  16. child: ListView.separated(
  17. itemBuilder: (context, index) {
  18. final info = controller.state.myAppealList[index];
  19. final time = info.recordDate ?? '';
  20. final duty = info.record?.checkInTypeText();
  21. final showText = "$time ($duty)";
  22. var result = info.record?.resultText();
  23. if (info.record?.fieldWork == true) {
  24. result = 'attendance_result_fieldWork'.tr;
  25. }
  26. return ListTile(
  27. onTap: () => controller.showOperationMenu(info),
  28. title: Text(result ?? '',
  29. style: Theme.of(context).textTheme.bodyLarge),
  30. subtitle: Text(showText,
  31. style: Theme.of(context).textTheme.bodyMedium),
  32. trailing: Row(
  33. mainAxisAlignment: MainAxisAlignment.end,
  34. mainAxisSize: MainAxisSize.min,
  35. children: controller.state.enableProcess
  36. ? [
  37. Text(info.statsText(),
  38. style: Theme.of(context).textTheme.bodySmall),
  39. const Icon(
  40. Icons.keyboard_arrow_right,
  41. color: AppColor.hintText,
  42. size: 22,
  43. )
  44. ]
  45. : [
  46. Text(info.statsText(),
  47. style: Theme.of(context).textTheme.bodySmall)
  48. ]),
  49. );
  50. },
  51. separatorBuilder: (context, index) {
  52. return const Divider(
  53. height: 1,
  54. color: Colors.transparent,
  55. );
  56. },
  57. itemCount: controller.state.myAppealList.length)));
  58. }
  59. @override
  60. Widget build(BuildContext context) {
  61. return GetBuilder<ExceptionDataController>(
  62. builder: (_) {
  63. return Scaffold(
  64. appBar: AppBar(title: Text('attendance_exception_data_title'.tr)),
  65. body: SafeArea(
  66. child: _buildView(),
  67. ),
  68. );
  69. },
  70. );
  71. }
  72. }