BuildHistoryList.dart 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. import 'package:flutter/material.dart';
  2. import 'package:get_it/get_it.dart';
  3. import 'package:ustest/Services/UserService.dart';
  4. import 'package:ustest/tool.dart';
  5. import 'Services/BuildService.dart';
  6. class BuildHistoryList extends StatefulWidget {
  7. BuildHistoryList({Key? key, required this.token, required this.histories})
  8. : super();
  9. final String token;
  10. final List<BuildHistory> histories;
  11. @override
  12. _ConsultationListState createState() => _ConsultationListState();
  13. }
  14. class _ConsultationListState extends State<BuildHistoryList> {
  15. @override
  16. void initState() {
  17. var service = GetIt.instance.get<UserService>();
  18. service.NotificationReceived.subscribe((args) {
  19. if (args == null) {
  20. return;
  21. }
  22. });
  23. super.initState();
  24. }
  25. @override
  26. void dispose() {
  27. var service = GetIt.instance.get<UserService>();
  28. service.NotificationReceived.unsubscribe((args) {});
  29. super.dispose();
  30. }
  31. void showConfirmDialog(BuildContext context, String content,
  32. Function confirmCallback, Function rejectCallback) {
  33. showDialog(
  34. context: context,
  35. builder: (context) {
  36. return new AlertDialog(
  37. title: new Text("提示"),
  38. content: new Text(content),
  39. actions: <Widget>[
  40. new TextButton(
  41. onPressed: () {
  42. confirmCallback();
  43. Navigator.of(context).pop();
  44. },
  45. child: new Text("接受"),
  46. ),
  47. new TextButton(
  48. onPressed: () {
  49. Navigator.of(context).pop();
  50. },
  51. child: new Text("拒絕"),
  52. ),
  53. ],
  54. );
  55. });
  56. }
  57. @override
  58. Widget build(BuildContext context) {
  59. return Scaffold(
  60. body: Container(
  61. height: 600,
  62. child: Row(
  63. children: [
  64. Container(
  65. height: 500,
  66. width: 400,
  67. child: ListView(
  68. restorationId: 'list_demo_list_view',
  69. padding: const EdgeInsets.symmetric(vertical: 0),
  70. children: [
  71. for (int index = 0; index < widget.histories.length; index++)
  72. Row(
  73. children: [
  74. Expanded(
  75. child: Container(
  76. child: ListTile(
  77. leading: ExcludeSemantics(
  78. child: Icon(Icons.person),
  79. ),
  80. title: Text(widget.histories[index].id),
  81. onTap: (() =>
  82. onTabPatient(widget.histories[index].id)),
  83. ),
  84. )),
  85. Row(
  86. children: [Offstage()],
  87. ),
  88. Container(
  89. alignment: Alignment.topRight,
  90. child: Container(
  91. child: Column(
  92. children: [
  93. ClipRRect(
  94. borderRadius: BorderRadius.circular(2),
  95. child: Container(
  96. color: Colors.amber[50],
  97. child: Row(children: [
  98. Icon(
  99. Icons.star,
  100. color: Colors.amber[500],
  101. size: 12,
  102. ),
  103. Text(
  104. "5.0",
  105. style: TextStyle(
  106. color: Colors.amber[900],
  107. fontSize: 9),
  108. ),
  109. ]))),
  110. Container(
  111. child: Row(
  112. children: [
  113. TextButton(
  114. child: Text("Start"),
  115. onPressed: (() =>
  116. OnStartLiveConsultation(
  117. widget.histories[index].id))),
  118. ],
  119. ))
  120. ],
  121. ),
  122. )),
  123. ],
  124. ),
  125. ],
  126. ),
  127. ),
  128. ],
  129. ),
  130. ));
  131. }
  132. void onTabPatient(String id) async {}
  133. void OnStartLiveConsultation(id) async {
  134. try {
  135. //var service = GetIt.instance.get<ConsultationService>();
  136. Navigator.of(context).pushNamed('/meeting');
  137. } catch (ex) {
  138. print('OnStartLiveConsultation.to ex:$ex');
  139. MeetingTool.toast(ex.toString(), context);
  140. }
  141. }
  142. }