view.dart 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. import 'package:fis_i18n/i18n.dart';
  2. import 'package:fis_ui/index.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:get/get.dart';
  5. import 'package:vitalapp/components/button.dart';
  6. import 'package:vitalapp/pages/medical_checkup_station/appointment/state/list.dart';
  7. import 'package:vitalapp/pages/medical_checkup_station/appointment/widgets/filter.dart';
  8. import 'package:vitalapp/pages/medical_checkup_station/appointment/widgets/form.dart';
  9. import 'package:vitalapp/pages/medical_checkup_station/appointment/widgets/table.dart';
  10. import 'controller.dart';
  11. class AppointmentPage extends GetView<AppointmentController> {
  12. const AppointmentPage({Key? key}) : super(key: key);
  13. @override
  14. Widget build(BuildContext context) {
  15. return GetBuilder<AppointmentController>(
  16. id: "appointment",
  17. builder: (_) {
  18. return Scaffold(
  19. body: SafeArea(
  20. child: Column(
  21. crossAxisAlignment: CrossAxisAlignment.start,
  22. children: [
  23. Row(
  24. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  25. children: [
  26. AppointmentFilter(),
  27. _buildCreateAppointment(),
  28. ],
  29. ),
  30. _buildAppointmentTable(),
  31. _buildTablePagination(),
  32. SizedBox(
  33. height: 16,
  34. )
  35. ],
  36. ),
  37. ),
  38. // floatingActionButton: _buildCreateAppointment(),
  39. );
  40. },
  41. );
  42. }
  43. Widget _buildAppointmentTable() {
  44. return GetBuilder<AppointmentController>(
  45. id: "appointment_table",
  46. builder: (_) {
  47. return Expanded(
  48. child: AppointmentTable(
  49. appointmentList: controller.appointmentModelList,
  50. ),
  51. );
  52. },
  53. );
  54. }
  55. Widget _buildCreateAppointment() {
  56. return Container(
  57. width: 180,
  58. margin: EdgeInsets.only(right: 20),
  59. child: VButton(
  60. onTap: () async {
  61. controller.appointment = AppointmentModel(
  62. appointmentName: '',
  63. appointmentAddress: '',
  64. );
  65. await Get.dialog<AppointmentModel>(
  66. AppointmentFormDialog(appointment: controller.appointment),
  67. barrierDismissible: false,
  68. );
  69. },
  70. child: FText(
  71. "新建",
  72. style: TextStyle(color: Colors.white, fontSize: 22),
  73. ),
  74. ),
  75. );
  76. }
  77. Widget _buildTablePagination() {
  78. return GetBuilder<AppointmentController>(
  79. id: "appointment_table_pagination",
  80. builder: (_) {
  81. return Row(
  82. mainAxisAlignment: MainAxisAlignment.end,
  83. children: [
  84. FTablePagination(
  85. currListLength: controller.appointmentModelListLength,
  86. currPageIndex: controller.currPageIndex,
  87. pageSize: 10,
  88. onChangePage: (pageIndex, listLength) {
  89. controller.listController.getHealthExamBookingPageAsync(
  90. pageIndex: pageIndex,
  91. pageSize: listLength,
  92. );
  93. // _tableScrollToTop();
  94. },
  95. totalItemNumText: i18nBook.common.ofTerm
  96. .translate(['${controller.appointmentModelListLength}']),
  97. previousFivePageText: i18nBook.common.previousFivePageText.t,
  98. nextFivePageText: i18nBook.common.nextFivePageText.t,
  99. ),
  100. SizedBox(
  101. width: 20,
  102. )
  103. ],
  104. );
  105. },
  106. );
  107. }
  108. }