success_registration.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. import 'package:eitc_erm_app/record_registration.dart';
  2. import 'package:eitc_erm_app/utils/Constants.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:permission_handler/permission_handler.dart';
  6. import 'home.dart';
  7. /*void main() {
  8. WidgetsFlutterBinding.ensureInitialized();
  9. runApp(SuccessRegistration());
  10. }*/
  11. String mPatient = "";
  12. String mVisitTime = "";
  13. String mDeptName = "";
  14. String mDoctorName = "";
  15. String mRemark = "";
  16. class SuccessRegistration extends StatefulWidget {
  17. SuccessRegistration(
  18. {required Key key, required patient, required visitTime, required deptName, required doctorName, required remark})
  19. : super(key: key) {
  20. mPatient = patient;
  21. mVisitTime = visitTime;
  22. mDeptName = deptName;
  23. mDoctorName = doctorName;
  24. mRemark = remark;
  25. }
  26. @override
  27. State<StatefulWidget> createState() => SuccessRegistrationState();
  28. }
  29. class SuccessRegistrationState extends State<SuccessRegistration> {
  30. final GlobalKey<ScaffoldState> _scaffoldKey =
  31. GlobalKey<ScaffoldState>(); //重要代码 需要绑定key不然切换页面会停止摄像头采集
  32. @override
  33. void initState() {
  34. super.initState();
  35. initPlatformState(); //检查权限
  36. //延迟1秒 直播推流
  37. Future.delayed(Duration(milliseconds: 1000), () {});
  38. }
  39. Future<void> initPlatformState() async {
  40. //相机权限
  41. if (await requestCameraPermission() == false) {
  42. return;
  43. }
  44. //录音权限
  45. if (await requestMicrophonePermission() == false) {
  46. return;
  47. }
  48. }
  49. Future<bool> requestCameraPermission() async {
  50. var status = await Permission.camera.status;
  51. if (status == PermissionStatus.granted) {
  52. return true;
  53. } else {
  54. status = await Permission.camera.request();
  55. if (status == PermissionStatus.granted) {
  56. return true;
  57. } else {
  58. return false;
  59. }
  60. }
  61. }
  62. Future<bool> requestMicrophonePermission() async {
  63. var status = await Permission.microphone.status;
  64. if (status == PermissionStatus.granted) {
  65. return true;
  66. } else {
  67. status = await Permission.microphone.request();
  68. if (status == PermissionStatus.granted) {
  69. return true;
  70. } else {
  71. return false;
  72. }
  73. }
  74. }
  75. @override
  76. Widget build(BuildContext context) {
  77. return Scaffold(
  78. resizeToAvoidBottomInset: false,
  79. backgroundColor: Global.BackgroundColor,
  80. appBar: new AppBar(title: new Text('预约挂号'), centerTitle: true),
  81. body: SingleChildScrollView(
  82. child:Container(
  83. padding: EdgeInsets.all(10),
  84. child: Column(
  85. mainAxisSize: MainAxisSize.min,
  86. crossAxisAlignment: CrossAxisAlignment.center,
  87. children: <Widget>[
  88. ClipRRect(
  89. borderRadius: BorderRadius.circular(10.0),
  90. child: Container(
  91. color: Global.BackgroundColor,
  92. padding: EdgeInsets.all(10),
  93. child: const Column(
  94. mainAxisSize: MainAxisSize.min,
  95. crossAxisAlignment: CrossAxisAlignment.start,
  96. children: <Widget>[
  97. Padding(
  98. padding: EdgeInsets.all(10),
  99. child: Icon(
  100. Icons.check_circle,
  101. size: 85.0, // 设置Icon的大小
  102. color: Colors.blueAccent, // 设置Icon的颜色
  103. ),
  104. ),
  105. Text(
  106. '挂号成功',
  107. style: TextStyle(
  108. fontSize: 28,
  109. color: Colors.blue,
  110. ),
  111. )
  112. ]),
  113. ),
  114. ),
  115. SizedBox(height: 8),
  116. ClipRRect(
  117. borderRadius: BorderRadius.circular(10.0),
  118. child: Container(
  119. color: Colors.white,
  120. padding: const EdgeInsets.all(10),
  121. child: Column(
  122. mainAxisSize: MainAxisSize.min,
  123. crossAxisAlignment: CrossAxisAlignment.start,
  124. children: <Widget>[
  125. /*Padding(
  126. padding: EdgeInsets.all(10),
  127. child: Row(
  128. mainAxisAlignment:
  129. MainAxisAlignment.spaceBetween,
  130. children: [
  131. Text(
  132. '挂号费',
  133. style: TextStyle(
  134. fontSize: 15, color: Colors.grey),
  135. ),
  136. Text(
  137. '¥12.5',
  138. style: TextStyle(fontSize: 15),
  139. ),
  140. ]),
  141. ),*/
  142. Padding(
  143. padding: EdgeInsets.all(10),
  144. child: Row(
  145. mainAxisAlignment:
  146. MainAxisAlignment.spaceBetween,
  147. children: [
  148. Text(
  149. '就诊人',
  150. style: TextStyle(
  151. fontSize: 15, color: Colors.grey),
  152. ),
  153. Text(
  154. mPatient,
  155. style: TextStyle(fontSize: 15),
  156. ),
  157. ]),
  158. ),
  159. Padding(
  160. padding: EdgeInsets.all(10),
  161. child: Row(
  162. mainAxisAlignment:
  163. MainAxisAlignment.spaceBetween,
  164. children: [
  165. Text(
  166. '就诊时间',
  167. style: TextStyle(
  168. fontSize: 15, color: Colors.grey),
  169. ),
  170. Text(
  171. mVisitTime,
  172. style: TextStyle(fontSize: 15),
  173. ),
  174. ]),
  175. ),
  176. Padding(
  177. padding: EdgeInsets.all(10),
  178. child: Row(
  179. mainAxisAlignment:
  180. MainAxisAlignment.spaceBetween,
  181. children: [
  182. Text(
  183. '挂号科室',
  184. style: TextStyle(
  185. fontSize: 15, color: Colors.grey),
  186. ),
  187. Text(
  188. mDeptName,
  189. style: TextStyle(fontSize: 15),
  190. ),
  191. ]),
  192. ),
  193. Padding(
  194. padding: EdgeInsets.all(10),
  195. child: Row(
  196. mainAxisAlignment:
  197. MainAxisAlignment.spaceBetween,
  198. children: [
  199. Text(
  200. '医生姓名',
  201. style: TextStyle(
  202. fontSize: 15, color: Colors.grey),
  203. ),
  204. Text(
  205. mDoctorName,
  206. style: TextStyle(fontSize: 15),
  207. ),
  208. ]),
  209. ),
  210. ]),
  211. ),
  212. ),
  213. SizedBox(height: 8),
  214. ClipRRect(
  215. borderRadius: BorderRadius.circular(10.0),
  216. child: Container(
  217. color: Colors.white,
  218. padding: const EdgeInsets.all(10),
  219. child: Column(
  220. mainAxisSize: MainAxisSize.min,
  221. crossAxisAlignment: CrossAxisAlignment.start,
  222. children: <Widget>[
  223. Padding(
  224. padding: EdgeInsets.all(10),
  225. child: Row(
  226. mainAxisAlignment:
  227. MainAxisAlignment.spaceBetween,
  228. children: [
  229. Expanded(
  230. child: TextField(
  231. maxLines: 5, // 设置最大行数
  232. enabled: false,
  233. decoration: InputDecoration(
  234. border: OutlineInputBorder(),
  235. hintText: mRemark,
  236. ),
  237. ),
  238. ),
  239. ]),
  240. ),
  241. ]),
  242. ),
  243. ),
  244. Padding(
  245. padding: EdgeInsets.all(10),
  246. child: Row(
  247. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  248. children: [
  249. ElevatedButton(
  250. style: ButtonStyle(
  251. backgroundColor:
  252. MaterialStateProperty.all(Colors.white),
  253. ),
  254. child: Text(
  255. '返回',
  256. style: const TextStyle(
  257. fontSize: 15, color: Colors.black),
  258. ),
  259. onPressed: () {
  260. Navigator.pop(context);
  261. },
  262. ),
  263. ElevatedButton(
  264. style: ButtonStyle(
  265. backgroundColor:
  266. MaterialStateProperty.all(Colors.blue),
  267. ),
  268. child: Text(
  269. '预约列表',
  270. style: const TextStyle(
  271. fontSize: 15, color: Colors.white),
  272. ),
  273. onPressed: () {
  274. Navigator.push(
  275. context,
  276. MaterialPageRoute(
  277. builder: (context) => RecordRegistration()),
  278. );
  279. },
  280. ),
  281. ]),
  282. ),
  283. ]))));
  284. }
  285. }