Hibok
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

759 lignes
26 KiB

  1. import 'dart:async';
  2. import 'dart:ffi';
  3. import 'package:chat/data/UserData.dart';
  4. import 'package:chat/data/translate_hk_data_mgr.dart';
  5. import 'package:chat/models/group_info_model.dart';
  6. import 'package:chat/models/money_change.dart';
  7. import 'package:chat/utils/MessageMgr.dart';
  8. import 'package:chat/utils/msgHandler.dart';
  9. import 'package:chat/utils/screen.dart';
  10. import 'package:chat/utils/sp_utils.dart';
  11. import 'package:flutter/cupertino.dart';
  12. import 'package:flutter/material.dart';
  13. import 'package:flutter/services.dart';
  14. import 'package:provider/provider.dart';
  15. import '../../data/constants.dart';
  16. import '../../generated/i18n.dart';
  17. import '../../r.dart';
  18. import '../../utils/CustomUI.dart';
  19. import 'package:chat/utils/PopUpMenu.dart' as myPop;
  20. class TranslationButlerPage extends StatefulWidget {
  21. final GroupInfoModel groupInfoModel;
  22. TranslationButlerPage({Key key, this.groupInfoModel}) : super(key: key);
  23. @override
  24. State<StatefulWidget> createState() {
  25. return TranslationButlerPageState();
  26. }
  27. }
  28. class ValueModel{
  29. String name;
  30. var key;
  31. ValueModel(this.name,this.key);
  32. }
  33. class TranslationButlerPageState extends State<TranslationButlerPage> {
  34. int curToLang = 1;
  35. int curSourceLang = UserData().language;
  36. int curScenes = 0;
  37. List<ValueModel> langList; ///语言列表
  38. List<ValueModel> scenesList; ///场景列表
  39. String extraMsg='';
  40. FocusNode focusNode = new FocusNode();
  41. String textLimitTips='';
  42. ScrollController _scrollController = new ScrollController();
  43. int orderStatus = 0; ///订单状态
  44. int secondsPassed = 1;///等待时间计数
  45. int timeStamp; ///订单开始时间戳
  46. Timer waitTimer;///等待时间计时器
  47. int time60=1; ///60秒一圈计数
  48. int waitNum=0;
  49. refreshOrder(args){
  50. orderStatus = TranslateHKMgr().orderStatus;
  51. switch(orderStatus){
  52. case TranslateHKMgr.ORDER_STATUS_EMPTY:
  53. isCreatingOrder=false;
  54. waitTimer?.cancel();
  55. secondsPassed = 0;
  56. SPUtils.save(Constants.TranslationHelper,null);
  57. break;
  58. case TranslateHKMgr.ORDER_STATUS_WAITING:
  59. // secondsPassed = 0;
  60. print('开始倒计时$secondsPassed');
  61. waitNum = TranslateHKMgr().waitNum;
  62. waitTimer = Timer.periodic(Duration(seconds: 1), (Timer t) {
  63. handleTick();
  64. });
  65. break;
  66. }
  67. setState(() {});
  68. }
  69. ///订单没有人接,超时,服务器会发送取消订单通知
  70. canceledOrder(args){
  71. TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY;
  72. refreshOrder(null);
  73. }
  74. @override
  75. void initState() {
  76. super.initState();
  77. orderStatus = TranslateHKMgr().orderStatus;
  78. waitNum = TranslateHKMgr().waitNum;
  79. initData();
  80. MessageMgr().on(MessageMgr.TRANSLATE_HK_REFRESH_ORDER, refreshOrder);
  81. MessageMgr().on(MessageMgr.TRANSLATE_HK_CANCEL_ORDER, canceledOrder);
  82. WidgetsBinding.instance.addPostFrameCallback((_) {
  83. // Future.delayed(Duration(seconds: 1), () {
  84. //// CustomUI.buildTranslationHelperOrderDialog(context,true);
  85. // Navigator.of(context).push(
  86. // new MaterialPageRoute(
  87. // builder: (context) {
  88. // return ChatPage(
  89. // key: Key('Chat'),
  90. // friendId: 100029,
  91. // isTranslateButler: true,
  92. // );
  93. // },
  94. // ),
  95. // );
  96. // });
  97. });
  98. }
  99. initData() async {
  100. String time = (await SPUtils.get(Constants.TranslationHelper));
  101. if (time != null) {
  102. print('time:$time');
  103. int second = int.parse(time) ~/ 1000;
  104. if((DateTime.now().millisecondsSinceEpoch ~/ 1000 - second)>8*3600){ ///超过5小时清除缓存记录
  105. SPUtils.save(Constants.TranslationHelper,null);
  106. return;
  107. }
  108. secondsPassed =
  109. ((DateTime.now().millisecondsSinceEpoch ~/ 1000 - second));
  110. refreshOrder(null);
  111. print('缓存的秒数 $secondsPassed');
  112. } else {
  113. print('time: null');
  114. }
  115. }
  116. bool isCreatingOrder=false;
  117. apply() {
  118. if(isCreatingOrder){
  119. return;
  120. }
  121. isCreatingOrder=true;
  122. TranslateHKMgr().startWaitTime=DateTime.now().millisecondsSinceEpoch;
  123. MsgHandler.sendCreateTranslateOrder(langList[curSourceLang].key,langList[curToLang].key,scenesList[curScenes].key,extraMsg);
  124. extraMsg='';
  125. }
  126. @override
  127. void didChangeDependencies() {
  128. super.didChangeDependencies();
  129. textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', '80');
  130. langList = [
  131. ValueModel(I18n.of(context).english,1),
  132. ValueModel(I18n.of(context).Vietnamese,2),
  133. ValueModel(I18n.of(context).traditional_Chinese,4),
  134. ValueModel(I18n.of(context).Simplified_Chinese,8),
  135. ValueModel(I18n.of(context).Korean,16),
  136. ValueModel(I18n.of(context).Japanese,32),
  137. ];
  138. scenesList = [
  139. ValueModel(I18n.of(context).translation_scenes_1,0),
  140. ValueModel(I18n.of(context).translation_scenes_2,1),
  141. ValueModel(I18n.of(context).translation_scenes_3,2),
  142. ValueModel(I18n.of(context).translation_scenes_4,3),
  143. ];
  144. }
  145. @override
  146. void dispose() {
  147. waitTimer?.cancel();
  148. MessageMgr().off(MessageMgr.TRANSLATE_HK_REFRESH_ORDER, refreshOrder);
  149. MessageMgr().off(MessageMgr.TRANSLATE_HK_CANCEL_ORDER, canceledOrder);
  150. if (orderStatus==TranslateHKMgr.ORDER_STATUS_WAITING && timeStamp != null) {
  151. print('保存时间戳$timeStamp');
  152. SPUtils.save(Constants.TranslationHelper, timeStamp.toString());
  153. }
  154. super.dispose();
  155. }
  156. _langPopMenu(bool isSource) {
  157. var curIndex = isSource ? curSourceLang : curToLang;
  158. return myPop.PopupMenuButton(
  159. child: Container(
  160. height: 37,
  161. width: double.maxFinite,
  162. decoration: BoxDecoration(
  163. color: Color(0xffD3E7FF),
  164. borderRadius: BorderRadius.circular(5)),
  165. child: Row(
  166. mainAxisAlignment: MainAxisAlignment.start,
  167. children: <Widget>[
  168. Expanded(
  169. child: Container(padding: EdgeInsets.only(left: 5),alignment: Alignment.center,child: Text(
  170. langList[curIndex].name,
  171. textAlign: TextAlign.center,
  172. overflow: TextOverflow.ellipsis,
  173. textScaleFactor: 1.0,
  174. style: TextStyle(color: Color(0xff4A5E76), fontSize: 14),
  175. ),)),
  176. Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
  177. size: 30, color: Color(0xff4A5E76))
  178. ],
  179. ),
  180. ),
  181. offset: Offset(0, 100),
  182. onSelected: (int index) {
  183. if (curIndex != index) {
  184. if (isSource) {
  185. curSourceLang = index;
  186. } else {
  187. curToLang = index;
  188. }
  189. print('更换翻译语言');
  190. setState(() {});
  191. }
  192. },
  193. itemBuilder: (BuildContext context) {
  194. return List<myPop.PopupMenuItem<int>>.generate(langList.length,
  195. (int i) {
  196. return myPop.PopupMenuItem(
  197. child: Container(
  198. alignment: Alignment.center,
  199. color: Colors.white,
  200. padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
  201. child: Text(langList[i].name,
  202. textScaleFactor: 1.0,
  203. maxLines: 1,
  204. style: TextStyle(
  205. color: i == curIndex
  206. ? Colors.blueAccent
  207. : Color(AppColors.AppBarColor),
  208. fontSize: 14)),
  209. ),
  210. value: i,
  211. );
  212. });
  213. });
  214. }
  215. _scenesPopMenu() {
  216. var curIndex = curScenes;
  217. return myPop.PopupMenuButton(
  218. child: Container(
  219. height: 40,
  220. width: double.maxFinite,
  221. decoration:BoxDecoration(
  222. borderRadius: BorderRadius.all(Radius.circular(6)),
  223. color: Colors.white,
  224. boxShadow: [
  225. BoxShadow(
  226. color: Color(0x739f9f9f),
  227. offset: Offset(0.2, 0.4),
  228. blurRadius: 1.0,
  229. spreadRadius: 0.6),
  230. // BoxShadow(
  231. // color: Color(0x9900FF00), offset: Offset(1.0, 1.0)),
  232. // BoxShadow(color: Color(0xFF0000FF))
  233. ]),
  234. child: Row(
  235. mainAxisAlignment: MainAxisAlignment.start,
  236. children: <Widget>[
  237. Expanded(
  238. child: Text(
  239. scenesList[curIndex].name,
  240. textAlign: TextAlign.center,
  241. overflow: TextOverflow.ellipsis,
  242. textScaleFactor: 1.0,
  243. style: TextStyle(color: Color(0xff3875E9), fontSize: 14),
  244. )),
  245. Icon(IconData(0xe63b, fontFamily: Constants.IconFontFamily),
  246. size: 30, color: Color(0xff4A5E76))
  247. ],
  248. ),
  249. ),
  250. offset: Offset(0, 100),
  251. onSelected: (int index) {
  252. if (curIndex != index) {
  253. curScenes = index;
  254. print('更换场景');
  255. setState(() {});
  256. }
  257. },
  258. itemBuilder: (BuildContext context) {
  259. return List<myPop.PopupMenuItem<int>>.generate(scenesList.length,
  260. (int i) {
  261. return myPop.PopupMenuItem(
  262. child: Container(
  263. width: Screen.width *0.43,
  264. alignment: Alignment.center,
  265. color: Colors.white,
  266. padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
  267. child: Text(scenesList[i].name,
  268. textScaleFactor: 1.0,
  269. maxLines: 1,
  270. style: TextStyle(
  271. color: i == curIndex
  272. ? Colors.blueAccent
  273. : Color(AppColors.AppBarColor),
  274. fontSize: 14)),
  275. ),
  276. value: i,
  277. );
  278. });
  279. });
  280. }
  281. @override
  282. Widget build(BuildContext context) {
  283. Widget appBar = AppBar(
  284. backgroundColor: AppColors.NewAppbarBgColor,
  285. title: Text(
  286. I18n.of(context).translation_butler,
  287. textScaleFactor: 1.0,
  288. style: TextStyle(color: AppColors.NewAppbarTextColor),
  289. ),
  290. // leading: CustomUI.buildCustomLeading(context),
  291. centerTitle: true,
  292. actions: <Widget>[
  293. Container(
  294. child: CustomUI.buildImageLabel(R.assetsImagesCoin,
  295. Provider.of<MoneyChangeProvider>(context).money,
  296. isLeft: true),
  297. decoration: BoxDecoration(borderRadius: BorderRadius.circular(15)),
  298. ),
  299. SizedBox(
  300. width: 10,
  301. )
  302. ],
  303. );
  304. return Scaffold(
  305. appBar: appBar,
  306. body: SafeArea(
  307. child: Container(
  308. color: Color(0xffE8EAF0),
  309. child: orderStatus==TranslateHKMgr.ORDER_STATUS_EMPTY ? createOrderPage() : waitPage(),
  310. ),
  311. ),
  312. );
  313. }
  314. Widget createOrderPage() {
  315. return ListView(
  316. controller: _scrollController,
  317. children: <Widget>[
  318. Padding(
  319. padding: EdgeInsets.only(left: 20, right: 10, top: 15),
  320. child: Text(
  321. I18n.of(context).translation_butler_tips,
  322. textScaleFactor: 1.0,
  323. style: TextStyle(color: Color(0xffABABAB), fontSize: 13),
  324. ),
  325. ),
  326. Container(
  327. margin: EdgeInsets.all(10),
  328. child: Card(
  329. elevation: 2, // 阴影
  330. shape: RoundedRectangleBorder(
  331. borderRadius: BorderRadius.circular(10),
  332. // side: BorderSide(color: Colors.green,width: 25),
  333. ),
  334. child: Container(
  335. padding: EdgeInsets.all(10),
  336. child: Column(
  337. crossAxisAlignment: CrossAxisAlignment.start,
  338. children: <Widget>[
  339. Padding(
  340. padding: EdgeInsets.only(bottom: 12),
  341. child: Text(
  342. I18n.of(context).choose_language,
  343. textScaleFactor: 1.0,
  344. textAlign: TextAlign.left,
  345. style: TextStyle(
  346. color: AppColors.NewAppbarTextColor, fontSize: 17),
  347. ),
  348. ),
  349. Row(
  350. children: <Widget>[
  351. SizedBox(width: 15,),
  352. Expanded(
  353. child: _langPopMenu(true),
  354. flex: 5,
  355. ),
  356. Expanded(
  357. child: InkWell(
  358. onTap: () {
  359. var temp = curSourceLang;
  360. curSourceLang = curToLang;
  361. curToLang = temp;
  362. setState(() {});
  363. },
  364. child: Container(
  365. child: Icon(
  366. IconData(
  367. 0xe669,
  368. fontFamily: Constants.IconFontFamily,
  369. ),
  370. size: 24,
  371. color: Color(0xff4A5E76),
  372. ),
  373. padding: EdgeInsets.symmetric(
  374. vertical: 5, horizontal: 5),
  375. ),
  376. ),
  377. flex: 2,
  378. ),
  379. Expanded(
  380. child: _langPopMenu(false),
  381. flex: 5,
  382. ),
  383. SizedBox(width: 15,),
  384. ],
  385. ),
  386. Row(
  387. children: <Widget>[
  388. Expanded(
  389. child: Image.asset(
  390. R.assetsImagesImgTranslationIcon,
  391. width: 195,
  392. height: 175,
  393. ),
  394. flex: 4,
  395. ),
  396. Expanded(
  397. child: Column(
  398. children: <Widget>[
  399. Text(
  400. I18n.of(context).translation_butler_scenes,
  401. textScaleFactor: 1.0,
  402. textAlign: TextAlign.left,
  403. style: TextStyle(
  404. color: AppColors.NewAppbarTextColor,
  405. fontWeight: FontWeight.w700,
  406. fontSize: 15),
  407. ),
  408. SizedBox(height: 10,),
  409. _scenesPopMenu(),
  410. ],
  411. ),
  412. flex: 6,
  413. )
  414. ],
  415. ),
  416. Stack(children: <Widget>[
  417. Container(
  418. alignment: Alignment.topLeft,
  419. height: 110.5,
  420. padding: EdgeInsets.only(bottom: 10),
  421. decoration: BoxDecoration(
  422. color: Color(0xFFE9EEF4),
  423. borderRadius: BorderRadius.all(Radius.circular(10))),
  424. child: TextField(
  425. keyboardAppearance: Brightness.light,
  426. maxLines: 10,
  427. focusNode: focusNode,
  428. textInputAction: TextInputAction.done,
  429. onSubmitted: (input) {
  430. focusNode.unfocus();
  431. },
  432. decoration: new InputDecoration(
  433. hintText: I18n.of(context).translation_more_desc,
  434. hintStyle: TextStyle(fontSize: 14),
  435. border: InputBorder.none,
  436. ),
  437. // maxLines: 1,
  438. inputFormatters: [LengthLimitingTextInputFormatter(80)],
  439. // obscureText: true,
  440. style: TextStyle(textBaseline: TextBaseline.alphabetic),
  441. onChanged: (str) {
  442. if (_scrollController != null) {
  443. ///解决键盘遮挡输入框
  444. _scrollController.position.moveTo(
  445. 200,
  446. duration: Duration(milliseconds: 100),
  447. curve: Curves.easeIn,
  448. );
  449. }
  450. extraMsg = str;
  451. textLimitTips = I18n.of(context).translation_input_limit.replaceAll('/s1', (80-str.length).toString());
  452. setState(() {});
  453. },
  454. ),
  455. ),
  456. Positioned.fill(child: Container(padding: EdgeInsets.only(bottom: 5,right: 5),alignment: Alignment.bottomRight,child: Text(
  457. textLimitTips,
  458. textScaleFactor: 1.0,
  459. style: TextStyle(color: Color(0xFF95A3B2), fontSize: 11),
  460. ),)),
  461. ],),
  462. Padding(padding: EdgeInsets.only(left: 5,right: 5,top: 5,bottom: 8),child: Text(
  463. I18n.of(context).translation_butler_scenes_tips,
  464. textScaleFactor: 1.0,
  465. style: TextStyle(color: Color(0xFFFA7B3D), fontSize: 12),
  466. ),),
  467. ],
  468. ),
  469. ),
  470. ),
  471. ),
  472. Container(
  473. margin: EdgeInsets.only(left: 70, right: 70, top: 50),
  474. height: 47,
  475. child: RaisedButton(
  476. color: Color(0xff3875E9),
  477. shape: RoundedRectangleBorder(
  478. borderRadius: BorderRadius.all(Radius.circular(10))),
  479. child: Text(
  480. I18n.of(context).translation_butler_call + ' (50h)',
  481. textScaleFactor: 1.0,
  482. style: TextStyle(color: Colors.white, fontSize: 19),
  483. ),
  484. onPressed: () {
  485. timeStamp = DateTime.now().millisecondsSinceEpoch;
  486. apply();
  487. }),
  488. ),
  489. Container(
  490. width: double.maxFinite,
  491. alignment: Alignment.center,
  492. padding: EdgeInsets.only(left: 10, right: 10, top: 15,bottom: 20),
  493. child: Text(
  494. I18n.of(context).translation_butler_rules,
  495. textScaleFactor: 1.0,
  496. style: TextStyle(color: Color(0xffABABAB), fontSize: 13),
  497. ),
  498. ),
  499. ],
  500. );
  501. }
  502. Widget waitPage() {
  503. // ~/ 取整操作
  504. int seconds = secondsPassed % 60;
  505. int minutes = secondsPassed ~/ 60;
  506. return ListView(
  507. children: <Widget>[
  508. ///当前排队人数过多。。。
  509. Container(
  510. margin: EdgeInsets.all(10),
  511. child: Card(
  512. elevation: 2, // 阴影
  513. shape: RoundedRectangleBorder(
  514. borderRadius: BorderRadius.circular(10),
  515. // side: BorderSide(color: Colors.green,width: 25),
  516. ),
  517. child: Container(
  518. // width: double.maxFinite,
  519. // color: Colors.blue,
  520. padding: EdgeInsets.fromLTRB(14, 14, 14, 22),
  521. child: Column(
  522. children: <Widget>[
  523. Padding(
  524. padding: EdgeInsets.only(bottom: 20, top: 10),
  525. child: Text(
  526. I18n.of(context).translation_butler_tips2,
  527. textScaleFactor: 1.0,
  528. textAlign: TextAlign.left,
  529. style: TextStyle(color: Color(0xff797979), fontSize: 13),
  530. ),
  531. ),
  532. Container(
  533. width: double.maxFinite,
  534. child: Row(
  535. mainAxisSize: MainAxisSize.max,
  536. mainAxisAlignment: MainAxisAlignment.spaceAround,
  537. children: <Widget>[
  538. Column(
  539. mainAxisAlignment: MainAxisAlignment.center,
  540. children: <Widget>[
  541. fixedText(
  542. I18n.of(context).translation_butler_wait_people,
  543. fontSize: 16,
  544. color: Colors.black),
  545. SizedBox(
  546. height: 10,
  547. ),
  548. RichText(
  549. maxLines: 3,
  550. textAlign: TextAlign.center,
  551. text: TextSpan(children: [
  552. TextSpan(
  553. text: '$waitNum',
  554. style: TextStyle(
  555. color: Color(0xffFF1010),
  556. fontSize: 27)),
  557. TextSpan(
  558. text: ' ' +
  559. I18n.of(context)
  560. .translation_butler_wait_people_unit,
  561. style: TextStyle(
  562. color: Colors.black, fontSize: 17)),
  563. ]))
  564. ],
  565. ),
  566. Container(
  567. width: 1,
  568. height: 65,
  569. color: Color(0xffD8D8D8),
  570. ),
  571. Column(
  572. mainAxisAlignment: MainAxisAlignment.center,
  573. children: <Widget>[
  574. fixedText(
  575. I18n.of(context).translation_butler_wait_time,
  576. fontSize: 16,
  577. color: Colors.black),
  578. SizedBox(
  579. height: 10,
  580. ),
  581. RichText(
  582. maxLines: 3,
  583. textAlign: TextAlign.center,
  584. text: TextSpan(children: [
  585. TextSpan(
  586. text: '${waitNum*5}',
  587. style: TextStyle(
  588. color: Color(0xff3875E9),
  589. fontSize: 27)),
  590. TextSpan(
  591. text: ' ' + I18n.of(context).minute,
  592. style: TextStyle(
  593. color: Colors.black, fontSize: 17)),
  594. ]))
  595. ],
  596. ),
  597. ],
  598. ),
  599. )
  600. ],
  601. ),
  602. ),
  603. ),
  604. ),
  605. Padding(
  606. padding: EdgeInsets.only(left: 20, right: 10, top: 5, bottom: 10),
  607. child: Text(
  608. I18n.of(context).translation_butler_tips3,
  609. textScaleFactor: 1.0,
  610. style: TextStyle(color: Colors.black, fontSize: 18),
  611. ),
  612. ),
  613. Stack(
  614. alignment: Alignment.center,
  615. children: <Widget>[
  616. UnconstrainedBox(
  617. child: Container(
  618. //限制进度条的高度
  619. height: 190.0,
  620. //限制进度条的宽度
  621. width: 190.0,
  622. child: CircularProgressIndicator(
  623. //0~1的浮点数,用来表示进度多少;如果 value 为 null 或空,则显示一个动画,否则显示一个定值
  624. value: time60/60,
  625. strokeWidth: 5,
  626. //背景颜色
  627. backgroundColor: Color(0xffB2B2B2),
  628. //进度颜色
  629. valueColor:
  630. AlwaysStoppedAnimation<Color>(Color(0xff3875E9))),
  631. ),
  632. ),
  633. Column(
  634. children: <Widget>[
  635. Text(
  636. I18n.of(context).translation_butler_already_wait,
  637. textScaleFactor: 1.0,
  638. style: TextStyle(color: Colors.black, fontSize: 19),
  639. ),
  640. SizedBox(
  641. height: 10,
  642. ),
  643. Text(
  644. getFull(minutes) + ' : ' + getFull(seconds),
  645. textScaleFactor: 1.0,
  646. style: TextStyle(color: Color(0xffFF1010), fontSize: 35),
  647. )
  648. ],
  649. )
  650. ],
  651. ),
  652. Container(
  653. margin: EdgeInsets.only(left: 70, right: 70, top: 50),
  654. height: 47,
  655. child: RaisedButton(
  656. color: Color(0xff3875E9),
  657. shape: RoundedRectangleBorder(
  658. borderRadius: BorderRadius.all(Radius.circular(10))),
  659. child: Text(
  660. I18n.of(context).translation_butler_cancel,
  661. textScaleFactor: 1.0,
  662. style: TextStyle(color: Colors.white, fontSize: 19),
  663. ),
  664. onPressed: cancelOrder ),
  665. ),
  666. ],
  667. );
  668. }
  669. void cancelOrder()async {
  670. await SPUtils.save(Constants.TranslationHelper, null);
  671. setState(() {
  672. time60=0;
  673. TranslateHKMgr().orderStatus = TranslateHKMgr.ORDER_STATUS_EMPTY;
  674. refreshOrder(null);
  675. MsgHandler.sendCancelTranslateOrder();
  676. });
  677. }
  678. void handleTick() {
  679. setState(() {
  680. secondsPassed = secondsPassed + 1; //需要更新UI
  681. time60=time60+1;
  682. if(time60==60){
  683. time60=0;
  684. }
  685. });
  686. }
  687. getFull(int sec) {
  688. return sec < 10 ? '0$sec' : '$sec';
  689. }
  690. }