import 'package:agora_rtc_engine/agora_rtc_engine.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

import '../../../utils/color_util.dart';
import 'meeting_main_share_logic.dart';
import 'meeting_main_share_state.dart';

class MeetingMainShareComponent extends StatelessWidget {
  MeetingMainShareComponent({super.key, required this.rtcEngine, required this.channelId, required this.remoteUid});

  final RtcEngine rtcEngine;
  final String channelId;
  final String remoteUid;

  final MeetingMainShareLogic logic = Get.put(MeetingMainShareLogic());
  final MeetingMainShareState state = Get.find<MeetingMainShareLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Stack(
        alignment: Alignment.center,
        children: [
          AgoraVideoView(
            controller: VideoViewController.remote(
              rtcEngine: rtcEngine,
              canvas: VideoCanvas(uid: int.tryParse(remoteUid)),
              connection: RtcConnection(channelId: channelId),
            ),
          ),
          Positioned(
            bottom: 110,
            child: Image.asset(
              'assets/images/meeting_main_hang_up.png',
              width: 50.w,
              height: 50.h,
            ),
          ),
          Positioned(
            top: 16,
            right: 16,
            child: Container(
              height: 30,
              decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(8),
                  color: ColorUtil.Color_0_0_0_96),
              padding: const EdgeInsets.only(left: 12, right: 12),
              child: Row(
                children: [
                  Text(
                    '正在讲话：',
                    style: TextStyle(
                        fontSize: 10.sp,
                        color: ColorUtil.Color_185_184_184),
                  ),
                  Image.asset(
                    'assets/images/meeting_main_speak2.png',
                    width: 20.w,
                    height: 20.h,
                  ),
                  Text(
                    '晓晓',
                    style: TextStyle(
                        fontSize: 10.sp,
                        color: ColorUtil.Color_185_184_184),
                  )
                ],
              ),
            ),
          ),
          Positioned(
            top: 58,
            right: 13,
            child: Stack(
              children: [
                Container(
                    width: 120.w,
                    height: 150.h,
                    padding: const EdgeInsets.only(left: 12, right: 12),
                    decoration: BoxDecoration(
                      image: DecorationImage(
                        fit: BoxFit.fill,
                        image: NetworkImage(
                          "https://tse1-mm.cn.bing.net/th/id/OIP-C.hdhK40Dw3yN_2mjNQNqFCgAAAA?w=186&h=186&c=7&r=0&o=5&pid=1.7",
                        ),
                      ),
                    )
                ),
                Positioned(
                  left: 4,
                  bottom: 4,
                  child: Row(
                    children: [
                      Image.asset(
                        'assets/images/meeting_main_own.png',
                        width: 20.w,
                        height: 15.h,
                      ),
                      Container(
                        height: 15,
                        margin: const EdgeInsets.only(left: 4),
                        padding: const EdgeInsets.only(left: 4, right: 4),
                        decoration: BoxDecoration(
                            borderRadius: BorderRadius.circular(2),
                            color: ColorUtil.Color_0_0_0_96),
                        child: Row(
                          children: [
                            Image.asset(
                              'assets/images/meeting_main_microphone_open.png',
                              width: 13.w,
                              height: 14.h,
                            ),
                            SizedBox(width: 4.w),
                            Text(
                              '晓晓的屏幕',
                              style: TextStyle(
                                  fontSize: 10.sp,
                                  color: ColorUtil.Color_185_184_184),
                            )
                          ],
                        ),
                      )
                    ],
                  ),
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}
