Hibok
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

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