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.
 
 
 
 
 

286 lines
10 KiB

import 'package:dating_touchme_app/components/page_appbar.dart';
import 'package:dating_touchme_app/controller/mine/rose_history_controller.dart';
import 'package:dating_touchme_app/generated/assets.dart';
import 'package:dating_touchme_app/model/mine/rose_history_data.dart';
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:dating_touchme_app/model/mine/user_prop_data.dart' as up;
class RoseHistoryPage extends StatelessWidget {
const RoseHistoryPage({super.key});
@override
Widget build(BuildContext context) {
return GetX<RoseHistoryController>(
init: RoseHistoryController(),
builder: (controller){
return Scaffold(
appBar: PageAppbar(title: "交易记录"),
body: EasyRefresh(
controller: controller.listRefreshController,
header: const ClassicHeader(
dragText: '下拉刷新',
armedText: '释放刷新',
readyText: '刷新中...',
processingText: '刷新中...',
processedText: '刷新完成',
failedText: '刷新失败',
noMoreText: '没有更多数据',
showMessage: false
),
footer: ClassicFooter(
dragText: '上拉加载',
armedText: '释放加载',
readyText: '加载中...',
processingText: '加载中...',
processedText: '加载完成',
failedText: '加载失败',
noMoreText: '没有更多数据',
showMessage: false
),
// 下拉刷新
onRefresh: () async {
print('推荐列表下拉刷新被触发');
controller.page.value = 1;
controller.roseHistoryList.clear();
controller.propList.clear();
if(controller.friendNavActive.value != 2){
await controller.getHistoryList();
} else {
await controller.getPropList();
}
controller.listRefreshController.finishRefresh(IndicatorResult.success);
controller.listRefreshController.finishLoad(IndicatorResult.none);
},
// 上拉加载更多
onLoad: () async {
print('推荐列表上拉加载被触发, hasMore: ');
controller.page.value += 1;
if(controller.friendNavActive.value != 2){
controller.getHistoryList();
} else {
controller.getPropList();
}
},
child: SingleChildScrollView(
child: Container(
padding: EdgeInsets.symmetric(
vertical: 6.w,
horizontal: 15.w
),
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: MediaQuery.of(context).size.height - MediaQuery.of(context).padding.top,
),
child: Column(
children: [
Row(
children: [
...controller.friendNavList.asMap().entries.map((entry){
return Container(
margin: EdgeInsets.only(right: 25.w),
child: InkWell(
onTap: (){
controller.changeNavTab(entry.key);
},
child: Container(
padding: entry.key == controller.friendNavActive.value ? EdgeInsets.symmetric(vertical: 2.w, horizontal: 26.w) : EdgeInsets.zero,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(21.w)),
color: entry.key == controller.friendNavActive.value ? const Color.fromRGBO(117, 98, 249, 1) : Colors.transparent
),
child: Text(
entry.value,
style: TextStyle(
fontSize: 12.w,
color: entry.key == controller.friendNavActive.value ? Colors.white : const Color.fromRGBO(51, 51, 51, .7),
fontWeight: entry.key == controller.friendNavActive.value ? FontWeight.w700 : FontWeight.w500
),
),
),
),
);
}),
],
),
SizedBox(height: 4.w,),
if(controller.friendNavActive.value != 2) ...[
...controller.roseHistoryList.map((e){
return SendItem(item: e);
})
],
if(controller.friendNavActive.value == 2) ...[
...controller.propList.map((e) {
return ChatCouponItem(item: e,);
})
],
],
),
),
),
),
),
);
},
);
}
}
class SendItem extends StatefulWidget {
final Records item;
const SendItem({super.key, required this.item});
@override
State<SendItem> createState() => _SendItemState();
}
class _SendItemState extends State<SendItem> {
@override
Widget build(BuildContext context) {
return Container(
height: 70.w,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 1,
color: const Color.fromRGBO(219, 219, 219, 1)
)
)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Container(
width: 40.w,
height: 40.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(40.w)),
color: const Color.fromRGBO(237, 237, 237, 1)
),
child: Center(
child: Image.asset(
Assets.imagesRoseGift,
width: 27.w,
height: 27.w,
),
),
),
SizedBox(width: 22.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
widget.item.tradeType == 201 ? "聊天花费" :
widget.item.tradeType == 202 ? "赠送礼物" :
widget.item.tradeType == 203 ? "连麦" :
widget.item.tradeType == 101 ? "充值" : "",
style: TextStyle(
fontSize: 13.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w500
),
),
Text(
"${widget.item.createTime}",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(144, 144, 144, 1),
),
)
],
)
],
),
Text(
"${widget.item.tradeBalance}",
style: TextStyle(
fontSize: 13.w,
color: const Color.fromRGBO(227, 84, 84, 1)
),
)
],
),
);
}
}
class ChatCouponItem extends StatefulWidget {
final up.Records item;
const ChatCouponItem({super.key, required this.item});
@override
State<ChatCouponItem> createState() => _ChatCouponItemState();
}
class _ChatCouponItemState extends State<ChatCouponItem> {
@override
Widget build(BuildContext context) {
return SizedBox(
height: 70.w,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
widget.item.type == 1 ? Assets.imagesChatCouponIcon : Assets.imagesMicCouponIcon,
width: 40.w,
height: 40.w ,
),
SizedBox(width: 12.w ,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
widget.item.type == 1 ? "主动发起聊天" : "主动发起连麦",
style: TextStyle(
fontSize: 13.w,
fontWeight: FontWeight.w500
),
),
Text(
"${widget.item.startTime}",
style: TextStyle(
fontSize: 11.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
],
)
],
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
widget.item.type == 1 ? "主动发起聊天" : "主动发起连麦",
style: TextStyle(
fontSize: 13.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
Text(
"-${widget.item.num}",
style: TextStyle(
fontSize: 13.w,
color: const Color.fromRGBO(227, 84, 84, 1)
),
),
],
),
],
),
);
}
}