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.
 
 
 
 
 
 

761 lignes
26 KiB

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