success_registration.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  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 MaterialApp(
  78. home: Scaffold(
  79. resizeToAvoidBottomInset: false,
  80. backgroundColor: Global.BackgroundColor,
  81. appBar: new AppBar(title: new Text('预约挂号'), centerTitle: true),
  82. body: SingleChildScrollView(
  83. child:Container(
  84. padding: EdgeInsets.all(10),
  85. child: Column(
  86. mainAxisSize: MainAxisSize.min,
  87. crossAxisAlignment: CrossAxisAlignment.center,
  88. children: <Widget>[
  89. ClipRRect(
  90. borderRadius: BorderRadius.circular(10.0),
  91. child: Container(
  92. color: Global.BackgroundColor,
  93. padding: EdgeInsets.all(10),
  94. child: const Column(
  95. mainAxisSize: MainAxisSize.min,
  96. crossAxisAlignment: CrossAxisAlignment.start,
  97. children: <Widget>[
  98. Padding(
  99. padding: EdgeInsets.all(10),
  100. child: Icon(
  101. Icons.check_circle,
  102. size: 85.0, // 设置Icon的大小
  103. color: Colors.blueAccent, // 设置Icon的颜色
  104. ),
  105. ),
  106. Text(
  107. '挂号成功',
  108. style: TextStyle(
  109. fontSize: 28,
  110. color: Colors.blue,
  111. ),
  112. )
  113. ]),
  114. ),
  115. ),
  116. SizedBox(height: 8),
  117. ClipRRect(
  118. borderRadius: BorderRadius.circular(10.0),
  119. child: Container(
  120. color: Colors.white,
  121. padding: const EdgeInsets.all(10),
  122. child: Column(
  123. mainAxisSize: MainAxisSize.min,
  124. crossAxisAlignment: CrossAxisAlignment.start,
  125. children: <Widget>[
  126. /*Padding(
  127. padding: EdgeInsets.all(10),
  128. child: Row(
  129. mainAxisAlignment:
  130. MainAxisAlignment.spaceBetween,
  131. children: [
  132. Text(
  133. '挂号费',
  134. style: TextStyle(
  135. fontSize: 15, color: Colors.grey),
  136. ),
  137. Text(
  138. '¥12.5',
  139. style: TextStyle(fontSize: 15),
  140. ),
  141. ]),
  142. ),*/
  143. Padding(
  144. padding: EdgeInsets.all(10),
  145. child: Row(
  146. mainAxisAlignment:
  147. MainAxisAlignment.spaceBetween,
  148. children: [
  149. Text(
  150. '就诊人',
  151. style: TextStyle(
  152. fontSize: 15, color: Colors.grey),
  153. ),
  154. Text(
  155. mPatient,
  156. style: TextStyle(fontSize: 15),
  157. ),
  158. ]),
  159. ),
  160. Padding(
  161. padding: EdgeInsets.all(10),
  162. child: Row(
  163. mainAxisAlignment:
  164. MainAxisAlignment.spaceBetween,
  165. children: [
  166. Text(
  167. '就诊时间',
  168. style: TextStyle(
  169. fontSize: 15, color: Colors.grey),
  170. ),
  171. Text(
  172. mVisitTime,
  173. style: TextStyle(fontSize: 15),
  174. ),
  175. ]),
  176. ),
  177. Padding(
  178. padding: EdgeInsets.all(10),
  179. child: Row(
  180. mainAxisAlignment:
  181. MainAxisAlignment.spaceBetween,
  182. children: [
  183. Text(
  184. '挂号科室',
  185. style: TextStyle(
  186. fontSize: 15, color: Colors.grey),
  187. ),
  188. Text(
  189. mDeptName,
  190. style: TextStyle(fontSize: 15),
  191. ),
  192. ]),
  193. ),
  194. Padding(
  195. padding: EdgeInsets.all(10),
  196. child: Row(
  197. mainAxisAlignment:
  198. MainAxisAlignment.spaceBetween,
  199. children: [
  200. Text(
  201. '医生姓名',
  202. style: TextStyle(
  203. fontSize: 15, color: Colors.grey),
  204. ),
  205. Text(
  206. mDoctorName,
  207. style: TextStyle(fontSize: 15),
  208. ),
  209. ]),
  210. ),
  211. ]),
  212. ),
  213. ),
  214. SizedBox(height: 8),
  215. ClipRRect(
  216. borderRadius: BorderRadius.circular(10.0),
  217. child: Container(
  218. color: Colors.white,
  219. padding: const EdgeInsets.all(10),
  220. child: Column(
  221. mainAxisSize: MainAxisSize.min,
  222. crossAxisAlignment: CrossAxisAlignment.start,
  223. children: <Widget>[
  224. Padding(
  225. padding: EdgeInsets.all(10),
  226. child: Row(
  227. mainAxisAlignment:
  228. MainAxisAlignment.spaceBetween,
  229. children: [
  230. Expanded(
  231. child: TextField(
  232. maxLines: 5, // 设置最大行数
  233. enabled: false,
  234. decoration: InputDecoration(
  235. border: OutlineInputBorder(),
  236. hintText: mRemark,
  237. ),
  238. ),
  239. ),
  240. ]),
  241. ),
  242. ]),
  243. ),
  244. ),
  245. Padding(
  246. padding: EdgeInsets.all(10),
  247. child: Row(
  248. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  249. children: [
  250. ElevatedButton(
  251. style: ButtonStyle(
  252. backgroundColor:
  253. MaterialStateProperty.all(Colors.white),
  254. ),
  255. child: Text(
  256. '返回',
  257. style: const TextStyle(
  258. fontSize: 15, color: Colors.black),
  259. ),
  260. onPressed: () {
  261. Navigator.pop(context);
  262. },
  263. ),
  264. ElevatedButton(
  265. style: ButtonStyle(
  266. backgroundColor:
  267. MaterialStateProperty.all(Colors.blue),
  268. ),
  269. child: Text(
  270. '预约列表',
  271. style: const TextStyle(
  272. fontSize: 15, color: Colors.white),
  273. ),
  274. onPressed: () {
  275. Navigator.push(
  276. context,
  277. MaterialPageRoute(
  278. builder: (context) => RecordRegistration()),
  279. );
  280. },
  281. ),
  282. ]),
  283. ),
  284. ])))));
  285. }
  286. }