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.
165 lines
5.4 KiB
165 lines
5.4 KiB
import 'package:dating_touchme_app/generated/assets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:tdesign_flutter/tdesign_flutter.dart';
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_user_header.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_anchor_showcase.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_seat_list.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_active_speaker.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_notice_chat_panel.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_room_action_bar.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_gift_popup.dart';
|
|
import 'package:dating_touchme_app/widget/live/live_recharge_popup.dart';
|
|
|
|
class LiveRoomPage extends StatefulWidget {
|
|
final int id;
|
|
const LiveRoomPage({super.key, required this.id});
|
|
|
|
@override
|
|
State<LiveRoomPage> createState() => _LiveRoomPageState();
|
|
}
|
|
|
|
class _LiveRoomPageState extends State<LiveRoomPage> {
|
|
String message = '';
|
|
final TextEditingController _messageController = TextEditingController();
|
|
|
|
final activeGift = ValueNotifier<int?>(null);
|
|
|
|
List<Map> giftList = [
|
|
{"icon": Assets.imagesGift1, "title": "爱心礼物", "price": 30},
|
|
{"icon": Assets.imagesGift2, "title": "小小小星星", "price": 30},
|
|
{"icon": Assets.imagesGift3, "title": "助威", "price": 30},
|
|
{"icon": Assets.imagesGift4, "title": "点赞", "price": 30},
|
|
{"icon": Assets.imagesGift5, "title": "崇拜衣柜", "price": 30},
|
|
];
|
|
|
|
final giftNum = ValueNotifier<int>(1);
|
|
|
|
final activePay = ValueNotifier<int?>(null);
|
|
List<Map> payList = [
|
|
{"num": 10, "price": 10, "hasTag": true},
|
|
{"num": 60, "price": 60, "hasTag": true},
|
|
{"num": 300, "price": 60, "hasTag": true},
|
|
{"num": 1080, "price": 1080, "hasTag": false},
|
|
{"num": 2880, "price": 2880, "hasTag": false},
|
|
{"num": 5000, "price": 5000, "hasTag": false},
|
|
{"num": 10000, "price": 10000, "hasTag": false},
|
|
{"num": 20000, "price": 20000, "hasTag": false},
|
|
{"num": 50000, "price": 50000, "hasTag": false},
|
|
];
|
|
|
|
final payChecked = ValueNotifier<bool>(true);
|
|
|
|
changeActive(int index) {
|
|
activeGift.value = index;
|
|
setState(() {});
|
|
}
|
|
|
|
changePayActive(int index) {
|
|
activePay.value = index;
|
|
setState(() {});
|
|
}
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
void _showGiftPopup() {
|
|
SmartDialog.show(
|
|
alignment: Alignment.bottomCenter,
|
|
maskColor: TDTheme.of(context).fontGyColor2,
|
|
builder: (_) => LiveGiftPopup(
|
|
activeGift: activeGift,
|
|
giftNum: giftNum,
|
|
giftList: giftList,
|
|
changeActive: changeActive,
|
|
),
|
|
);
|
|
}
|
|
|
|
void _showRechargePopup() {
|
|
SmartDialog.show(
|
|
alignment: Alignment.bottomCenter,
|
|
maskColor: TDTheme.of(context).fontGyColor2,
|
|
builder: (_) => LiveRechargePopup(
|
|
activePay: activePay,
|
|
payChecked: payChecked,
|
|
payList: payList,
|
|
changePayActive: changePayActive,
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Stack(
|
|
children: [
|
|
Container(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
Color.fromRGBO(248, 242, 255, 1),
|
|
Color.fromRGBO(247, 247, 247, 1),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.bottomCenter,
|
|
end: Alignment.topCenter,
|
|
colors: [
|
|
Color.fromRGBO(19, 16, 47, 1),
|
|
Color.fromRGBO(19, 16, 47, 1),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 10.w),
|
|
const LiveRoomUserHeader(
|
|
userName: '开心的橘子',
|
|
popularityText: '1263',
|
|
),
|
|
SizedBox(height: 7.w),
|
|
const LiveRoomAnchorShowcase(),
|
|
SizedBox(height: 5.w),
|
|
const LiveRoomSeatList(),
|
|
SizedBox(height: 5.w),
|
|
const LiveRoomActiveSpeaker(),
|
|
SizedBox(height: 9.w),
|
|
const LiveRoomNoticeChatPanel(),
|
|
SizedBox(height: 17.w),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
LiveRoomActionBar(
|
|
messageController: _messageController,
|
|
onMessageChanged: (value) {
|
|
message = value;
|
|
},
|
|
onGiftTap: _showGiftPopup,
|
|
onChargeTap: _showRechargePopup,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|