123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335 |
- import 'package:flutter/material.dart';
- import 'package:get_it/get_it.dart';
- import 'package:ustest/Services/UserService.dart';
- import 'package:web_socket_channel/web_socket_channel.dart';
- import 'dart:convert';
- import 'dart:typed_data';
- import 'package:flutter/services.dart';
- class SignInScreen extends StatelessWidget {
- const SignInScreen();
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.grey[200],
- body: const Center(
- child: SizedBox(
- width: 400,
- child: Card(
- child: SignInForm(),
- ),
- ),
- ),
- );
- }
- }
- class SignInForm extends StatefulWidget {
- const SignInForm();
- @override
- _SignInFormState createState() => _SignInFormState();
- }
- class _SignInFormState extends State<SignInForm> {
- final _serverUrlTextController =
- TextEditingController(text: "http://192.168.6.20:8303");
- final _userNameTextController = TextEditingController(text: "fly01");
- final _userPasswordTextController =
- TextEditingController(text: "fb6414d24e3c347d46032b0496f1c4e4");
- final _statusContoller = Text('');
- double _formProgress = 0;
- @override
- Widget build(BuildContext context) {
- print("build Signin");
- return Form(
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- LinearProgressIndicator(value: _formProgress),
- Text('Sign In', style: Theme.of(context).textTheme.headline4),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: TextFormField(
- controller: _serverUrlTextController,
- decoration: const InputDecoration(hintText: 'Server Url'),
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: TextFormField(
- controller: _userNameTextController,
- decoration: const InputDecoration(hintText: 'User Name'),
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: TextFormField(
- controller: _userPasswordTextController,
- decoration: const InputDecoration(hintText: 'Password'),
- ),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- TextButton(
- style: ButtonStyle(
- foregroundColor: MaterialStateProperty.resolveWith(
- (Set<MaterialState> states) {
- return states.contains(MaterialState.disabled)
- ? null
- : Colors.white;
- }),
- backgroundColor: MaterialStateProperty.resolveWith(
- (Set<MaterialState> states) {
- return states.contains(MaterialState.disabled)
- ? null
- : Colors.blue;
- }),
- ),
- onPressed: _showWelcomeScreen,
- child: const Text('Sign In'),
- ),
- Padding(
- padding: const EdgeInsets.all(8.0),
- child: TextButton(
- style: ButtonStyle(
- foregroundColor: MaterialStateProperty.resolveWith(
- (Set<MaterialState> states) {
- return states.contains(MaterialState.disabled)
- ? null
- : Colors.white;
- }),
- backgroundColor: MaterialStateProperty.resolveWith(
- (Set<MaterialState> states) {
- return states.contains(MaterialState.disabled)
- ? null
- : Colors.blue;
- }),
- ),
- onPressed: () => {Navigator.of(context).pop()},
- child: const Text('Cancel'),
- ),
- ),
- ],
- )),
- ],
- ),
- );
- }
- void _showWelcomeScreen() async {
- try {
- var service = GetIt.instance.get<UserService>();
- var userName = _userNameTextController.text;
- var password = _userPasswordTextController.text;
- var host = _serverUrlTextController.text;
- var result = await service.signInAsync(host, userName, password);
- if (result != null) {
- Navigator.of(context).pushNamed('/');
- }
- } catch (e) {
- print('signInAsync ex: $e');
- }
- }
- }
- enum NotificationTypeEnum {
- /// <summary>
- /// Unknown|0| 未知
- /// </summary>
- Unknown,
- /// <summary>
- /// ChatMsgNotification|1| 聊天通知
- /// </summary>
- ChatMsgNotification,
- /// <summary>
- /// TokenReplacedNotification|2| 账号被替换登出通知
- /// </summary>
- TokenReplacedNotification,
- /// <summary>
- /// DisconnectNotification| 3|与服务器断开连接通知
- /// </summary>
- DisconnectNotification,
- /// <summary>
- /// ConnectionNotification| 4| 与服务器已连接通知
- /// </summary>
- ConnectionNotification,
- /// <summary>
- /// ExamRecordsFinishedNotification| 5 | 完成检查通知
- /// </summary>
- ExamRecordsFinishedNotification,
- /// <summary>
- /// RejectApplyConsultationNotification| 6 | 拒绝预约申请的通知
- /// </summary>
- RejectApplyConsultationNotification,
- /// <summary>
- /// CancelInvitingInLiveConsultationNotification| 7 | 取消会诊过程中邀请其他成员的通知
- /// </summary>
- CancelInvitingInLiveConsultationNotification,
- /// <summary>
- /// InviteInLiveConsultationNotification| 8 | 会诊过程中邀请其他成员的通知
- /// </summary>
- InviteInLiveConsultationNotification,
- /// <summary>
- /// InviteInLiveConsultationNotification| 9 | 会诊开始前提醒的通知
- /// </summary>
- ConsultationRemindNotification,
- /// <summary>
- /// PasswordExpiredWarningNotification| 10 | 用户密码过期预警通知
- /// </summary>
- PasswordExpiredWarningNotification,
- /// <summary>
- /// InviteLiveConsultationNotification| 11 | 开始会诊的通知
- /// </summary>
- InviteLiveConsultationNotification,
- /// <summary>
- /// AcceptLiveConsultationNotification| 12 | 接受会诊的通知
- /// </summary>
- AcceptLiveConsultationNotification,
- /// <summary>
- /// RejectLiveConsultationNotification| 13 | 拒绝会诊的通知
- /// </summary>
- RejectLiveConsultationNotification,
- /// <summary>
- /// InviteLiveConsultationToDeviceNotification| 14 | 开始会诊通知 to 设备端
- /// </summary>
- InviteLiveConsultationToDeviceNotification,
- /// <summary>
- /// CancelLiveConsultationNotification| 15 | 取消会诊通知
- /// </summary>
- CancelLiveConsultationNotification,
- /// <summary>
- /// CloseLiveConsultationNotification| 16 | 关闭会诊通知
- /// </summary>
- CloseLiveConsultationNotification,
- /// <summary>
- /// JoinLiveConsultationNotification| 17 | 进入会诊通知
- /// </summary>
- JoinLiveConsultationNotification,
- /// <summary>
- /// NetworkErrConsultationNotification| 18 | 网络质量不佳会诊通知
- /// </summary>
- NetworkErrConsultationNotification,
- /// <summary>
- /// LeaveConsultationNotification| 19 | 离开会诊通知
- /// </summary>
- LeaveConsultationNotification,
- /// <summary>
- /// JoinInLiveConsultationNotification| 20 | 会诊中加入房间
- /// </summary>
- JoinInLiveConsultationNotification,
- /// <summary>
- /// RejectLiveConsultationNotification| 21 | 拒绝会诊的通知
- /// </summary>
- RejectInviteLiveConsultationNotification,
- /// <summary>
- /// ApplyConsultationNotification| 22 | 会诊申请通知
- /// </summary>
- ApplyConsultationNotification,
- /// <summary>
- /// ApprovalApplyConsultationNotification| 23 | 批准申请会诊通知
- /// </summary>
- ApprovalApplyConsultationNotification,
- /// <summary>
- /// InviteeConsultationNotification| 24 | 会诊受邀请人通知
- /// </summary>
- InviteeConsultationNotification,
- /// <summary>
- /// InviteeApproveApplyConsultationNotification| 25 | 会诊受邀请参与人同意通知
- /// </summary>
- InviteeApproveApplyConsultationNotification,
- /// <summary>
- /// InviteeRejectApplyConsultationNotification| 26 | 会诊受邀请参与人拒绝通知
- /// </summary>
- InviteeRejectApplyConsultationNotification,
- /// <summary>
- /// MuteLiveConsultationNotification| 27 | 开启关闭静音
- /// </summary>
- MuteLiveConsultationNotification,
- /// <summary>
- /// SwitchLiveConsultationVideoNotification| 28 | 开启关闭视频
- /// </summary>
- SwitchLiveConsultationVideoNotification,
- /// <summary>
- /// HeartRateJoinConsultationNotification| 29 | 会诊心跳,进入房间
- /// </summary>
- HeartRateJoinConsultationNotification,
- /// <summary>
- /// HeartRateLeaveConsultationNotification| 30 | 会诊心跳,离开房间
- /// </summary>
- HeartRateLeaveConsultationNotification,
- /// <summary>
- /// CloseLiveConsultationToDeviceNotification| 31 | 关闭会诊通知 to 设备端
- /// </summary>
- CloseLiveConsultationToDeviceNotification,
- /// <summary>
- /// CancelLiveConsultationToDeviceNotification| 32 | 取消会诊通知 to 设备端
- /// </summary>
- CancelLiveConsultationToDeviceNotification
- }
- class ConnectionNotification {
- NotificationTypeEnum notificationType;
- ConnectionNotification({
- this.notificationType = NotificationTypeEnum.Unknown,
- });
- factory ConnectionNotification.fromJson(Map<String, dynamic> map) {
- return ConnectionNotification(
- notificationType: NotificationTypeEnum.values
- .firstWhere((e) => e.index == map['NotificationType']),
- );
- }
- }
- class DisconnectNotification {
- NotificationTypeEnum notificationType;
- DisconnectNotification({
- this.notificationType = NotificationTypeEnum.Unknown,
- });
- factory DisconnectNotification.fromJson(Map<String, dynamic> map) {
- return DisconnectNotification(
- notificationType: NotificationTypeEnum.values
- .firstWhere((e) => e.index == map['NotificationType']),
- );
- }
- }
- class FinishNotifyRecordsMessage {}
|