import 'dart:io'; import 'dart:typed_data'; import 'package:audioplayers/audioplayers.dart'; import 'package:demo001/gen/assets.gen.dart'; import 'package:demo001/generated/l10n.dart'; import 'package:demo001/main.dart'; import 'package:demo001/tools/color_utils.dart'; import 'package:demo001/tools/textStyle.dart'; import 'package:demo001/tools/widgets.dart'; import 'package:flutter/material.dart'; import 'package:gap/gap.dart'; import 'package:get/get.dart'; import 'package:logger/logger.dart'; import 'package:path_provider/path_provider.dart'; import 'home_logic.dart'; import 'home_state.dart'; /// @description: /// @author /// @date: 2025-01-07 15:51:34 class HomePage extends StatelessWidget { final HomeLogic logic = Get.put(HomeLogic()); final HomeState state = Get.find().state; double width = 0; double height = 0; @override Widget build(BuildContext context) { s = S.of(context); width = MediaQuery.of(context).size.width; height = MediaQuery.of(context).size.height; return Scaffold( backgroundColor: bgColor, body: SafeArea( child: Container( padding: EdgeInsets.all(10), alignment: Alignment.center, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( alignment: Alignment.center, child: Obx(() => Text( state.phoneNum.value, style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: white), )), ), const Gap(12), Center( child: Image.asset( 'assets/icon/home_img.png', width: width * 0.5, fit: BoxFit.fitWidth, ), ), const Gap(20), GestureDetector( onTap: logic.toBonding, child: Center( child: Container( height: 40, decoration: BoxDecoration( color: white, borderRadius: BorderRadius.circular(20), ), child: Row( mainAxisSize: MainAxisSize.min, children: [ const Gap(20), Container( width: 20, height: 20, alignment: Alignment.center, decoration: BoxDecoration( color: blue, borderRadius: BorderRadius.circular(4)), child: Icon( Icons.bluetooth, color: white, size: 15, ), ), Gap(5), Obx(() => Text( '请连接耳机', style: TextStyle(fontSize: 14, color: black), )), const Gap(20), ], ), ), ), ), const Gap(10), Text( '智能工具', style: TextStyle( fontSize: 18, fontWeight: FontWeight.bold, color: white), ), const Gap(10), GestureDetector( onTap: () { //Get.to(() => AiChatPage(loginModel: state.loginModel!)); }, child: Stack( children: [ Assets.icon.homeAiModel.image(fit: BoxFit.fitHeight), Positioned( left: 20, top: 120 * 0.5 - textSize('AI对话模式', Style.homeItemTextStyle).height * 0.5, child: Text( 'AI对话模式', style: Style.homeItemTextStyle, ), ) ], ), ), const Gap(10), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () { //Get.to(() => Tcty_chatPage()); }, child: Stack( children: [ Assets.icon.homeIconTcty.image( width: (width - 30) * 0.5, fit: BoxFit.fitWidth), Positioned( left: (width - 30) * 0.25 - textSize('同声传译', Style.homeItemTextStyle) .width * 0.5, top: (width - 30) * 0.5 - 50, child: Text( '同声传译', style: Style.homeItemTextStyle, ), ) ], ), ), GestureDetector( onTap: () async {}, child: Stack( children: [ Assets.icon.homeIconMdmfy.image( width: (width - 30) * 0.5, fit: BoxFit.fitWidth), Positioned( left: (width - 30) * 0.25 - textSize('面对面翻译', Style.homeItemTextStyle) .width * 0.5, top: (width - 30) * 0.5 - 50, child: Text( '面对面翻译', style: Style.homeItemTextStyle, ), ) ], ), ), ], ), const Gap(10), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () { // Get.to(() => PhonecallAudioTranslatePage()); // state.methodChannel // .invokeMethod('googleRealTimeSpeechToText'); }, child: Stack( children: [ Assets.icon.homeIconThyyfy.image( width: (width - 30) * 0.5, fit: BoxFit.fitWidth), Positioned( left: (width - 30) * 0.25 - textSize('通话语音翻译', Style.homeItemTextStyle) .width * 0.5, top: (width - 30) * 0.5 - 50, child: Text( '通话语音翻译', style: Style.homeItemTextStyle, ), ) ], ), ), GestureDetector( onTap: () { // Get.to(() => TransRecordsPage()); }, child: Stack( children: [ Assets.icon.homeIconFyjl.image( width: (width - 30) * 0.5, fit: BoxFit.fitWidth), Positioned( left: (width - 30) * 0.25 - textSize('翻译记录', Style.homeItemTextStyle) .width * 0.5, top: (width - 30) * 0.5 - 50, child: Text( '翻译记录', style: Style.homeItemTextStyle, ), ) ], ), ), ], ) ], ), ), ), ), ); } }