You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

193 lines
7.3 KiB

import 'package:cached_network_image/cached_network_image.dart';
import 'package:dating_touchme_app/controller/discover/room_controller.dart';
import 'package:dating_touchme_app/extension/ex_widget.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/pages/main/main_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
class LiveEndPage extends StatelessWidget {
final bool isKickedOut; // 是否是被踢出的
final String? operatorName; // 操作者名称(踢人者)
const LiveEndPage({
super.key,
this.isKickedOut = false,
this.operatorName,
});
@override
Widget build(BuildContext context) {
final roomController = Get.find<RoomController>();
final anchorInfo = roomController.rtcChannelDetail.value?.anchorInfo;
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
const Color.fromRGBO(19, 16, 47, 1),
const Color.fromRGBO(19, 16, 47, 1).withOpacity(0.8),
],
),
),
child: SafeArea(
child: Column(
children: [
// 顶部返回按钮
Padding(
padding: EdgeInsets.only(left: 16.w, top: 10.w),
child: Align(
alignment: Alignment.centerLeft,
child: IconButton(
icon: Icon(
Icons.arrow_back_ios,
color: Colors.white,
size: 20.w,
),
onPressed: () {
Get.back();
},
),
),
),
// 主要内容区域
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// 头像
Container(
width: 120.w,
height: 120.w,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.white.withOpacity(0.3),
width: 2.w,
),
),
child: ClipOval(
child: anchorInfo?.profilePhoto != null &&
anchorInfo!.profilePhoto.isNotEmpty
? CachedNetworkImage(
imageUrl:
"${anchorInfo.profilePhoto}?x-oss-process=image/format,webp/resize,w_240",
width: 120.w,
height: 120.w,
fit: BoxFit.cover,
placeholder: (context, url) => Container(
color: Colors.grey.withOpacity(0.3),
child: Center(
child: CircularProgressIndicator(
strokeWidth: 2.w,
color: Colors.white.withOpacity(0.5),
),
),
),
errorWidget: (context, url, error) =>
Image.asset(
Assets.imagesUserAvatar,
width: 120.w,
height: 120.w,
fit: BoxFit.cover,
),
)
: Image.asset(
Assets.imagesUserAvatar,
width: 120.w,
height: 120.w,
fit: BoxFit.cover,
),
),
),
SizedBox(height: 20.w),
// 用户名和关注按钮
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
anchorInfo?.nickName ?? '用户',
style: TextStyle(
fontSize: 18.w,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
],
),
SizedBox(height: 60.w),
// 状态消息(带横线)
Row(
children: [
SizedBox(width: 40.w,),
Expanded(
child: Container(
height: 1.w,
color: Colors.white.withOpacity(0.3),
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 16.w),
child: Text(
isKickedOut
? '您已被${operatorName ?? '主持人'}踢出直播间'
: '当前相亲已结束',
style: TextStyle(
fontSize: 14.w,
color: Colors.white,
),
),
),
Expanded(
child: Container(
height: 1.w,
color: Colors.white.withOpacity(0.3),
),
),
SizedBox(width: 40.w,),
],
),
],
),
),
// 底部返回首页按钮
Padding(
padding: EdgeInsets.only(
left: 20.w,
right: 20.w,
bottom: 40.w + MediaQuery.of(context).padding.bottom,
),
child: Container(
width: double.infinity,
height: 50.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25.w),
color: const Color.fromRGBO(108, 105, 244, 1),
),
child: Center(
child: Text(
'返回首页',
style: TextStyle(
fontSize: 16.w,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
),
).onTap(() {
Get.offAll(() => const MainPage());
}),
),
],
),
),
),
);
}
}