import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:lottie/lottie.dart'; import '../../../core/theme/app_colors.dart'; import '../controllers/meeting_controller.dart'; class MeetingView extends GetView { const MeetingView({super.key}); @override Widget build(BuildContext context) { final isDarkMode = Theme.of(context).brightness == Brightness.dark; return Scaffold( backgroundColor: isDarkMode ? Colors.black : Colors.grey[50], appBar: _buildAppBar(isDarkMode), body: _buildBody(isDarkMode), ); } // 构建应用栏 PreferredSizeWidget _buildAppBar(bool isDarkMode) { return AppBar( backgroundColor: isDarkMode ? Colors.black : Colors.white, elevation: 0.5, leading: IconButton( icon: Icon( Icons.arrow_back_ios, color: isDarkMode ? Colors.white : Colors.black, size: 20.sp, ), onPressed: () => Get.back(), ), title: Padding( padding: const EdgeInsets.only(right: 56), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.keyboard_voice, color: isDarkMode ? Colors.white : Colors.black, ), 5.horizontalSpace, Text( '00:00:00', style: TextStyle( fontSize: 17.sp, fontWeight: FontWeight.w600, color: isDarkMode ? Colors.white : Colors.black, ), ), ], ), ), centerTitle: true, ); } // 构建主体内容 Widget _buildBody(bool isDarkMode) { return Padding( padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 10.w), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Expanded( child: Text( '2025-03-03 录音', style: TextStyle( color: isDarkMode ? Colors.white : Colors.black87, fontSize: 17.sp, ), ), ), 10.horizontalSpace, Text( '中文', style: TextStyle( color: isDarkMode ? Colors.white : Colors.black87, fontSize: 15.sp, ), ), ], ), Padding( padding: EdgeInsets.symmetric(vertical: 5.w), child: Text( '2025-03-03 16:18', style: TextStyle( color: isDarkMode ? Colors.grey[400] : Colors.grey[500], fontSize: 14.sp, ), ), ), _audioWave(isDarkMode), _recordContent(isDarkMode), _bottomButton(isDarkMode), ], ), ); } // 音波 Widget _audioWave(bool isDarkMode) { return Container( width: double.infinity, height: 70.w, margin: EdgeInsets.symmetric(vertical: 5.w), decoration: BoxDecoration( color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( color: isDarkMode ? Colors.black.withOpacity(0.2) : Colors.black.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 2), ), ], ), child: Row( children: [ Expanded( child: Lottie.asset( 'assets/lottie/audio_wave.json', controller: controller.lottieController, fit: BoxFit.fill, onLoaded: (composition) { controller.lottieController.duration = composition.duration; }, ), ), Expanded( child: Lottie.asset( 'assets/lottie/audio_wave.json', controller: controller.lottieController, fit: BoxFit.fill, ), ), Expanded( child: Lottie.asset( 'assets/lottie/audio_wave.json', controller: controller.lottieController, fit: BoxFit.fill, ), ), ], ), ); } // 记录内容 Widget _recordContent(bool isDarkMode) { return Expanded( child: Container( width: double.infinity, padding: EdgeInsets.all(10.w), margin: EdgeInsets.symmetric(vertical: 5.w), decoration: BoxDecoration( color: isDarkMode ? Colors.white.withOpacity(0.05) : Colors.white, borderRadius: BorderRadius.circular(12.w), boxShadow: [ BoxShadow( color: isDarkMode ? Colors.black.withOpacity(0.2) : Colors.black.withOpacity(0.05), blurRadius: 10, offset: const Offset(0, 2), ), ], ), ), ); } // 底部按钮 Widget _bottomButton(bool isDarkMode) { return Padding( padding: EdgeInsets.only(top: 40.w, bottom: 30.w), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ GestureDetector( onTap: () {}, child: Container( width: 130.w, height: 60.w, decoration: BoxDecoration( borderRadius: BorderRadius.circular(60.w), border: Border.all( color: isDarkMode ? AppColors.primary : Colors.blue, width: 2.w, ), ), child: Icon( Icons.pause, color: isDarkMode ? AppColors.primary : Colors.blue, size: 40.w, ), ), ), GestureDetector( onTap: () {}, child: Container( width: 130.w, height: 60.w, decoration: BoxDecoration( color: isDarkMode ? AppColors.primary : Colors.blue, borderRadius: BorderRadius.circular(60.w), ), child: Icon( Icons.fiber_manual_record_outlined, color: Colors.white, size: 40.w, ), ), ), ], ), ); } }