您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

236 行
8.8 KiB

  1. import 'dart:io';
  2. import 'dart:typed_data';
  3. import 'package:audioplayers/audioplayers.dart';
  4. import 'package:demo001/gen/assets.gen.dart';
  5. import 'package:demo001/generated/l10n.dart';
  6. import 'package:demo001/main.dart';
  7. import 'package:demo001/tools/color_utils.dart';
  8. import 'package:demo001/tools/textStyle.dart';
  9. import 'package:demo001/tools/widgets.dart';
  10. import 'package:flutter/material.dart';
  11. import 'package:gap/gap.dart';
  12. import 'package:get/get.dart';
  13. import 'package:logger/logger.dart';
  14. import 'package:path_provider/path_provider.dart';
  15. import 'home_logic.dart';
  16. import 'home_state.dart';
  17. /// @description:
  18. /// @author
  19. /// @date: 2025-01-07 15:51:34
  20. class HomePage extends StatelessWidget {
  21. final HomeLogic logic = Get.put(HomeLogic());
  22. final HomeState state = Get.find<HomeLogic>().state;
  23. double width = 0;
  24. double height = 0;
  25. @override
  26. Widget build(BuildContext context) {
  27. s = S.of(context);
  28. width = MediaQuery.of(context).size.width;
  29. height = MediaQuery.of(context).size.height;
  30. return Scaffold(
  31. backgroundColor: bgColor,
  32. body: SafeArea(
  33. child: Container(
  34. padding: EdgeInsets.all(10),
  35. alignment: Alignment.center,
  36. child: SingleChildScrollView(
  37. child: Column(
  38. crossAxisAlignment: CrossAxisAlignment.start,
  39. children: [
  40. Container(
  41. alignment: Alignment.center,
  42. child: Obx(() => Text(
  43. state.phoneNum.value,
  44. style: TextStyle(
  45. fontSize: 18,
  46. fontWeight: FontWeight.bold,
  47. color: white),
  48. )),
  49. ),
  50. const Gap(12),
  51. Center(
  52. child: Image.asset(
  53. 'assets/icon/home_img.png',
  54. width: width * 0.5,
  55. fit: BoxFit.fitWidth,
  56. ),
  57. ),
  58. const Gap(20),
  59. GestureDetector(
  60. onTap: logic.toBonding,
  61. child: Center(
  62. child: Container(
  63. height: 40,
  64. decoration: BoxDecoration(
  65. color: white,
  66. borderRadius: BorderRadius.circular(20),
  67. ),
  68. child: Row(
  69. mainAxisSize: MainAxisSize.min,
  70. children: [
  71. const Gap(20),
  72. Container(
  73. width: 20,
  74. height: 20,
  75. alignment: Alignment.center,
  76. decoration: BoxDecoration(
  77. color: blue,
  78. borderRadius: BorderRadius.circular(4)),
  79. child: Icon(
  80. Icons.bluetooth,
  81. color: white,
  82. size: 15,
  83. ),
  84. ),
  85. Gap(5),
  86. Obx(() => Text(
  87. '请连接耳机',
  88. style: TextStyle(fontSize: 14, color: black),
  89. )),
  90. const Gap(20),
  91. ],
  92. ),
  93. ),
  94. ),
  95. ),
  96. const Gap(10),
  97. Text(
  98. '智能工具',
  99. style: TextStyle(
  100. fontSize: 18, fontWeight: FontWeight.bold, color: white),
  101. ),
  102. const Gap(10),
  103. GestureDetector(
  104. onTap: () {
  105. //Get.to(() => AiChatPage(loginModel: state.loginModel!));
  106. },
  107. child: Stack(
  108. children: [
  109. Assets.icon.homeAiModel.image(fit: BoxFit.fitHeight),
  110. Positioned(
  111. left: 20,
  112. top: 120 * 0.5 -
  113. textSize('AI对话模式', Style.homeItemTextStyle).height *
  114. 0.5,
  115. child: Text(
  116. 'AI对话模式',
  117. style: Style.homeItemTextStyle,
  118. ),
  119. )
  120. ],
  121. ),
  122. ),
  123. const Gap(10),
  124. Row(
  125. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  126. children: [
  127. GestureDetector(
  128. onTap: () {
  129. //Get.to(() => Tcty_chatPage());
  130. },
  131. child: Stack(
  132. children: [
  133. Assets.icon.homeIconTcty.image(
  134. width: (width - 30) * 0.5, fit: BoxFit.fitWidth),
  135. Positioned(
  136. left: (width - 30) * 0.25 -
  137. textSize('同声传译', Style.homeItemTextStyle)
  138. .width *
  139. 0.5,
  140. top: (width - 30) * 0.5 - 50,
  141. child: Text(
  142. '同声传译',
  143. style: Style.homeItemTextStyle,
  144. ),
  145. )
  146. ],
  147. ),
  148. ),
  149. GestureDetector(
  150. onTap: () async {},
  151. child: Stack(
  152. children: [
  153. Assets.icon.homeIconMdmfy.image(
  154. width: (width - 30) * 0.5, fit: BoxFit.fitWidth),
  155. Positioned(
  156. left: (width - 30) * 0.25 -
  157. textSize('面对面翻译', Style.homeItemTextStyle)
  158. .width *
  159. 0.5,
  160. top: (width - 30) * 0.5 - 50,
  161. child: Text(
  162. '面对面翻译',
  163. style: Style.homeItemTextStyle,
  164. ),
  165. )
  166. ],
  167. ),
  168. ),
  169. ],
  170. ),
  171. const Gap(10),
  172. Row(
  173. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  174. children: [
  175. GestureDetector(
  176. onTap: () {
  177. // Get.to(() => PhonecallAudioTranslatePage());
  178. // state.methodChannel
  179. // .invokeMethod('googleRealTimeSpeechToText');
  180. },
  181. child: Stack(
  182. children: [
  183. Assets.icon.homeIconThyyfy.image(
  184. width: (width - 30) * 0.5, fit: BoxFit.fitWidth),
  185. Positioned(
  186. left: (width - 30) * 0.25 -
  187. textSize('通话语音翻译', Style.homeItemTextStyle)
  188. .width *
  189. 0.5,
  190. top: (width - 30) * 0.5 - 50,
  191. child: Text(
  192. '通话语音翻译',
  193. style: Style.homeItemTextStyle,
  194. ),
  195. )
  196. ],
  197. ),
  198. ),
  199. GestureDetector(
  200. onTap: () {
  201. // Get.to(() => TransRecordsPage());
  202. },
  203. child: Stack(
  204. children: [
  205. Assets.icon.homeIconFyjl.image(
  206. width: (width - 30) * 0.5, fit: BoxFit.fitWidth),
  207. Positioned(
  208. left: (width - 30) * 0.25 -
  209. textSize('翻译记录', Style.homeItemTextStyle)
  210. .width *
  211. 0.5,
  212. top: (width - 30) * 0.5 - 50,
  213. child: Text(
  214. '翻译记录',
  215. style: Style.homeItemTextStyle,
  216. ),
  217. )
  218. ],
  219. ),
  220. ),
  221. ],
  222. )
  223. ],
  224. ),
  225. ),
  226. ),
  227. ),
  228. );
  229. }
  230. }