266 lines
14 KiB
Dart
266 lines
14 KiB
Dart
import 'package:aslan/chatvibe_ui/widgets/room/redpack/room_redenvelope_list_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/room/room_banner_view.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/room/room_task_page.dart';
|
|
import 'package:aslan/chatvibe_ui/widgets/room/rocket/room_rocket_yellow_page.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:aslan/chatvibe_ui/components/at_debounce_widget.dart';
|
|
import 'package:aslan/chatvibe_ui/components/text/at_text.dart';
|
|
import 'package:aslan/chatvibe_core/routes/at_fluro_navigator.dart';
|
|
import 'package:aslan/chatvibe_managers/rtc_manager.dart';
|
|
import '../../../chatvibe_features/index/main_route.dart';
|
|
import '../../../chatvibe_features/room/music/control/at_room_music_control_page.dart';
|
|
import '../../../chatvibe_managers/audio_manager.dart';
|
|
import '../../../chatvibe_managers/rtm_manager.dart';
|
|
|
|
class RoomPlayWidget extends StatefulWidget {
|
|
const RoomPlayWidget({super.key});
|
|
|
|
@override
|
|
State<RoomPlayWidget> createState() => _RoomPlayWidgetState();
|
|
}
|
|
|
|
class _RoomPlayWidgetState extends State<RoomPlayWidget> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Consumer<RtcProvider>(
|
|
builder: (context, ref, child) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
Expanded(
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
children: [
|
|
Container(
|
|
alignment: Alignment.bottomCenter,
|
|
child: SingleChildScrollView(
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Selector<AudioManager, bool>(
|
|
selector:
|
|
(_, provider) =>
|
|
provider.currentMusicMode != null,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (context, hasMusicMode, _) {
|
|
return RepaintBoundary(
|
|
child:
|
|
hasMusicMode
|
|
? GestureDetector(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 5.w,
|
|
),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_music_tag.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
),
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag: "showRoomMusicControl",
|
|
alignment: Alignment.center,
|
|
debounce: true,
|
|
animationType:
|
|
SmartAnimationType.fade,
|
|
clickMaskDismiss: true,
|
|
builder: (_) {
|
|
return ATRoomMusicControlPage();
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: Container(),
|
|
);
|
|
},
|
|
),
|
|
GestureDetector(
|
|
child: Selector<RtcProvider, num>(
|
|
selector: (_, p) => p.roomTaskClaimableCount,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (context, claimableCount, _) {
|
|
return RepaintBoundary(
|
|
child: Stack(
|
|
alignment: Alignment.bottomCenter,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 5.w,
|
|
),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_task.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
),
|
|
),
|
|
PositionedDirectional(
|
|
bottom: 8.w,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Image.asset(
|
|
"atu_images/room/at_icon_room_task_tag.png",
|
|
width: 10.w,
|
|
height: 10.w,
|
|
),
|
|
SizedBox(width: 2.w),
|
|
text(
|
|
"$claimableCount",
|
|
fontSize: 9.w,
|
|
textColor: Colors.white,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
},
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag: "showRoomTaskDialog",
|
|
alignment: Alignment.bottomCenter,
|
|
animationType: SmartAnimationType.fade,
|
|
builder: (_) {
|
|
return RoomTaskPage();
|
|
},
|
|
onDismiss: () {
|
|
ref.getRoomTaskClaimableCount();
|
|
},
|
|
);
|
|
},
|
|
),
|
|
GestureDetector(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(vertical: 5.w),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_rocket_lv1.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag: "showRoomRocketYellowPage",
|
|
alignment: Alignment.bottomCenter,
|
|
maskColor: Colors.transparent,
|
|
animationType: SmartAnimationType.fade,
|
|
clickMaskDismiss: true,
|
|
builder: (_) {
|
|
return const RoomRocketYellowPage();
|
|
},
|
|
);
|
|
},
|
|
),
|
|
|
|
Selector<RtcProvider, bool>(
|
|
selector: (_, p) => p.redPacketList.isNotEmpty,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (context, hasRedPacket, _) {
|
|
return RepaintBoundary(
|
|
child:
|
|
hasRedPacket
|
|
? GestureDetector(
|
|
child: Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 5.w,
|
|
),
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_room_redpack_tag.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
),
|
|
),
|
|
onTap: () {
|
|
SmartDialog.show(
|
|
tag:
|
|
"showRoomRedenvelopeList",
|
|
alignment: Alignment.center,
|
|
animationType:
|
|
SmartAnimationType.fade,
|
|
builder: (_) {
|
|
return RoomRedenvelopeListPage();
|
|
},
|
|
);
|
|
},
|
|
)
|
|
: Container(),
|
|
);
|
|
},
|
|
),
|
|
ATDebounceWidget(
|
|
child: Selector<RtmProvider, int>(
|
|
selector: (c, p) => p.allUnReadCount,
|
|
shouldRebuild: (prev, next) => prev != next,
|
|
builder: (_, allUnReadCount, __) {
|
|
return Container(
|
|
margin: EdgeInsets.symmetric(
|
|
vertical: 5.w,
|
|
),
|
|
child:
|
|
allUnReadCount > 0
|
|
? Badge(
|
|
backgroundColor: Colors.red,
|
|
label: text(
|
|
"${allUnReadCount > 99 ? "99+" : allUnReadCount}",
|
|
fontSize: 9.sp,
|
|
textColor: Colors.white,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
alignment:
|
|
AlignmentDirectional.topEnd,
|
|
child: Image.asset(
|
|
"atu_images/room/at_icon_botton_message.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
fit: BoxFit.contain,
|
|
),
|
|
)
|
|
: Image.asset(
|
|
"atu_images/room/at_icon_botton_message.png",
|
|
width: 45.w,
|
|
height: 45.w,
|
|
fit: BoxFit.contain,
|
|
),
|
|
);
|
|
},
|
|
),
|
|
onTap: () {
|
|
ATNavigatorUtils.push(
|
|
context,
|
|
"${MainRoute.message}?isFromRoom=true",
|
|
);
|
|
},
|
|
),
|
|
Container(
|
|
height: 56.w,
|
|
margin: EdgeInsets.symmetric(vertical: 5.w),
|
|
child: RepaintBoundary(child: RoomBannerView()),
|
|
),
|
|
SizedBox(height: 10.w),
|
|
],
|
|
),
|
|
SizedBox(width: 10.w),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|