273 lines
11 KiB
Dart
273 lines
11 KiB
Dart
import 'dart:ui' as ui;
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:marquee/marquee.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:aslan/chatvibe_ui/components/at_compontent.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_core/utilities/at_lk_dialog_util.dart';
|
|
import 'package:aslan/chatvibe_data/sources/local/user_manager.dart';
|
|
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
|
|
import 'package:aslan/chatvibe_features/room/detail/room_detail_page.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/room/exit_min_room_page.dart';
|
|
import '../../../chatvibe_features/room/rank/room_gift_rank_page.dart';
|
|
import '../../../chatvibe_managers/room_manager.dart';
|
|
|
|
class RoomHeadWidget extends StatefulWidget {
|
|
@override
|
|
_RoomHeadWidgetState createState() => _RoomHeadWidgetState();
|
|
}
|
|
|
|
class _RoomHeadWidgetState extends State<RoomHeadWidget> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<RtcProvider>(
|
|
builder: (context, provider, child) {
|
|
return Row(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
GestureDetector(
|
|
onTap: () {
|
|
showBottomInBottomDialog(
|
|
context!,
|
|
RoomDetailPage(provider.isFz()),
|
|
);
|
|
},
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(
|
|
vertical: 6.w,
|
|
horizontal: 12.w,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
netImage(
|
|
url:
|
|
provider
|
|
.currenRoom
|
|
?.roomProfile
|
|
?.roomProfile
|
|
?.roomCover ??
|
|
"",
|
|
width: 28.w,
|
|
height: 28.w,
|
|
borderRadius: BorderRadius.all(
|
|
Radius.circular(8.w),
|
|
),
|
|
),
|
|
Selector<RtcProvider, bool>(
|
|
selector: (c, p) => p.roomIsMute,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (_, isMute, __) {
|
|
return isMute
|
|
? ClipOval(
|
|
child: Container(
|
|
color: Colors.black54,
|
|
padding: EdgeInsets.all(5.w),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_mic_mute.png",
|
|
height: 14.w,
|
|
width: 14.w,
|
|
),
|
|
),
|
|
)
|
|
: Container();
|
|
},
|
|
),
|
|
],
|
|
),
|
|
SizedBox(width: 6.w),
|
|
Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
SizedBox(width: 10.w),
|
|
Container(
|
|
constraints: BoxConstraints(
|
|
maxWidth: 106.w,
|
|
maxHeight: 17.w,
|
|
),
|
|
child:
|
|
(provider
|
|
.currenRoom
|
|
?.roomProfile
|
|
?.roomProfile
|
|
?.roomName
|
|
?.length ??
|
|
0) >
|
|
10
|
|
? Marquee(
|
|
text:
|
|
provider
|
|
.currenRoom
|
|
?.roomProfile
|
|
?.roomProfile
|
|
?.roomName ??
|
|
"",
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffffffff),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
scrollAxis: Axis.horizontal,
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
blankSpace: 40.0,
|
|
velocity: 40.0,
|
|
pauseAfterRound: Duration(seconds: 1),
|
|
accelerationDuration: Duration(
|
|
seconds: 1,
|
|
),
|
|
accelerationCurve: Curves.easeOut,
|
|
decelerationDuration: Duration(
|
|
milliseconds: 500,
|
|
),
|
|
decelerationCurve: Curves.easeOut,
|
|
)
|
|
: Text(
|
|
provider
|
|
.currenRoom
|
|
?.roomProfile
|
|
?.roomProfile
|
|
?.roomName ??
|
|
'',
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 13.sp,
|
|
color: Color(0xffffffff),
|
|
fontWeight: FontWeight.w600,
|
|
decoration: TextDecoration.none,
|
|
),
|
|
),
|
|
),
|
|
|
|
text(
|
|
"ID:${provider.currenRoom?.roomProfile?.userProfile?.getID()}",
|
|
fontSize: 13.sp,
|
|
fontWeight: FontWeight.w600,
|
|
textColor: Colors.white70,
|
|
),
|
|
],
|
|
),
|
|
SizedBox(width: 6.w),
|
|
provider.currenRoom?.roomProfile?.roomProfile?.userId !=
|
|
AccountStorage()
|
|
.getCurrentUser()
|
|
?.userProfile
|
|
?.id
|
|
? Selector<RtcProvider, bool>(
|
|
selector:
|
|
(c, p) =>
|
|
p.isFollowRoomRes?.followRoom ?? false,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (_, follow, __) {
|
|
return !follow
|
|
? GestureDetector(
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_follow_no.png",
|
|
width: 26.w,
|
|
height: 26.w,
|
|
),
|
|
onTap: () {
|
|
provider.followRoom();
|
|
},
|
|
)
|
|
: Container();
|
|
},
|
|
)
|
|
: Container(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Spacer(),
|
|
_buildExperience(),
|
|
SizedBox(width: 5.w),
|
|
GestureDetector(
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_ext_min.png",
|
|
width: 32.w,
|
|
height: 32.w,
|
|
),
|
|
onTap: () {
|
|
showCenterDialog(
|
|
context,
|
|
ExitMinRoomPage(
|
|
provider.isFz(),
|
|
provider.currenRoom?.roomProfile?.roomProfile?.id ?? "",
|
|
),
|
|
barrierColor: Colors.black54,
|
|
);
|
|
// provider.extRoom();
|
|
},
|
|
),
|
|
SizedBox(width: 12.w),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
///房间榜单入口
|
|
_buildExperience() {
|
|
return Consumer<ChatVibeRoomManager>(
|
|
builder: (context, ref, child) {
|
|
return GestureDetector(
|
|
child: Container(
|
|
width: 90.w,
|
|
height: 27.w,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white10,
|
|
borderRadius: BorderRadius.circular(35.w),
|
|
),
|
|
alignment: AlignmentDirectional.center,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Image.asset(
|
|
"atu_images/room/at_icon_room_contribute.png",
|
|
width: 18.w,
|
|
height: 18.w,
|
|
),
|
|
SizedBox(width: 5.w),
|
|
text(
|
|
"${ref.roomContributeLevelRes?.thisWeekIntegral ?? 0}",
|
|
fontSize: 13.sp,
|
|
textColor: Colors.orangeAccent,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
Icon(
|
|
Icons.chevron_right,
|
|
size: 13.w,
|
|
color: Colors.orangeAccent,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag: "showRoomGiftRankPage",
|
|
alignment: Alignment.bottomCenter,
|
|
animationType: SmartAnimationType.fade,
|
|
builder: (_) {
|
|
return RoomGiftRankPage();
|
|
},
|
|
);
|
|
},
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|