Browse Source

feat(live): 根据用户角色控制礼物和加好友按钮显示

- 为主播角色隐藏礼物赠送按钮
- 为主播角色隐藏添加好友按钮
- 仅在非当前用户时显示互动按钮
- 优化直播间用户交互界面逻辑
ios
Jolie 3 months ago
parent
commit
1e82b28540
1 changed files with 99 additions and 95 deletions
  1. 194
      lib/widget/live/live_room_anchor_showcase.dart

194
lib/widget/live/live_room_anchor_showcase.dart

@ -59,63 +59,65 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> {
), ),
), ),
), ),
Positioned(
top: 5.w,
right: 5.w,
child: Container(
width: 20.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.w)),
color: const Color.fromRGBO(0, 0, 0, .3),
),
child: Center(
child:
Image.asset(
Assets.imagesGiftIcon,
width: 19.w,
height: 19.w,
).onTap(() {
final anchorInfo = _roomController
.rtcChannelDetail
.value
?.anchorInfo;
if (anchorInfo != null) {
_showGiftPopupForUser(anchorInfo, 1);
}
}),
if(_roomController.currentRole != CurrentRole.broadcaster)
Positioned(
top: 5.w,
right: 5.w,
child: Container(
width: 20.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.w)),
color: const Color.fromRGBO(0, 0, 0, .3),
),
child: Center(
child:
Image.asset(
Assets.imagesGiftIcon,
width: 19.w,
height: 19.w,
).onTap(() {
final anchorInfo = _roomController
.rtcChannelDetail
.value
?.anchorInfo;
if (anchorInfo != null) {
_showGiftPopupForUser(anchorInfo, 1);
}
}),
),
), ),
), ),
),
Positioned(
bottom: 5.w,
right: 5.w,
child: Container(
width: 47.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.w)),
color: Colors.white,
),
child: Center(
child: Text(
"加好友",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(117, 98, 249, 1),
if(_roomController.currentRole != CurrentRole.broadcaster)
Positioned(
bottom: 5.w,
right: 5.w,
child: Container(
width: 47.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(20.w)),
color: Colors.white,
),
child: Center(
child: Text(
"加好友",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(117, 98, 249, 1),
),
), ),
), ),
),
).onTap((){
final anchorInfo = _roomController
.rtcChannelDetail
.value
?.anchorInfo;
if (anchorInfo != null) {
_showGiftPopupForUser(anchorInfo, 2);
}
}),
),
).onTap((){
final anchorInfo = _roomController
.rtcChannelDetail
.value
?.anchorInfo;
if (anchorInfo != null) {
_showGiftPopupForUser(anchorInfo, 2);
}
}),
),
], ],
), ),
SizedBox(height: 5.w), SizedBox(height: 5.w),
@ -241,54 +243,56 @@ class _LiveRoomAnchorShowcaseState extends State<LiveRoomAnchorShowcase> {
), ),
), ),
), ),
Positioned(
top: 5.w,
right: 5.w,
child: Container(
width: 20.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.w),
if(!isCurrentUser)
Positioned(
top: 5.w,
right: 5.w,
child: Container(
width: 20.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.w),
),
),
child: Center(
child:
Image.asset(
Assets.imagesGiftIcon,
width: 19.w,
height: 19.w,
).onTap(() {
_showGiftPopupForUser(userInfo, 1);
}),
), ),
),
child: Center(
child:
Image.asset(
Assets.imagesGiftIcon,
width: 19.w,
height: 19.w,
).onTap(() {
_showGiftPopupForUser(userInfo, 1);
}),
), ),
), ),
),
Positioned(
bottom: 5.w,
right: 5.w,
child: Container(
width: 47.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.w),
if(!isCurrentUser)
Positioned(
bottom: 5.w,
right: 5.w,
child: Container(
width: 47.w,
height: 20.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(20.w),
),
color: Colors.white,
), ),
color: Colors.white,
),
child: Center(
child: Text(
"加好友",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(117, 98, 249, 1),
child: Center(
child: Text(
"加好友",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(117, 98, 249, 1),
),
), ),
), ),
),
).onTap((){
_showGiftPopupForUser(userInfo, 2);
}),
),
).onTap((){
_showGiftPopupForUser(userInfo, 2);
}),
),
Positioned( Positioned(
left: 5.w, left: 5.w,
bottom: 5.w, bottom: 5.w,

Loading…
Cancel
Save