WGShare.Mobile.Flutter/wgshare/lib/pages/metting/meeting_main_view.dart

1250 lines
48 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:wgshare/common/store/user_store.dart';
import 'package:wgshare/pages/metting/share/meeting_main_share_view.dart';
import 'package:wgshare/pages/metting/video/meeting_main_video_view.dart';
import 'package:wgshare/utils/toast_utils.dart';
import '../../utils/color_util.dart';
import '../../utils/cus_behavior.dart';
import 'meeting_main_logic.dart';
import 'meeting_main_state.dart';
import 'voice/meeting_main_voice_view.dart';
class MeetingMainPage extends StatelessWidget {
MeetingMainPage({Key? key}) : super(key: key);
final MeetingMainLogic logic = Get.put(MeetingMainLogic());
final MeetingMainState state = Get.find<MeetingMainLogic>().state;
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
surfaceTintColor: ColorUtil.Color_41_41_41,
elevation: 0,
toolbarHeight: 0,
systemOverlayStyle: const SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: ColorUtil.Color_41_41_41,
systemNavigationBarIconBrightness: Brightness.light,
statusBarIconBrightness: Brightness.light,
statusBarBrightness: Brightness.light,
),
backgroundColor: ColorUtil.Color_41_41_41,
),
body: Obx(() => Stack(
children: [
Column(
children: [
/// 顶部布局
Container(
width: double.infinity,
height: 100.h,
alignment: Alignment.center,
color: ColorUtil.Color_41_41_41,
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: 92.w,
child: Row(
children: [
Image.asset(
'assets/images/meeting_main_narrow.png',
width: 20.w,
height: 20.h,
),
SizedBox(width: 16.w),
GestureDetector(
child: Image.asset(
state.communicationMode.value == 1 ? 'assets/images/meeting_main_receiver.png' : 'assets/images/meeting_main_speaker.png',
width: 20.w,
height: 20.h,
),
onTap: (){
if(state.communicationMode.value == 1 || state.communicationMode.value == 3){
logic.changeMeetingAudioState(true);
}
},
),
Row(
children: [
SizedBox(width: 16.w),
Image.asset(
'assets/images/meeting_main_rotate_camera.png',
width: 20.w,
height: 20.h,
)
],
)
],
),
),
GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
Text(
state.meetingRoomInfo.value?.roomName ?? '',
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
fontWeight: FontWeight.w500),
),
SizedBox(width: 4.w),
Image.asset(
'assets/images/meeting_main_down.png',
width: 16.w,
height: 16.h,
)
],
),
SizedBox(height: 4.h),
Text(
state.duration.value,
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
),
)
],
),
onTap: (){
logic.changeMeetingInfoState(true);
},
),
Container(
width: 92.w,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
/// 结束发言
Visibility(
visible: state.isSpeak.value,
child: GestureDetector(
child: Image.asset(
'assets/images/meeting_main_hang_up.png',
width: 22.w,
height: 22.h,
),
onTap: () {
logic.doHttpCancelSpeak();
},
),
),
SizedBox(width: 16.w),
/// 退出会议
GestureDetector(
child: Image.asset(
'assets/images/meeting_leave.png',
width: 20.w,
height: 20.h,
),
onTap: () {
Get.bottomSheet(
isScrollControlled: true,
leaveBottomSheet(context)
);
},
)
],
),
)
],
),
),
/// 中间布局
Expanded(
child: Stack(
alignment: Alignment.bottomLeft,
children: [
// 语音
Visibility(
visible: true,
child: MeetingMainVoiceComponent(users: state.cacheUsers.value)
),
// 视频
Visibility(
visible: false,
child: MeetingMainVideoComponent()
),
// 共享屏幕
Visibility(
visible: false,
child: MeetingMainShareComponent()
),
GestureDetector(
child: Container(
width: 180.w,
height: 40.h,
margin: const EdgeInsets.only(left: 20, bottom: 40),
padding: const EdgeInsets.only(left: 20),
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(56),
topRight: Radius.circular(50),
bottomRight: Radius.circular(50)),
color: ColorUtil.Color_35_35_35_07,
border: Border.all(
width: 1.w,
color: ColorUtil.Color_99_111_158
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset(
'assets/images/meeting_main_chat.png',
width: 18.w,
height: 18.h,
),
SizedBox(width: 6.w),
Text(
'说点什么...',
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_156_156_156),
)
],
),
),
onTap: () {
Get.bottomSheet(
isScrollControlled: true,
chatBottomSheet(context)
);
Future.delayed(const Duration(milliseconds: 100), () {
state.chatController.jumpTo(state.chatController.position.maxScrollExtent);
});
},
)
],
),
),
/// 底部布局
Container(
width: double.infinity,
height: 84.h,
color: ColorUtil.Color_35_35_35,
padding: const EdgeInsets.only(left: 26, right: 26),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
/// 音频
GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
state.isSpeak.value == false
? 'assets/images/meeting_main_sqfy.png'
: state.isOpenMicrophone.value == true
? 'assets/images/meeting_main_microphone_default.png'
: 'assets/images/meeting_main_sqfy.png',
width: 22.w,
height: 22.h,
),
SizedBox(height: 4.h),
Text(
state.isSpeak.value == false ? '申请发言' : state.isOpenMicrophone.value == true ? "手动静音" : "解除静音",
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
),
onTap: () {
if(state.isSpeak.value == false){
Get.bottomSheet(
isScrollControlled: true,
applySpeakPermissionBottomSheet(
context)
);
}else{
if(state.isOpenMicrophone.value == false){
logic.setMicrophoneOpen(true);
}else{
logic.setMicrophoneOpen(false);
}
}
},
),
/// 视频
GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/meeting_main_sp.png',
width: 22.w,
height: 22.h,
),
SizedBox(height: 4.h),
Text(
'开启视频',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
),
onTap: (){
ToastUtils.getErrFluttertoast(context: context, msg: '开启视频...');
},
),
/// 共享
GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/meeting_main_share_default.png',
width: 22.w,
height: 22.h,
),
SizedBox(height: 4.h),
Text(
'共享屏幕',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
),
onTap: (){
ToastUtils.getErrFluttertoast(context: context, msg: '开启共享...');
},
),
/// 成员
GestureDetector(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/meeting_main_member_default.png',
width: 22.w,
height: 22.h,
),
SizedBox(height: 4.h),
Text(
' 成员 ',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
),
onTap: () {
Get.bottomSheet(
isScrollControlled: true,
queryMemberFloatingLayer(context),
);
},
),
],
),
)
],
),
meetingInfoFloatingLayer(),
meetingAudioFloatingLayer(),
],
)));
}
@override
void dispose() {
Get.delete<MeetingMainLogic>();
}
/// 退出会议底部弹窗
Widget leaveBottomSheet(BuildContext context) {
return Container(
height: 170.h,
color: ColorUtil.Color_7_9_11,
padding: const EdgeInsets.only(top: 24, bottom: 24, left: 16, right: 16),
child: Column(
children: [
GestureDetector(
child: Container(
height: 52.h,
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
color: ColorUtil.Color_49_53_58,
),
alignment: Alignment.center,
child: Text(
'仅自己离开',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
),
),
),
onTap: (){
Get.back();
Get.back();
},
),
GestureDetector(
child: Container(
height: 52.h,
margin: const EdgeInsets.only(top: 16),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
color: ColorUtil.Color_16_20_24,
),
alignment: Alignment.center,
child: Text(
'取消',
style: TextStyle(
fontSize: 16.sp,
color: Colors.white,
),
),
),
onTap: (){
Get.back();
},
)
],
),
);
}
/// 会议信息浮层
Widget meetingInfoFloatingLayer() {
return Visibility(
visible: state.isShowMeetingInfoFloatingLayer.value,
child: Column(
children: [
Container(
height: 100.h,
color: ColorUtil.Color_0_0_0_0,
),
Container(
color: ColorUtil.Color_35_35_35,
padding: const EdgeInsets.only(top: 16, bottom: 6),
child: Column(
children: [
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
margin: const EdgeInsets.only(bottom: 12),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
state.meetingRoomInfo.value?.roomName ?? '',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_85_117_242),
),
Row(
children: [
Image.asset(
'assets/images/meeting_main_network_normal.png',
width: 14.w,
height: 14.h,
),
SizedBox(width: 12.w),
Text(
'网络链接正常',
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202),
)
],
)
],
),
),
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'会议号',
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_134_134_134),
),
Row(
children: [
Text(
state.roomNumber.value,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202,
fontWeight: FontWeight.w500),
),
SizedBox(width: 12.w),
Image.asset(
'assets/images/meeting_main_copy.png',
width: 18.w,
height: 18.h,
)
],
)
],
),
),
Container(
width: double.infinity,
height: 1.h,
color: ColorUtil.Color_49_47_47,
margin: const EdgeInsets.only(top: 14, bottom: 14),
),
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'我的名称',
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_134_134_134),
),
Text(
UserStore.to.userInfoEntity.value!.userName,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202,
fontWeight: FontWeight.w500),
)
],
),
),
Container(
width: double.infinity,
height: 1.h,
color: ColorUtil.Color_49_47_47,
margin: const EdgeInsets.only(top: 14, bottom: 14),
),
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'参会时长',
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_134_134_134),
),
Text(
state.duration.value,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_202_202_202,
fontWeight: FontWeight.w500),
)
],
),
),
SizedBox(height: 10.h),
GestureDetector(
child: Container(
padding: const EdgeInsets.only(top:10, bottom: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'收回列表',
style: TextStyle(
fontSize: 10.sp,
color: ColorUtil.Color_202_202_202,
fontWeight: FontWeight.w500),
),
SizedBox(width: 4.w),
Image.asset(
'assets/images/meeting_main_info_close.png',
width: 12.w,
height: 10.h,
)
],
),
),
onTap: (){
logic.changeMeetingInfoState(false);
},
)
],
),
),
Expanded(
child: Container(
color: ColorUtil.Color_57_57_57_08,
))
],
),
);
}
/// 选择音频输出浮层
Widget meetingAudioFloatingLayer() {
return Visibility(
visible: state.isShowMeetingAudioFloatingLayer.value,
child: Column(
children: [
Expanded(
child: Container(
color: ColorUtil.Color_57_57_57_08,
)),
Container(
color: ColorUtil.Color_57_57_57_08,
child: Container(
width: double.infinity,
padding: const EdgeInsets.only(top: 16, bottom: 16),
margin: const EdgeInsets.only(left: 40, right: 40),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
border: Border.all(color: ColorUtil.Color_0_0_0_0),
color: ColorUtil.Color_35_35_35,
),
child: Column(
children: audioList(),
),
),
),
Expanded(
child: Container(
color: ColorUtil.Color_57_57_57_08,
))
],
),
);
}
/// 音频列表
List<Widget> audioList() {
List<Widget> audioList = [];
audioList.add(
GestureDetector(
child: Column(children: [
Text(
'听筒',
style: TextStyle(
fontSize: 14.sp,
fontWeight: state.communicationMode.value == 1 ? FontWeight.w500 : FontWeight.w400,
color: state.communicationMode.value == 1 ? ColorUtil.Color_85_117_242 : ColorUtil.Color_134_134_134
),
),
Container(
width: double.infinity,
height: 1.h,
color: ColorUtil.Color_49_47_47,
margin: const EdgeInsets.only(top: 14, bottom: 14),
)
]),
onTap: (){
logic.setEnableSpeakerphone(1);
logic.changeMeetingAudioState(false);
},
)
);
audioList.add(
GestureDetector(
child: Column(
children: [
Text(
'扬声器',
style: TextStyle(
fontSize: 14.sp,
fontWeight: state.communicationMode.value == 3 ? FontWeight.w500 : FontWeight.w400,
color: state.communicationMode.value == 3 ? ColorUtil.Color_85_117_242 : ColorUtil.Color_134_134_134
),
),
],
),
onTap: (){
logic.setEnableSpeakerphone(3);
logic.changeMeetingAudioState(false);
},
)
);
return audioList;
}
/// 申请发言权限底部弹窗
Widget applySpeakPermissionBottomSheet(BuildContext context) {
return Container(
height: 240.h,
color: ColorUtil.Color_7_9_11,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 12.w),
Container(
height: 50.h,
alignment: Alignment.center,
child: Text(
'提示',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_238_238_238),
),
),
GestureDetector(
child: Image.asset(
'assets/images/meeting_main_close_permission.png',
width: 12.w,
height: 12.h,
),
onTap: (){
Get.back();
},
)
],
),
),
Container(
width: double.infinity,
height: 1.h,
color: ColorUtil.Color_49_47_47,
),
Container(
margin: const EdgeInsets.only(top: 20, bottom: 80, left: 16),
child: Text(
'该操作需向管理人申请发言权限',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w600,
color: ColorUtil.Color_238_238_238),
),
),
Container(
margin: const EdgeInsets.only(bottom: 20, left: 16, right: 16),
child: Row(
children: [
Expanded(
child: GestureDetector(
child: Container(
height: 44.h,
margin: const EdgeInsets.only(right: 6),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: ColorUtil.Color_49_53_58,
),
alignment: Alignment.center,
child: Text(
'取消',
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_238_238_238,
),
),
),
onTap: (){
Get.back();
},
),
),
Expanded(
child: GestureDetector(
child: Container(
height: 44.h,
margin: const EdgeInsets.only(left: 6),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10)),
color: ColorUtil.Color_85_117_242,
),
alignment: Alignment.center,
child: Text(
'申请',
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_238_238_238,
),
),
),
onTap: (){
logic.doHttpApplySpeak();
Get.back();
},
),
)
],
),
)
],
),
);
}
/// 查看成员浮层
Widget queryMemberFloatingLayer(BuildContext context) {
return Container(
height: 520.h,
color: ColorUtil.Color_7_9_11,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 12.w),
Container(
height: 50.h,
alignment: Alignment.center,
child: Text(
'成员',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_238_238_238),
),
),
GestureDetector(
child: Image.asset(
'assets/images/meeting_main_close_permission.png',
width: 12.w,
height: 12.h,
),
onTap: (){
Get.back();
},
)
],
),
),
Container(
width: double.infinity,
height: 0.5.h,
color: ColorUtil.Color_49_47_47,
),
Container(
width: double.infinity,
height: 44.h,
margin: const EdgeInsets.only(top: 18, left: 16, right: 16),
padding: const EdgeInsets.only(left: 12, right: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(12)),
border: Border.all(
width: 1.w, color: ColorUtil.Color_70_71_73),
),
child: Row(
children: [
Image.asset(
'assets/images/meeting_main_query_member.png',
width: 24.w,
height: 24.h,
),
SizedBox(width: 8.w),
Expanded(
child: TextField(
controller: state.memberNameSearchController,
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_235_235_235
),
textInputAction: TextInputAction.search,
decoration: InputDecoration(
contentPadding: const EdgeInsets.all(0),
border: const OutlineInputBorder(borderSide: BorderSide.none),
hintText: '输入用户名',
hintStyle: TextStyle(
color: ColorUtil.Color_70_71_73,
fontSize: 14.sp)),
onSubmitted: (value){
logic.searchMember(value);
},
),
)
],
),
),
Container(
margin:
const EdgeInsets.only(top: 18, left: 16, right: 16, bottom: 16),
child: Text(
'会议中(${state.users.value.length}',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_85_117_242),
),
),
Expanded(
child: ScrollConfiguration(
behavior: CusBehavior(),
child: GetBuilder<MeetingMainLogic>(builder: (controll){
return ListView.builder(
itemBuilder: (context, index) {
return Container(
width: double.infinity,
margin: EdgeInsets.only(bottom: index == 9 ? 18 : 0),
child: Column(
children: [
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: ColorUtil.Color_85_117_242
),
margin: const EdgeInsets.only(right: 8),
width: 36.w,
height: 36.h,
alignment: Alignment.center,
child: Text(
state.users.value[index].userName.length > 3
? state.users.value[index].userName.substring(state.users.value[index].userName.length - 2,state.users.value[index].userName.length)
: state.users.value[index].userName,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_244_244_244
),
),
),
Text(
state.users.value[index].userName,
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w600,
color: ColorUtil.Color_243_243_243),
),
SizedBox(width: 8.w),
Visibility(
visible: state.users.value[index].roleId == "1" || state.users.value[index].roleId == "3" ? true : false,
child: Text(
'主持人',
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_2_177_136),
),
),
Visibility(
visible: state.users.value[index].roleId == "2" && state.users.value[index].isRoomManager == true ? true : false,
child: Text(
'发言人',
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_2_177_136),
),
)
],
),
Row(
children: [
Container(
child: Image.asset(
'assets/images/meeting_main_share_currently.png',
width: 17.w,
height: 17.h,
),
),
Container(
margin: const EdgeInsets.only(left: 12),
child: Image.asset(
state.users.value[index].enableMicr == true ? 'assets/images/meeting_main_microphone_default.png' : 'assets/images/meeting_main_microphone_close.png',
width: 17.w,
height: 17.h,
),
),
Container(
margin: const EdgeInsets.only(left: 12),
child: Image.asset(
state.users.value[index].enableCamera == true ? 'assets/images/meeting_main_camera_default.png' : 'assets/images/meeting_main_camera_close.png',
width: 17.w,
height: 17.h,
),
)
],
)
],
),
),
Container(
width: double.infinity,
height: 0.5.h,
margin: const EdgeInsets.only(top: 12, bottom: 12),
color: ColorUtil.Color_49_47_47,
)
],
),
);
},
itemCount: state.users.value.length,
);
})
),
)
],
),
);
}
/// 聊天底部弹窗
Widget chatBottomSheet(BuildContext context) {
return Container(
height: 500.h,
color: ColorUtil.Color_35_35_35,
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.only(left: 16, right: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(width: 12.w),
Container(
height: 50.h,
alignment: Alignment.center,
child: Text(
'聊天',
style: TextStyle(
fontSize: 14.sp,
fontWeight: FontWeight.w500,
color: ColorUtil.Color_238_238_238),
),
),
GestureDetector(
child: Image.asset(
'assets/images/meeting_main_close_permission.png',
width: 12.w,
height: 12.h,
),
onTap: (){
Get.back();
},
)
],
),
),
Container(
width: double.infinity,
height: 0.5.h,
color: ColorUtil.Color_49_47_47,
),
Expanded(
child: ScrollConfiguration(
behavior: CusBehavior(),
child: GetBuilder<MeetingMainLogic>(builder: (controll){
return ListView.builder(
controller: state.chatController,
itemBuilder: (context, index) {
return state.meetingRoomMsgs.value[index].source == 0 ? chartItemToOthers(index) : chartItemToOwn(index);
},
itemCount: state.meetingRoomMsgs.value.length,
);
})
),
),
Container(
width: double.infinity,
height: 60.h,
color: ColorUtil.Color_28_28_28,
padding: const EdgeInsets.all(6),
child: Container(
padding: const EdgeInsets.all(12),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(6)),
color: ColorUtil.Color_53_53_53,
),
child: TextField(
controller: state.sendMsgController,
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_235_235_235
),
decoration: InputDecoration(
contentPadding: const EdgeInsets.all(0),
border: const OutlineInputBorder(borderSide: BorderSide.none),
hintText: '请输入内容...',
hintStyle: TextStyle(
color: ColorUtil.Color_235_235_235,
fontSize: 14.sp)
),
onSubmitted: (value){
if(value.isNotEmpty){
logic.sendMsg(value);
state.sendMsgController.text = "";
}else{
ToastUtils.showError("请输入内容");
}
},
),
),
)
],
),
);
}
/// 聊天浮层-其他人消息
Widget chartItemToOthers(int index){
return Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 16, right: 16),
margin: EdgeInsets.only(top: 18, bottom: index == 3 ? 18 : 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(99),
color: ColorUtil.Color_85_117_242
),
width: 50.w,
height: 50.h,
alignment: Alignment.center,
child: Text(
state.meetingRoomMsgs.value[index].userName.length > 3
? state.meetingRoomMsgs.value[index].userName.substring(state.meetingRoomMsgs.value[index].userName.length - 2,state.meetingRoomMsgs.value[index].userName.length)
: state.meetingRoomMsgs.value[index].userName,
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_244_244_244
),
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
margin: const EdgeInsets.only(left: 6),
child: Text(
state.meetingRoomMsgs.value[index].userName,
style: TextStyle(
fontSize: 10.sp,
color: ColorUtil.Color_202_202_202),
),
),
Container(
margin: const EdgeInsets.only(
left: 6, top: 6, right: 16),
padding: const EdgeInsets.only(
left: 18, right: 18, top: 10, bottom: 10),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(99),
topRight: Radius.circular(99),
bottomRight: Radius.circular(99)),
color: ColorUtil.Color_53_53_53,
),
child: Text(
state.meetingRoomMsgs.value[index].message,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_235_235_235),
),
)
],
)
)
],
),
);
}
/// 聊天浮层-自己消息
Widget chartItemToOwn(int index){
return Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 16, right: 16),
margin: EdgeInsets.only(top: 18, bottom: index == 3 ? 18 : 6),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Container(
margin: const EdgeInsets.only(right: 6),
child: Text(
state.meetingRoomMsgs.value[index].userName,
style: TextStyle(
fontSize: 10.sp,
color: ColorUtil.Color_202_202_202),
),
),
Container(
margin: const EdgeInsets.only(
left: 16, top: 6, right: 6),
padding: const EdgeInsets.only(
left: 18, right: 18, top: 10, bottom: 10),
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(99),
bottomLeft: Radius.circular(99),
bottomRight: Radius.circular(99)
),
color: ColorUtil.Color_85_117_242,
),
child: Text(
state.meetingRoomMsgs.value[index].message,
style: TextStyle(
fontSize: 12.sp,
color: ColorUtil.Color_235_235_235),
),
)
],
)
),
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(99),
color: ColorUtil.Color_85_117_242
),
width: 50.w,
height: 50.h,
alignment: Alignment.center,
child: Text(
state.meetingRoomMsgs.value[index].userName.length > 3
? state.meetingRoomMsgs.value[index].userName.substring(state.meetingRoomMsgs.value[index].userName.length - 2,state.meetingRoomMsgs.value[index].userName.length)
: state.meetingRoomMsgs.value[index].userName,
style: TextStyle(
fontSize: 14.sp,
color: ColorUtil.Color_244_244_244
),
),
)
],
),
);
}
}