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

206 行
6.6 KiB

  1. import 'package:chat/data/UserData.dart';
  2. import 'package:chat/home/realtimehelper/translation_butler_page.dart';
  3. import 'package:chat/home/realtimehelper/travel_butler_page.dart';
  4. import 'package:chat/models/group_info_model.dart';
  5. import 'package:chat/utils/HttpUtil.dart';
  6. import 'package:chat/utils/screen.dart';
  7. import 'package:flutter/cupertino.dart';
  8. import 'package:flutter/material.dart';
  9. import 'package:oktoast/oktoast.dart';
  10. import '../../data/constants.dart';
  11. import '../../generated/i18n.dart';
  12. import '../../r.dart';
  13. class RealTimeHelperPage extends StatefulWidget {
  14. final GroupInfoModel groupInfoModel;
  15. RealTimeHelperPage({Key key, this.groupInfoModel}) : super(key: key);
  16. @override
  17. State<StatefulWidget> createState() {
  18. return RealTimeHelperPageState();
  19. }
  20. }
  21. class RealTimeHelperPageState extends State<RealTimeHelperPage> {
  22. bool isTranslateHKLogin = true;
  23. @override
  24. void initState() {
  25. super.initState();
  26. }
  27. @override
  28. void dispose() {
  29. // MessageMgr().off('Update Group Info', updateGroupInfo);
  30. super.dispose();
  31. }
  32. @override
  33. Widget build(BuildContext context) {
  34. Widget appBar = AppBar(
  35. backgroundColor: Colors.white,
  36. title: Text(
  37. I18n.of(context).real_time_helper,
  38. textScaleFactor: 1.0,
  39. style: TextStyle(color: AppColors.NewAppbarTextColor),
  40. ),
  41. // leading: CustomUI.buildCustomLeading(context),
  42. centerTitle: false,
  43. );
  44. return UserData().isTranslateUser?Scaffold(
  45. // appBar: appBar,
  46. body: Container(
  47. color: Color(0xffE8EAF0),
  48. child: Stack(
  49. children: <Widget>[
  50. Container(
  51. child: Image.asset(
  52. R.assetsImagesImgRealtimeBg2,
  53. width: MediaQuery.of(context).size.width,
  54. height:250,
  55. fit: BoxFit.cover,
  56. ),
  57. ),
  58. Container(
  59. child: Image.asset(
  60. R.assetsImagesImgRealtimeBg1,
  61. width: MediaQuery.of(context).size.width,
  62. height:MediaQuery.of(context).padding.top+80,
  63. fit: BoxFit.cover,
  64. ),
  65. ),
  66. Container(
  67. child: SafeArea(
  68. child: ListView(
  69. children: <Widget>[
  70. Container(
  71. alignment: Alignment.center,
  72. child: fixedText('大神专属', color: Colors.white, fontSize: 21),
  73. ),
  74. UnconstrainedBox(child: InkWell(onTap: (){
  75. HttpUtil().translateHKloginRecord(!isTranslateHKLogin,(){
  76. isTranslateHKLogin = !isTranslateHKLogin;
  77. setState(() {
  78. });
  79. });
  80. },child: Container(
  81. alignment: Alignment.center,
  82. padding: EdgeInsets.only(left: 11,right: 11,top: 3,bottom: 3),
  83. decoration: BoxDecoration(
  84. border: Border.all(color: isTranslateHKLogin?Color(0xFFFEE645):Colors.white, width: 1),
  85. borderRadius: BorderRadius.circular(11)),
  86. child: fixedText(isTranslateHKLogin?'开启接单':'未开启接单', color: isTranslateHKLogin?Color(0xFFFEE645):Colors.white, fontSize: 15),
  87. ),),),
  88. Container(
  89. padding: EdgeInsets.only(left: 13,top: 20),
  90. child: fixedText('实时帮', color: Colors.white, fontSize: 22,fontWeight: FontWeight.w700),
  91. ),
  92. helperCard(I18n.of(context).translation_butler,
  93. R.assetsImagesImgTranslationButler, () {
  94. if (UserData().isTranslateUser) {
  95. showToast('翻译人员无法进入创建订单');
  96. } else {
  97. Navigator.of(context).push(
  98. MaterialPageRoute(
  99. builder: (_) => TranslationButlerPage(),
  100. ),
  101. );
  102. }
  103. }, textColor: Color(0xff2685FA)),
  104. helperCard(I18n.of(context).travel_butler,
  105. R.assetsImagesImgTravelButler, () {
  106. Navigator.of(context).push(
  107. MaterialPageRoute(
  108. builder: (_) => TravelButlerPage(),
  109. ),
  110. );
  111. }, textColor: Color(0xffff682d)),
  112. SizedBox(
  113. height: 15,
  114. ),
  115. ],
  116. )),
  117. )
  118. ],
  119. ),
  120. ),
  121. ):Scaffold(
  122. appBar: appBar,
  123. body: SafeArea(
  124. child: Container(
  125. color: Color(0xffE8EAF0),
  126. child: ListView(
  127. children: <Widget>[
  128. helperCard(I18n.of(context).translation_butler,
  129. R.assetsImagesImgTranslationButler, () {
  130. Navigator.of(context).push(
  131. MaterialPageRoute(
  132. builder: (_) => TranslationButlerPage(),
  133. ),
  134. );
  135. },textColor: Color(0xff2685FA)),
  136. helperCard(
  137. I18n.of(context).travel_butler, R.assetsImagesImgTravelButler,
  138. () {
  139. Navigator.of(context).push(
  140. MaterialPageRoute(
  141. builder: (_) => TravelButlerPage(),
  142. ),
  143. );
  144. },textColor: Color(0xffff682d)),
  145. SizedBox(
  146. height: 15,
  147. ),
  148. ],
  149. ),
  150. ),
  151. ),
  152. );
  153. }
  154. Widget helperCard(String title, String assets, Function callBack,
  155. {Color textColor}) {
  156. return InkWell(
  157. child: Container(
  158. margin: EdgeInsets.all(10),
  159. child: Card(
  160. elevation: 2, // 阴影
  161. shape: RoundedRectangleBorder(
  162. borderRadius: BorderRadius.circular(10),
  163. // side: BorderSide(color: Colors.green,width: 25),
  164. ),
  165. child: Container(
  166. padding: EdgeInsets.all(10),
  167. child: Column(
  168. children: <Widget>[
  169. Image.asset(
  170. assets,
  171. ),
  172. Padding(
  173. padding: EdgeInsets.only(top: 15, bottom: 15),
  174. child: Text(
  175. title + ' >>',
  176. textScaleFactor: 1.0,
  177. style: TextStyle(color: textColor, fontSize: 20),
  178. ),
  179. )
  180. ],
  181. ),
  182. ),
  183. ),
  184. ),
  185. onTap: callBack,
  186. );
  187. }
  188. }