Hibok
您不能選擇超過 %s 個話題 話題必須以字母或數字為開頭,可包含連接號 ('-') 且最長為 35 個字
 
 
 
 
 
 

201 行
7.0 KiB

  1. import 'package:chat/data/constants.dart';
  2. import 'package:chat/data/translate_hk_data_mgr.dart';
  3. import 'package:chat/generated/i18n.dart';
  4. import 'package:chat/r.dart';
  5. import 'package:chat/utils/HttpUtil.dart';
  6. import 'package:chat/utils/MessageMgr.dart';
  7. import 'package:chat/utils/count_down_button.dart';
  8. import 'package:chat/utils/msgHandler.dart';
  9. import 'package:chat/utils/screen.dart';
  10. import 'package:flutter/material.dart';
  11. ///翻译管家-结束后评论弹窗
  12. class TranslateOrderPushPage extends StatefulWidget {
  13. bool isUser;
  14. String orderId;
  15. int scenes;
  16. String desc;
  17. Function userStartChat;
  18. int createTime;
  19. TranslateOrderPushPage(this.isUser,
  20. {this.orderId,
  21. this.scenes,
  22. this.desc,
  23. this.userStartChat,
  24. this.createTime});
  25. @override
  26. State<StatefulWidget> createState() {
  27. return TranslateOrderPushPageState();
  28. }
  29. }
  30. class TranslateOrderPushPageState extends State<TranslateOrderPushPage> {
  31. @override
  32. void initState() {
  33. // TODO: implement initState
  34. super.initState();
  35. MessageMgr().on(MessageMgr.TRANSLATE_HK_CANCEL_ORDER, cancelOrder);
  36. }
  37. cancelOrder(args){
  38. Navigator.pop(context);
  39. }
  40. @override
  41. void dispose() {
  42. // TODO: implement dispose
  43. super.dispose();
  44. MessageMgr().off(MessageMgr.TRANSLATE_HK_CANCEL_ORDER, cancelOrder);
  45. }
  46. @override
  47. void didChangeDependencies() {
  48. // TODO: implement didChangeDependencies
  49. super.didChangeDependencies();
  50. }
  51. @override
  52. Widget build(BuildContext context) {
  53. // TODO: implement build
  54. var scenesList = [
  55. I18n.of(context).translation_scenes_1,
  56. I18n.of(context).translation_scenes_2,
  57. I18n.of(context).translation_scenes_3,
  58. I18n.of(context).translation_scenes_4,
  59. ];
  60. String translateStr= '时间:今天11:45 时长:5${I18n.of(context).minute}';
  61. String userStr= '下单时间:今天11:45 等待时长:10分钟';
  62. return UnconstrainedBox(
  63. alignment: Alignment.topCenter,
  64. child: InkWell(
  65. onTap: () {},
  66. child: Container(
  67. alignment: Alignment.topCenter,
  68. // height: 180,
  69. width: Screen.width - 20,
  70. margin: EdgeInsets.all(10),
  71. child: Card(
  72. elevation: 2, // 阴影
  73. shape: RoundedRectangleBorder(
  74. borderRadius: BorderRadius.circular(10),
  75. // side: BorderSide(color: Colors.green,width: 25),
  76. ),
  77. child: Container(
  78. // color: Colors.yellow,
  79. width: double.maxFinite,
  80. padding: EdgeInsets.all(16),
  81. child: Column(
  82. crossAxisAlignment: CrossAxisAlignment.start,
  83. children: <Widget>[
  84. Padding(
  85. padding: EdgeInsets.only(bottom: 15),
  86. child: Text(
  87. I18n.of(context).translation_butler_dialog_title,
  88. textScaleFactor: 1.0,
  89. textAlign: TextAlign.left,
  90. style: TextStyle(
  91. fontWeight: FontWeight.w500,
  92. color: AppColors.NewAppbarTextColor,
  93. fontSize: 17),
  94. ),
  95. ),
  96. Text(
  97. I18n.of(context).translation_butler_dialog_order.replaceAll(
  98. '/s1', widget.isUser ? I18n.of(context).you : 'xxx'),
  99. textScaleFactor: 1.0,
  100. textAlign: TextAlign.left,
  101. style: TextStyle(
  102. color: AppColors.NewAppbarTextColor, fontSize: 14),
  103. ),
  104. SizedBox(
  105. height: 10,
  106. ),
  107. Text(
  108. widget.isUser?userStr: translateStr,
  109. textScaleFactor: 1.0,
  110. textAlign: TextAlign.left,
  111. style: TextStyle(color: Color(0xFF797979), fontSize: 11),
  112. ),
  113. widget.isUser
  114. ? Container()
  115. : Text(
  116. '场景:${scenesList[widget.scenes]}',
  117. textScaleFactor: 1.0,
  118. textAlign: TextAlign.left,
  119. style:
  120. TextStyle(color: Color(0xFF797979), fontSize: 11),
  121. ),
  122. widget.isUser
  123. ? Container()
  124. : Text(
  125. '更多描述:${widget.desc}',
  126. textScaleFactor: 1.0,
  127. textAlign: TextAlign.left,
  128. style:
  129. TextStyle(color: Color(0xFF797979), fontSize: 11),
  130. ),
  131. //
  132. Container(
  133. margin: EdgeInsets.only(
  134. left: 30, right: 30, top: 20, bottom: 10),
  135. child: widget.isUser
  136. ? Container(
  137. margin: EdgeInsets.only(top: 10),
  138. height: 36,
  139. alignment: Alignment.center,
  140. child: RaisedButton(
  141. color: Color(0xff3875E9),
  142. shape: RoundedRectangleBorder(
  143. borderRadius:
  144. BorderRadius.all(Radius.circular(10))),
  145. child: Padding(
  146. padding: EdgeInsets.only(left: 10, right: 10),
  147. child: Text(
  148. I18n.of(context)
  149. .translation_butler_dialog_start_chat,
  150. textScaleFactor: 1.0,
  151. style: TextStyle(
  152. color: Colors.white,
  153. fontSize: 15,
  154. fontWeight: FontWeight.w500),
  155. ),
  156. ),
  157. onPressed: () {
  158. Navigator.of(context).pop();
  159. widget.userStartChat();
  160. }),
  161. )
  162. : CountDownButton(
  163. I18n.of(context)
  164. .translation_butler_dialog_start_service,
  165. () {
  166. ///倒计时结束自动关闭
  167. Navigator.of(context).pop();
  168. },
  169. onPress: () {
  170. ///发送确认接单
  171. MsgHandler.sendReceiveOrder();
  172. Navigator.of(context).pop();
  173. },
  174. ),
  175. )
  176. ],
  177. ),
  178. ),
  179. ),
  180. ),
  181. ),
  182. );
  183. }
  184. }