初始化
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/common_service.dart';
|
||||
|
||||
import '../../../hj_model/mine/happy/happy_model.dart';
|
||||
import '../../../hj_model/splash/ads_model.dart';
|
||||
|
||||
/// 应用推荐页:按分类拉广告位数据,每个分类一个 tab
|
||||
class LouFengAdLogic extends GetxController
|
||||
with GetSingleTickerProviderStateMixin {
|
||||
bool isLoading = true;
|
||||
HappyModel? model; // null 表示加载失败,页面展示重试
|
||||
|
||||
final tabs = <String>[]; // 有内容的分类名
|
||||
final configs = <AdTabConfig>[]; // 与 tabs 一一对应的渲染配置
|
||||
TabController? tabCtr;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
loadData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
tabCtr?.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
/// 拉数据并重建分类,失败时 model 为 null 由页面兜底
|
||||
Future<void> loadData() async {
|
||||
model = await CommonService.happyList();
|
||||
isLoading = false;
|
||||
tabs.clear();
|
||||
configs.clear();
|
||||
if (model != null) _buildTabs();
|
||||
update();
|
||||
}
|
||||
|
||||
/// 「应用」固定展示,其余分类有 banner 或有应用才建 tab
|
||||
void _buildTabs() {
|
||||
_add(
|
||||
'应用',
|
||||
AdTabConfig(
|
||||
bannerAds: _banners(1),
|
||||
hengAds: model?.hengApp != null
|
||||
? AdGroup(items: model?.hengApp, title: '官方推荐')
|
||||
: null,
|
||||
shuAds: model?.shuApp != null
|
||||
? AdGroup(items: model?.shuApp, title: '热门应用')
|
||||
: null,
|
||||
));
|
||||
|
||||
final others = [
|
||||
('炮台', 3, model?.ypApp),
|
||||
('棋牌', 4, model?.qpApp),
|
||||
('直播', 5, model?.zbApp),
|
||||
('游戏', 2, model?.gameApp),
|
||||
];
|
||||
for (final (name, moduleType, apps) in others) {
|
||||
final banners = _banners(moduleType);
|
||||
if (banners.isEmpty && (apps?.isEmpty ?? true)) continue;
|
||||
_add(
|
||||
name,
|
||||
AdTabConfig(
|
||||
bannerAds: banners,
|
||||
shuAds: apps != null ? AdGroup(items: apps, title: '热门推荐') : null,
|
||||
));
|
||||
}
|
||||
|
||||
// tab 数量随数据变化,controller 要跟着重建
|
||||
tabCtr?.dispose();
|
||||
tabCtr = TabController(length: tabs.length, vsync: this);
|
||||
}
|
||||
|
||||
void _add(String name, AdTabConfig config) {
|
||||
tabs.add(name);
|
||||
configs.add(config);
|
||||
}
|
||||
|
||||
/// 取该分类下的 banner 广告
|
||||
List<AdsInfoModel> _banners(int moduleType) =>
|
||||
model?.adv?.where((it) => it.moduleType == moduleType).toList() ?? [];
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgdj/tools_base/unique_tag_mixin.dart';
|
||||
import 'package:hgdj/tools_base/widget/keep_alive_widget.dart';
|
||||
|
||||
import 'lou_feng_ad_logic.dart';
|
||||
import 'widget/recommend_app_page.dart';
|
||||
|
||||
/// 应用推荐页,可从广告链接再次进入(taskhall),故用 uniqueTag 隔离多实例
|
||||
class LouFengAdPage extends StatefulWidget {
|
||||
const LouFengAdPage({super.key});
|
||||
|
||||
@override
|
||||
State<LouFengAdPage> createState() => _LouFengAdPageState();
|
||||
}
|
||||
|
||||
class _LouFengAdPageState extends State<LouFengAdPage> with UniqueTagMixin {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<LouFengAdLogic>(
|
||||
tag: uniqueTag,
|
||||
init: LouFengAdLogic(),
|
||||
builder: (logic) {
|
||||
if (logic.isLoading) return const LoadingCenterWidget();
|
||||
if (logic.model == null)
|
||||
return CErrorWidget(retryOnTap: logic.loadData);
|
||||
//只有「应用」一个分类时不展示 tab
|
||||
if (logic.tabs.length <= 1) return _adView(logic, 0);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
14.sizeBoxH,
|
||||
//分类 tab:无指示器,靠文字颜色区分选中态
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 9),
|
||||
child: TabBar(
|
||||
controller: logic.tabCtr,
|
||||
padding: EdgeInsets.zero,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
labelStyle: TextStyle(fontSize: 14, color: Color(0xE5FFFFFF)),
|
||||
unselectedLabelStyle:
|
||||
TextStyle(fontSize: 14, color: Color(0xffACBABF)),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
indicatorColor: Color(0x00FFFFFF),
|
||||
indicatorWeight: 1,
|
||||
labelColor: Color(0xE5FFFFFF),
|
||||
labelPadding: EdgeInsets.zero,
|
||||
tabs: logic.tabs
|
||||
.map((it) => Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||
child: Text(it),
|
||||
))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: logic.tabCtr,
|
||||
children: List.generate(
|
||||
logic.configs.length, (i) => _adView(logic, i).keepAlive),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _adView(LouFengAdLogic logic, int index) =>
|
||||
RecommendAppPage(logic.configs[index]);
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
import 'package:easy_rich_text/easy_rich_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/routers/jump_router.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
import 'package:hgdj/tools_base/unique_tag_mixin.dart';
|
||||
import 'package:hgdj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../config/config.dart';
|
||||
import '../mine_share/mine_share_record_logic.dart';
|
||||
import '../mine_share/mine_share_record_page.dart';
|
||||
import '../widgets/mine_share_qr_view.dart';
|
||||
|
||||
class MineIncomePage extends StatefulWidget {
|
||||
const MineIncomePage({super.key});
|
||||
|
||||
@override
|
||||
State<MineIncomePage> createState() => _MineIncomePageState();
|
||||
}
|
||||
|
||||
class _MineIncomePageState extends State<MineIncomePage> with UniqueTagMixin {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
globalStore.refreshWallet();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MineShareRecordLogic>(
|
||||
tag: uniqueTag,
|
||||
init: MineShareRecordLogic(),
|
||||
builder: (logic) => SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 0, right: 0, top: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Image.asset("proxy_header_bg.webp".mineImgPath,
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.fromLTRB(10, 23, 10, 6),
|
||||
// decoration: BoxDecoration(color: Color(0xFF030F18)),
|
||||
child: Column(
|
||||
children: [
|
||||
Consumer<GlobalStore>(
|
||||
builder: (_, store, __) => Row(
|
||||
children: [
|
||||
NetworkImageLoader(
|
||||
imageUrl: store.meInfo?.portrait ?? '',
|
||||
width: 60,
|
||||
height: 60,
|
||||
borderRadius: 30,
|
||||
),
|
||||
10.sizeBoxW,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
globalStore.meInfo?.name ?? "",
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 18.0),
|
||||
),
|
||||
5.sizeBoxH,
|
||||
Text(
|
||||
"开通会员 畅享专属特权",
|
||||
style: const TextStyle(
|
||||
color: Color(0xff989898),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(() => MineShareRecordPage());
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"邀请人数",
|
||||
style: const TextStyle(
|
||||
color: Color(0xB2FFFFFF),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 12.0),
|
||||
),
|
||||
SizedBox(height: 1),
|
||||
Text(
|
||||
"${logic.model?.totalInviteUserCount ?? 0}",
|
||||
style: const TextStyle(
|
||||
color: Color(0xffF68804),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 24.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
if (Config.proxyBanner?.additionalProp != null)
|
||||
Column(
|
||||
children: [
|
||||
29.sizeBoxH,
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: () {
|
||||
pushToPageByLink(
|
||||
Config.proxyBanner?.additionalProp?.url ??
|
||||
"");
|
||||
},
|
||||
child: Config.proxyBanner?.additionalProp
|
||||
?.banner !=
|
||||
null
|
||||
? NetworkImageLoader(
|
||||
imageUrl: Config.proxyBanner
|
||||
?.additionalProp?.banner ??
|
||||
'',
|
||||
width: double.infinity,
|
||||
borderRadius: 0,
|
||||
)
|
||||
: Image.asset(
|
||||
'proxy_banner.webp'.mineImgPath,
|
||||
width: double.infinity,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
12.sizeBoxH,
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
"规则说明",
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFFFFF),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 18.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||
width: double.infinity,
|
||||
child: EasyRichText(
|
||||
'每邀请3名好友成功注册即可获得3天VIP',
|
||||
textAlign: TextAlign.left,
|
||||
defaultStyle:
|
||||
TextStyle(fontSize: 12, color: Color(0x73FFFFFF)),
|
||||
patternList: [
|
||||
EasyRichTextPattern(
|
||||
targetString: '3名好友',
|
||||
style: TextStyle(color: Color(0xFFF68804)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||
width: double.infinity,
|
||||
child: EasyRichText(
|
||||
'邀请说明:点击【保存二维码】或【复制推广链接】分享给朋友下载即可',
|
||||
textAlign: TextAlign.left,
|
||||
defaultStyle:
|
||||
TextStyle(fontSize: 12, color: Color(0x73FFFFFF)),
|
||||
),
|
||||
),
|
||||
MineShareQRView(),
|
||||
12.sizeBoxH,
|
||||
Image.asset(
|
||||
"invite_steps.webp".mineImgPath,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
24.sizeBoxH,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_model/video_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/vid_service.dart';
|
||||
import 'package:hgdj/hj_utils/const.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
//免费专区排序 tab(标题与接口 sort 值绑定)
|
||||
const _sortTabs = [SortTab('最多收藏', 1), SortTab('最新上架', 2), SortTab('最多观看', 3)];
|
||||
|
||||
class MoreFreeVideoLogic extends GetxController
|
||||
with GetTickerProviderStateMixin {
|
||||
final String vId;
|
||||
List<String> get sortTitles => _sortTabs.map((e) => e.name).toList();
|
||||
MoreFreeVideoLogic(this.vId);
|
||||
|
||||
bool isLoading = true;
|
||||
int page = 1;
|
||||
int sort = 0;
|
||||
late final TabController tabController =
|
||||
TabController(length: _sortTabs.length, vsync: this);
|
||||
RefreshController? refreshController;
|
||||
List<VideoModel> dataSource = [];
|
||||
|
||||
fetchPageData({bool isRefresh = true, bool showLoading = false}) async {
|
||||
if (isRefresh) {
|
||||
page = 1;
|
||||
}
|
||||
if (showLoading) {
|
||||
isLoading = true;
|
||||
update();
|
||||
}
|
||||
final res = await VidService.fetchFreeSourceList(vId,
|
||||
page: page, sortType: _sortTabs[sort].sort);
|
||||
isLoading = false;
|
||||
if (isRefresh) {
|
||||
dataSource.clear();
|
||||
refreshController?.refreshCompleted();
|
||||
}
|
||||
res?.hasNext ?? false
|
||||
? refreshController?.loadComplete()
|
||||
: refreshController?.loadNoData();
|
||||
dataSource.addAll(res?.list ?? []);
|
||||
page += 1;
|
||||
update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgdj/tools_base/refresh/pull_refresh.dart';
|
||||
|
||||
import '../../home/home_cell_style/video_simple_cell.dart';
|
||||
import 'more_free_video_logic.dart';
|
||||
|
||||
class MoreFreeVideoPage extends StatelessWidget {
|
||||
final String title;
|
||||
final String vId;
|
||||
const MoreFreeVideoPage(this.title, this.vId, {super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<MoreFreeVideoLogic>(
|
||||
init: MoreFreeVideoLogic(vId),
|
||||
builder: (controller) => Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(title),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Container(
|
||||
width: 182,
|
||||
height: 31,
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: ShapeDecoration(
|
||||
shape: StadiumBorder(),
|
||||
color: Color(0xFF20252F),
|
||||
),
|
||||
child: TabBar(
|
||||
tabAlignment: TabAlignment.fill,
|
||||
tabs: controller.sortTitles.map((e) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text(e),
|
||||
);
|
||||
}).toList(),
|
||||
labelStyle: TextStyle(
|
||||
color: Color(0xFFF1F3F4),
|
||||
fontSize: 12,
|
||||
),
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: Color(0xFFACBABF),
|
||||
fontSize: 12,
|
||||
),
|
||||
controller: controller.tabController,
|
||||
padding: EdgeInsets.zero,
|
||||
isScrollable: false,
|
||||
onTap: (index) {
|
||||
controller.sort = index;
|
||||
controller.fetchPageData(showLoading: true);
|
||||
},
|
||||
labelPadding: EdgeInsets.zero,
|
||||
indicator: ShapeDecoration(
|
||||
shape: StadiumBorder(),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xFF83A4F8), Color(0xFF2A5CDE)],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: pullYsRefresh(
|
||||
onInit: (ctr) => controller.refreshController = ctr,
|
||||
onRefresh: (_) => controller.fetchPageData(),
|
||||
onLoading: (_) => controller.fetchPageData(isRefresh: false),
|
||||
child: () {
|
||||
if (controller.isLoading) return LoadingCenterWidget();
|
||||
if (controller.dataSource.isEmpty) return CErrorWidget();
|
||||
return GridView.builder(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
crossAxisSpacing: 7,
|
||||
mainAxisSpacing: 12,
|
||||
childAspectRatio: 191 / 174,
|
||||
),
|
||||
itemCount: controller.dataSource.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: VideoSimpleCell(
|
||||
videoModel: controller.dataSource[index],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/hj_model/user/user_income_info_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
||||
|
||||
import '../make_money/withdrawal_page.dart';
|
||||
import 'share_details_page.dart';
|
||||
|
||||
class IncomeData {
|
||||
String value;
|
||||
String title;
|
||||
|
||||
IncomeData(this.title, this.value);
|
||||
}
|
||||
|
||||
class ShareDataListPage extends StatefulWidget {
|
||||
const ShareDataListPage({super.key});
|
||||
|
||||
@override
|
||||
State<ShareDataListPage> createState() => _ShareDataListPageState();
|
||||
}
|
||||
|
||||
class _ShareDataListPageState extends State<ShareDataListPage> {
|
||||
UserIncomeModel? _model;
|
||||
bool isLoading = true;
|
||||
final incomeList = <IncomeData>[];
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
final res = await MineService.fetchIncomeInfo();
|
||||
isLoading = false;
|
||||
_model = res;
|
||||
incomeList.add(IncomeData("当月收益(元)", _model?.monthIncomeAmount ?? '0'));
|
||||
incomeList.add(IncomeData("当月推广数", _model?.monthInviteUserCount ?? '0'));
|
||||
incomeList.add(IncomeData("今日收益(元)", _model?.todayIncomeAmount ?? '0'));
|
||||
incomeList.add(IncomeData("今日推广数", _model?.todayInviteUserCount ?? '0'));
|
||||
if (mounted) setState(() {});
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('推广数据'),
|
||||
actions: [
|
||||
GestureDetector(
|
||||
onTap: () => Get.to(() => ShareDetailsPage(model: _model)),
|
||||
child: Text(
|
||||
'收益明细',
|
||||
style: TextStyle(color: Color(0xFF989898), fontSize: 12),
|
||||
),
|
||||
),
|
||||
16.sizeBoxW
|
||||
],
|
||||
),
|
||||
body: () {
|
||||
if (isLoading) return LoadingCenterWidget();
|
||||
if (_model == null) return CErrorWidget();
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 12, right: 12, top: 12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
height: 160,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border:
|
||||
Border.all(color: const Color(0xff1e262e), width: 1),
|
||||
color: Color(0xFF131b23)),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"钱包余额",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffb8bbbd),
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 12.0),
|
||||
),
|
||||
Text(
|
||||
"${_model?.totalAmount}",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 24.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 57,
|
||||
width: .5,
|
||||
child: DecoratedBox(
|
||||
decoration:
|
||||
BoxDecoration(color: Color(0xff444444))),
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"累积收益",
|
||||
style: const TextStyle(
|
||||
color: Color(0xffb8bbbd),
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 12.0),
|
||||
),
|
||||
Text(
|
||||
"${_model?.totalIncomeAmount}",
|
||||
style: const TextStyle(
|
||||
color: Color(0xffffffff),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 24.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
enableFeedback: false,
|
||||
onTap: () => Get.to(WithdrawalPage()),
|
||||
child: Container(
|
||||
width: 276,
|
||||
height: 36,
|
||||
margin: EdgeInsets.symmetric(vertical: 15),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(18)),
|
||||
color: Color(0xFFcf452f),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
"立即提现",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 12.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
12.sizeBoxH,
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
border:
|
||||
Border.all(color: const Color(0xff1e262e), width: 1),
|
||||
color: Color(0xFF131b23),
|
||||
),
|
||||
child: GridView.count(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
crossAxisCount: 2,
|
||||
childAspectRatio: 5 / 3,
|
||||
children:
|
||||
incomeList.map((e) => _buildIncomeGItem(e)).toList(),
|
||||
),
|
||||
),
|
||||
15.sizeBoxH,
|
||||
Text(
|
||||
"推广总统计",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16.0),
|
||||
),
|
||||
15.sizeBoxH,
|
||||
_buildTGItem("累计推广用户", _model?.totalInviteUserCount ?? '0'),
|
||||
_buildTGItem("累计付费用户", _model?.totalPayUserCount ?? '0'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}());
|
||||
}
|
||||
|
||||
Widget _buildTGItem(String title, String value) {
|
||||
return Container(
|
||||
height: 35,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffb8bbbd),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12.0),
|
||||
),
|
||||
Text(
|
||||
"$value",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 18.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIncomeGItem(IncomeData item) {
|
||||
return Container(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"${item.value}",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 18.0),
|
||||
),
|
||||
Text(
|
||||
item.title,
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffb8bbbd),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 12.0),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,173 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/hj_model/user/user_income_info_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgdj/tools_base/refresh/pull_refresh.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
import 'share_data_list_page.dart';
|
||||
|
||||
class ShareDetailsPage extends StatefulWidget {
|
||||
final UserIncomeModel? model;
|
||||
|
||||
const ShareDetailsPage({super.key, this.model});
|
||||
|
||||
@override
|
||||
State<ShareDetailsPage> createState() => _ShareDetailsPageState();
|
||||
}
|
||||
|
||||
class _ShareDetailsPageState extends State<ShareDetailsPage> {
|
||||
RefreshController? _controller;
|
||||
final incomeList = <IncomeData>[];
|
||||
int page = 1;
|
||||
bool isLoading = true;
|
||||
final dataSource = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final model = widget.model;
|
||||
incomeList.add(IncomeData("总推广人数", model?.totalInviteUserCount ?? '0'));
|
||||
incomeList.add(IncomeData("总推广收益", model?.totalIncomeAmount ?? '0'));
|
||||
incomeList.add(IncomeData("今日推广人数", model?.todayInviteUserCount ?? '0'));
|
||||
incomeList.add(IncomeData("今日推广收益", model?.todayIncomeAmount ?? '0'));
|
||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||
_fetchPageData();
|
||||
});
|
||||
}
|
||||
|
||||
_fetchPageData({bool isRefresh = true}) async {
|
||||
if (isRefresh) {
|
||||
page = 1;
|
||||
}
|
||||
final res = await MineService.fetchIncomeList(page: 1);
|
||||
isLoading = false;
|
||||
if (isRefresh) {
|
||||
dataSource.clear();
|
||||
}
|
||||
res?.hasNext ?? false
|
||||
? _controller?.loadComplete()
|
||||
: _controller?.loadNoData();
|
||||
dataSource.addAll(res?.items ?? []);
|
||||
page += 1;
|
||||
if (mounted) setState(() {});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('推广数据'),
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
child: pullYsRefresh(
|
||||
onLoading: (_) => _fetchPageData(isRefresh: false),
|
||||
onRefresh: (_) => _fetchPageData(),
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
SliverList.separated(
|
||||
itemCount: incomeList.length,
|
||||
itemBuilder: (_, index) => _buildIncomeItem(incomeList[index]),
|
||||
separatorBuilder: (_, index) => 10.sizeBoxH,
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(height: 10),
|
||||
// 收益明细
|
||||
Text(
|
||||
"收益明细",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffbec4d6),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 18.0),
|
||||
),
|
||||
SizedBox(height: 10),
|
||||
],
|
||||
),
|
||||
),
|
||||
() {
|
||||
if (isLoading)
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(
|
||||
height: 300,
|
||||
child: LoadingCenterWidget(),
|
||||
),
|
||||
);
|
||||
if (dataSource.isEmpty)
|
||||
return SliverToBoxAdapter(
|
||||
child: SizedBox(height: 300, child: CErrorWidget()));
|
||||
return SliverList.builder(
|
||||
itemCount: dataSource.length,
|
||||
itemBuilder: (_, index) {
|
||||
final item = dataSource[index];
|
||||
return _buildRecordItem(item.userName, item.incomeAmount);
|
||||
});
|
||||
}()
|
||||
],
|
||||
),
|
||||
onInit: (_) => _controller = _,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRecordItem(String title, int value) {
|
||||
return Container(
|
||||
height: 35,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffffffff),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14.0),
|
||||
),
|
||||
Text(
|
||||
"收益+$value元",
|
||||
style: const TextStyle(
|
||||
color: const Color(0xffF68804),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildIncomeItem(IncomeData item) {
|
||||
return Container(
|
||||
height: 65,
|
||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
border: Border.all(color: const Color(0xff1e262e), width: 1),
|
||||
color: Color(0xFF131b23),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
item.title,
|
||||
style: const TextStyle(
|
||||
color: const Color(0xE5FFFFFF),
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 14.0),
|
||||
),
|
||||
Text(
|
||||
"${item.value}",
|
||||
style: const TextStyle(
|
||||
color: const Color(0x8CFFFFFF),
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 20.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../../hj_model/mine/task_center_data.dart';
|
||||
import '../../../hj_utils/api_service/common_service.dart';
|
||||
import '../../../hj_utils/api_service/mine_service.dart';
|
||||
|
||||
class SignDailyPageLogic extends GetxController with GetTickerProviderStateMixin {
|
||||
int shareCount = 0;
|
||||
List<DailyTask>? taskList;
|
||||
List<DailyTask>? dailyTask;
|
||||
final outerCtr = ScrollController();
|
||||
final tabKey = GlobalKey();
|
||||
String signBackgroundImage = '';
|
||||
|
||||
final tabs = <String>["福利任务", "积分兑换"];
|
||||
|
||||
late final TabController tabCtr = TabController(
|
||||
initialIndex: 0,
|
||||
length: tabs.length,
|
||||
vsync: this,
|
||||
);
|
||||
|
||||
/// AppBar 背景透明度,由滚动驱动:0.0 透明 → 1.0 不透明
|
||||
double appbarOpacity = 0.0;
|
||||
|
||||
/// 滚动多少像素后 AppBar 完全不透明
|
||||
static const double _kAppBarFadeMaxOffset = 100.0;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
outerCtr.addListener(_onOuterScroll);
|
||||
}
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
super.onReady();
|
||||
loadData();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
outerCtr.removeListener(_onOuterScroll);
|
||||
outerCtr.dispose();
|
||||
tabCtr.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
/// 监听外层滚动,按偏移量更新 AppBar 透明度并局部刷新
|
||||
void _onOuterScroll() {
|
||||
final newOpacity = (outerCtr.offset / _kAppBarFadeMaxOffset).clamp(0.0, 1.0);
|
||||
if ((newOpacity - appbarOpacity).abs() < 0.01) return;
|
||||
appbarOpacity = newOpacity;
|
||||
update(['appbar']);
|
||||
}
|
||||
|
||||
///初始化任务列表
|
||||
Future<void> loadData() async {
|
||||
final signResult = await MineService.getSignList();
|
||||
signBackgroundImage = signResult?.config?.backgroundImage ?? '';
|
||||
|
||||
final result = await CommonService.getTaskList();
|
||||
taskList ??= [];
|
||||
taskList?.clear();
|
||||
|
||||
result?.dailyTask?.forEach((element) {
|
||||
element.doType = 1;
|
||||
});
|
||||
taskList?.addAll(result?.dailyTask ?? []);
|
||||
|
||||
result?.growthTasks?.forEach((element) {
|
||||
element.doType = 3;
|
||||
});
|
||||
taskList?.addAll(result?.growthTasks ?? []);
|
||||
|
||||
result?.onceTask?.forEach((element) {
|
||||
element.doType = 2;
|
||||
});
|
||||
taskList?.addAll(result?.onceTask ?? []);
|
||||
|
||||
update();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_page/mine/widgets/integral_exchange_page.dart';
|
||||
import 'package:hgdj/hj_utils/free_play_manager.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/loading/loading_center_widget.dart';
|
||||
import 'package:hgdj/tools_base/widget/keep_alive_widget.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../tools_base/global_store/store.dart';
|
||||
import '../../../tools_base/indicator/custom_tab_indicator.dart';
|
||||
import '../../../tools_base/widget/net_image_widget.dart';
|
||||
import '../../main_page/provider/msg_provider.dart';
|
||||
import '../../pre_sale/pre_sale_provider.dart';
|
||||
import '../mine_vip/mine_charge_vip_page.dart';
|
||||
import '../widgets/exchange_vip_page.dart';
|
||||
import 'sign_daily_logic.dart';
|
||||
import 'widget/task_widgets.dart';
|
||||
|
||||
//每日签到
|
||||
class SignDailyPage extends StatelessWidget {
|
||||
const SignDailyPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GetBuilder<SignDailyPageLogic>(
|
||||
init: SignDailyPageLogic(),
|
||||
global: false,
|
||||
builder: (logic) {
|
||||
return Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: _buildAppBar(logic),
|
||||
body: _buildBody(logic),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/// AppBar:背景透明度跟随滚动变化(局部刷新 id='appbar')
|
||||
PreferredSizeWidget _buildAppBar(SignDailyPageLogic logic) {
|
||||
return PreferredSize(
|
||||
preferredSize: const Size.fromHeight(kToolbarHeight),
|
||||
child: GetBuilder<SignDailyPageLogic>(
|
||||
init: logic,
|
||||
global: false,
|
||||
id: 'appbar',
|
||||
builder: (_) => AppBar(
|
||||
title: const Text('每日签到'),
|
||||
backgroundColor:
|
||||
const Color(0xff030F18).withValues(alpha: logic.appbarOpacity),
|
||||
elevation: 0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBody(SignDailyPageLogic logic) {
|
||||
if (logic.taskList == null) return const LoadingCenterWidget();
|
||||
if (logic.taskList!.isEmpty) return const CErrorWidget();
|
||||
|
||||
return ExtendedNestedScrollView(
|
||||
controller: logic.outerCtr,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
onlyOneScrollInBody: true,
|
||||
headerSliverBuilder: (context, innerBoxIsScrolled) {
|
||||
return [
|
||||
CupertinoSliverRefreshControl(
|
||||
onRefresh: () async {
|
||||
await logic.loadData();
|
||||
},
|
||||
),
|
||||
SliverToBoxAdapter(child: _buildVIPNewGuide(logic)),
|
||||
SliverToBoxAdapter(child: MineSignView(logic: logic)),
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
key: logic.tabKey,
|
||||
margin: const EdgeInsets.fromLTRB(16, 15, 0, 6),
|
||||
child: _buildTab(logic),
|
||||
),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'我的积分 ',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w400),
|
||||
),
|
||||
Consumer<GlobalStore>(
|
||||
builder: (_, provider, __) => Text(
|
||||
'${globalStore.wallet?.integral ?? 0}',
|
||||
style: const TextStyle(
|
||||
color: Color(0xffF68804),
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
controller: logic.tabCtr,
|
||||
children: [
|
||||
MineTaskView(logic.taskList!).keepAlive,
|
||||
const IntegralExchangePage().keepAlive,
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_buildTab(SignDailyPageLogic logic) {
|
||||
return Row(
|
||||
children: [
|
||||
TabBar(
|
||||
padding: EdgeInsets.zero,
|
||||
isScrollable: true,
|
||||
tabAlignment: TabAlignment.start,
|
||||
labelStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color(0xffF68804),
|
||||
fontWeight: FontWeight.w500),
|
||||
unselectedLabelStyle: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
controller: logic.tabCtr,
|
||||
tabs: logic.tabs.map((it) => Text(it)).toList(),
|
||||
labelPadding: const EdgeInsets.fromLTRB(0, 0, 20, 6),
|
||||
indicator: CustomIndicator(
|
||||
width: 18,
|
||||
height: 4,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () => Get.to(ExchangeVipPage()),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Text(
|
||||
'兑换记录',
|
||||
style: TextStyle(
|
||||
color: Color(0xFF999999),
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_buildVIPNewGuide(SignDailyPageLogic logic) {
|
||||
return Stack(
|
||||
children: [
|
||||
logic.signBackgroundImage.isNotEmpty
|
||||
? NetworkImageLoader(
|
||||
width: double.infinity,
|
||||
height: 240,
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: logic.signBackgroundImage,
|
||||
)
|
||||
: Image.asset(
|
||||
"welfare_vip_background.webp".mineImgPath,
|
||||
width: double.infinity,
|
||||
height: 240,
|
||||
fit: BoxFit.fitWidth,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
110.sizeBoxH,
|
||||
Consumer<MineMsgProvider>(
|
||||
builder: (context, provider, child) => Container(
|
||||
margin: const EdgeInsets.only(left: 2),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImageLoader(
|
||||
imageUrl: globalStore.meInfo?.portrait ?? '',
|
||||
width: 60,
|
||||
height: 60,
|
||||
borderRadius: 30,
|
||||
),
|
||||
10.sizeBoxW,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
globalStore.meInfo?.name ?? "",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w500),
|
||||
),
|
||||
if ((globalStore.meInfo?.vipLevel ?? 0) > 0) ...[
|
||||
4.sizeBoxW,
|
||||
Image.asset(
|
||||
globalStore.meInfo?.vipImageName ?? "",
|
||||
width: 30,
|
||||
height: 18),
|
||||
],
|
||||
],
|
||||
),
|
||||
5.sizeBoxH,
|
||||
Consumer<PreSaleProvider>(
|
||||
builder: (context, provider, child) {
|
||||
final isVip = globalStore.isVIP;
|
||||
final watch =
|
||||
FreePlayManager().remain?.watchCount ?? 0;
|
||||
final aiFree =
|
||||
globalStore.wallet?.aiUndressFreeTimes ?? 0;
|
||||
final aiToday =
|
||||
provider.remain?.todayAiUndressCount ?? 0;
|
||||
return Text(
|
||||
isVip
|
||||
? "剩余AI次数:${aiFree + aiToday}"
|
||||
: "剩余观看次数:$watch",
|
||||
style: const TextStyle(
|
||||
fontSize: 12, color: Color(0xff656565)),
|
||||
);
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
22.sizeBoxH,
|
||||
if (!globalStore.isVIP)
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(MineChargeVipPage());
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.center,
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 12.w, vertical: 5.h),
|
||||
margin: EdgeInsets.symmetric(horizontal: 40.w, vertical: 0),
|
||||
decoration: const BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(90)),
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xFFFF9077), Color(0xFFFF6E4E)],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
globalStore.isVIP ? '已开通会员' : '开通VIP不限次数免费观看',
|
||||
style: TextStyle(
|
||||
color: Color(
|
||||
globalStore.isVIP ? 0xfffffffff : 0xfffffffff),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (globalStore.isVIP) TaskCenterVIPGuideView(),
|
||||
20.sizeBoxW,
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/tools_base/widget/keep_alive_widget.dart';
|
||||
|
||||
import '../../../tools_base/indicator/custom_tab_indicator.dart';
|
||||
import 'lou_feng_ad_page.dart';
|
||||
import 'mine_income_page.dart';
|
||||
|
||||
class WelfareHomePage extends StatefulWidget {
|
||||
///默认选中的 tab:0 分享邀请 / 1 应用推荐
|
||||
final int index;
|
||||
|
||||
const WelfareHomePage({super.key, this.index = 0});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _WelfareHomePageState();
|
||||
}
|
||||
}
|
||||
|
||||
class _WelfareHomePageState extends State<WelfareHomePage>
|
||||
with TickerProviderStateMixin {
|
||||
final tabs = <String>['分享邀请', "应用推荐"];
|
||||
late final TabController _tabController = TabController(
|
||||
initialIndex: widget.index, length: tabs.length, vsync: this);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false, // 不自动显示返回按钮
|
||||
toolbarHeight: 56, // 高度保持默认
|
||||
titleSpacing: 0, // 去除左右空隙
|
||||
title: Row(
|
||||
children: [
|
||||
// 返回按钮
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back_ios),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBar(
|
||||
padding: EdgeInsets.symmetric(horizontal: 0, vertical: 5),
|
||||
isScrollable: false,
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xE5FFFFFF),
|
||||
fontWeight: FontWeight.w400),
|
||||
unselectedLabelStyle:
|
||||
TextStyle(fontSize: 14, color: Color(0x73FFFFFF)),
|
||||
indicator: CustomIndicator(
|
||||
width: 18,
|
||||
height: 4,
|
||||
isGradient: true,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(2),
|
||||
topRight: Radius.circular(2),
|
||||
bottomLeft: Radius.circular(0),
|
||||
bottomRight: Radius.circular(2),
|
||||
),
|
||||
gradientColors: const [Color(0x55F68804), Color(0xffF68804)],
|
||||
offsetY: -8,
|
||||
),
|
||||
controller: _tabController,
|
||||
tabs: tabs.map((it) => Text(it)).toList(),
|
||||
labelPadding: EdgeInsets.symmetric(horizontal: 14, vertical: 2),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 54),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
MineIncomePage().keepAlive,
|
||||
LouFengAdPage().keepAlive,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
/// 签到列表响应模型
|
||||
class CheckinPrizeResp {
|
||||
CheckinInfo? checkin;
|
||||
CheckinConfig? config;
|
||||
List<CheckinPrize>? prizes;
|
||||
List<CheckinPrize>? bigPrizes;
|
||||
|
||||
CheckinPrizeResp({this.checkin, this.config, this.prizes});
|
||||
|
||||
CheckinPrizeResp.fromJson(Map<String, dynamic> json) {
|
||||
checkin = json['checkin'] != null
|
||||
? CheckinInfo.fromJson(json['checkin'])
|
||||
: null;
|
||||
config = json['config'] != null
|
||||
? CheckinConfig.fromJson(json['config'])
|
||||
: null;
|
||||
if (json['prizes'] != null) {
|
||||
prizes = <CheckinPrize>[];
|
||||
json['prizes'].forEach((v) {
|
||||
prizes!.add(CheckinPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['bigPrizes'] != null) {
|
||||
bigPrizes = <CheckinPrize>[];
|
||||
json['bigPrizes'].forEach((v) {
|
||||
bigPrizes!.add(CheckinPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
if (checkin != null) {
|
||||
data['checkin'] = checkin!.toJson();
|
||||
}
|
||||
if (config != null) {
|
||||
data['config'] = config!.toJson();
|
||||
}
|
||||
if (prizes != null) {
|
||||
data['prizes'] = prizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (bigPrizes != null) {
|
||||
data['bigPrizes'] = bigPrizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到信息
|
||||
class CheckinInfo {
|
||||
int? continuouslyDays; // 连续签到天数
|
||||
int? cumulativeDays; // 累计签到天数(本月)
|
||||
bool? todayChecked; // 今日是否已经签过到
|
||||
bool? doubleReward;
|
||||
CheckinInfo({this.continuouslyDays, this.cumulativeDays, this.todayChecked,this.doubleReward});
|
||||
|
||||
CheckinInfo.fromJson(Map<String, dynamic> json) {
|
||||
continuouslyDays = json['continuouslyDays'];
|
||||
cumulativeDays = json['cumulativeDays'];
|
||||
todayChecked = json['todayChecked'];
|
||||
doubleReward=json['doubleReward'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['continuouslyDays'] = continuouslyDays;
|
||||
data['cumulativeDays'] = cumulativeDays;
|
||||
data['todayChecked'] = todayChecked;
|
||||
data['doubleReward']=doubleReward;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到配置
|
||||
class CheckinConfig {
|
||||
String? backgroundImage; // 背景图片
|
||||
String? description; // 规则说明
|
||||
bool? enable; // 是否启用
|
||||
String? rewardBgVideoUrl; //视频
|
||||
List<IntegerExchange>? integerExchangeList;
|
||||
|
||||
CheckinConfig({this.backgroundImage, this.description, this.enable,this.rewardBgVideoUrl});
|
||||
|
||||
CheckinConfig.fromJson(Map<String, dynamic> json) {
|
||||
backgroundImage = json['backgroundImage'];
|
||||
description = json['description'];
|
||||
enable = json['enable'];
|
||||
rewardBgVideoUrl = json['rewardBgVideoUrl'];
|
||||
if (json['integerExchangeList'] != null) {
|
||||
integerExchangeList = <IntegerExchange>[];
|
||||
json['integerExchangeList'].forEach((v) {
|
||||
integerExchangeList!.add(IntegerExchange.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['backgroundImage'] = backgroundImage;
|
||||
data['description'] = description;
|
||||
data['enable'] = enable;
|
||||
data['rewardBgVideoUrl'] = rewardBgVideoUrl;
|
||||
if (integerExchangeList != null) {
|
||||
data['integerExchangeList'] = integerExchangeList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class IntegerExchange{
|
||||
String? name;
|
||||
String? icon;
|
||||
IntegerExchange({this.name, this.icon});
|
||||
IntegerExchange.fromJson(Map<String, dynamic> json) {
|
||||
name = json['name'];
|
||||
icon = json['icon'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['name'] = name;
|
||||
data['icon'] = icon;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
/// 签到奖励
|
||||
class CheckinPrize {
|
||||
bool? bigPrize; // 大奖,有问题提示的
|
||||
int? checkinDays; // 签到天数
|
||||
int? checkinType; // 签到类型 Enum: 0, 1, 2
|
||||
String? createdAt;
|
||||
String? id; // ID
|
||||
String? image; // 图片
|
||||
String? prizeId; // 奖品ID
|
||||
bool? status; // 状态(是否已领取)
|
||||
String? title; // 标题
|
||||
String? updatedAt;
|
||||
int? score; // 签到奖励积分数量
|
||||
String? prizeName;
|
||||
bool? isCheckedIn;
|
||||
bool? canClaim;//是否可以补领
|
||||
bool? isReceive;//是否可以补领
|
||||
bool? isExpired;//是否过期
|
||||
|
||||
CheckinPrize({
|
||||
this.bigPrize,
|
||||
this.checkinDays,
|
||||
this.checkinType,
|
||||
this.createdAt,
|
||||
this.id,
|
||||
this.image,
|
||||
this.prizeId,
|
||||
this.status,
|
||||
this.title,
|
||||
this.updatedAt,
|
||||
this.score,
|
||||
this.prizeName,
|
||||
this.isCheckedIn,
|
||||
this.isReceive,
|
||||
this.canClaim,
|
||||
this.isExpired,
|
||||
});
|
||||
|
||||
CheckinPrize.fromJson(Map<String, dynamic> json) {
|
||||
bigPrize = json['bigPrize'];
|
||||
checkinDays = json['checkinDays'];
|
||||
checkinType = json['checkinType'];
|
||||
createdAt = json['createdAt'];
|
||||
id = json['id'];
|
||||
image = json['image'];
|
||||
prizeId = json['prizeId'];
|
||||
status = json['status'];
|
||||
title = json['title'];
|
||||
updatedAt = json['updatedAt'];
|
||||
score = json['score'];
|
||||
prizeName = json['prizeName'];
|
||||
isCheckedIn = json['isCheckedIn'];
|
||||
canClaim = json['canClaim'];
|
||||
isReceive = json['isReceive'];
|
||||
isExpired = json['isExpired'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['bigPrize'] = bigPrize;
|
||||
data['checkinDays'] = checkinDays;
|
||||
data['checkinType'] = checkinType;
|
||||
data['createdAt'] = createdAt;
|
||||
data['id'] = id;
|
||||
data['image'] = image;
|
||||
data['prizeId'] = prizeId;
|
||||
data['status'] = status;
|
||||
data['title'] = title;
|
||||
data['updatedAt'] = updatedAt;
|
||||
data['score'] = score;
|
||||
data['prizeName'] = prizeName;
|
||||
data['isCheckedIn'] = isCheckedIn;
|
||||
data['canClaim'] = canClaim;
|
||||
data['isReceive'] = isReceive;
|
||||
data['isExpired'] = isExpired;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 执行签到响应
|
||||
class CheckinDoResp {
|
||||
CheckinInfo? checkin;
|
||||
String? message;
|
||||
List<CheckinRewardPrize>? prizes;
|
||||
String? prizeVideo;
|
||||
|
||||
CheckinDoResp({this.checkin, this.message, this.prizes});
|
||||
|
||||
CheckinDoResp.fromJson(Map<String, dynamic> json) {
|
||||
checkin = json['checkin'] != null
|
||||
? CheckinInfo.fromJson(json['checkin'])
|
||||
: null;
|
||||
message = json['message'];
|
||||
prizeVideo = json['prizeVideo'];
|
||||
if (json['prizes'] != null) {
|
||||
prizes = <CheckinRewardPrize>[];
|
||||
json['prizes'].forEach((v) {
|
||||
prizes!.add(CheckinRewardPrize.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
if (checkin != null) {
|
||||
data['checkin'] = checkin!.toJson();
|
||||
}
|
||||
data['message'] = message;
|
||||
data['prizeVideo'] = prizeVideo;
|
||||
if (prizes != null) {
|
||||
data['prizes'] = prizes!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
/// 签到奖励详情
|
||||
class CheckinRewardPrize {
|
||||
bool? countRand;
|
||||
int? prizeCount;
|
||||
String? prizeImage;
|
||||
String? prizeTitle;
|
||||
int? prizeType;
|
||||
|
||||
CheckinRewardPrize({
|
||||
this.countRand,
|
||||
this.prizeCount,
|
||||
this.prizeImage,
|
||||
this.prizeTitle,
|
||||
this.prizeType,
|
||||
});
|
||||
|
||||
CheckinRewardPrize.fromJson(Map<String, dynamic> json) {
|
||||
countRand = json['countRand'];
|
||||
prizeCount = json['prizeCount'];
|
||||
prizeImage = json['prizeImage'];
|
||||
prizeTitle = json['prizeTitle'];
|
||||
prizeType = json['prizeType'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = {};
|
||||
data['countRand'] = countRand;
|
||||
data['prizeCount'] = prizeCount;
|
||||
data['prizeImage'] = prizeImage;
|
||||
data['prizeTitle'] = prizeTitle;
|
||||
data['prizeType'] = prizeType;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/tools_base/widget/net_image_widget.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import 'checkin_model.dart';
|
||||
|
||||
class CongratulationsRewardDialog extends StatelessWidget {
|
||||
final VoidCallback? onExchange;
|
||||
final List<IntegerExchange>? prizeList;
|
||||
// final String? videoUrl;
|
||||
// final String? videoToken;
|
||||
final VideoPlayerController? videoPlayerCtr;
|
||||
const CongratulationsRewardDialog({
|
||||
super.key,
|
||||
this.onExchange,
|
||||
this.prizeList,
|
||||
// this.videoUrl,
|
||||
// this.videoToken,
|
||||
this.videoPlayerCtr,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// 不包 Dialog / 不铺满屏幕 → 点击 content 之外的区域由 Get.dialog 的 barrierDismissible 关闭
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 27),
|
||||
alignment: Alignment.center,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 356,
|
||||
width: 319,
|
||||
child: VideoPlayer(videoPlayerCtr!),
|
||||
),
|
||||
SizedBox(height: 18),
|
||||
Text(
|
||||
"- 积分可兑换以下豪礼 -",
|
||||
style: TextStyle(color: Color(0xffFFD900), fontSize: 14),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
// 奖励列表
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: prizeList
|
||||
?.map((e) => _buildRewardItem(e.name ?? "", e.icon ?? ""))
|
||||
.toList() ??
|
||||
[],
|
||||
),
|
||||
SizedBox(height: 36),
|
||||
// 底部按钮
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
onExchange?.call();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD700), width: 2),
|
||||
),
|
||||
child: Text(
|
||||
"兑换好礼",
|
||||
style: TextStyle(
|
||||
color: const Color(0xFFFFD700),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Text(
|
||||
"继续领积分",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
).paddingSymmetric(horizontal: 33),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRewardItem(String title, String iconPath) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 53,
|
||||
height: 53,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.2),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Colors.white.withValues(alpha: .5), width: 0.5)),
|
||||
padding: EdgeInsets.all(6),
|
||||
child: NetworkImageLoader(imageUrl: iconPath, fit: BoxFit.contain),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
SizedBox(
|
||||
width: 65,
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
|
||||
class CustomProgressBar extends StatelessWidget {
|
||||
final double progress; // 0 ~ 1
|
||||
|
||||
const CustomProgressBar({super.key, required this.progress});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
double width = constraints.maxWidth;
|
||||
return Stack(
|
||||
alignment: Alignment.centerLeft,
|
||||
children: [
|
||||
SizedBox(height: 18),
|
||||
// 背景
|
||||
Container(
|
||||
height: 6,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
|
||||
// 进度
|
||||
Container(
|
||||
height: 6,
|
||||
width: width * progress,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Color(0xffF68804),
|
||||
),
|
||||
),
|
||||
// 小图标(跟随进度,两端不溢出)
|
||||
Positioned(
|
||||
left: (width - 18) * progress,
|
||||
child: Image.asset("ic_sign_indicator.webp".mineImgPath,
|
||||
width: 18, height: 18, fit: BoxFit.cover),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
8.sizeBoxW,
|
||||
// 右侧百分比
|
||||
Text(
|
||||
"${(progress * 100).toInt()}%",
|
||||
style: TextStyle(color: Colors.white, fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/config/address.dart';
|
||||
import 'package:hgdj/hj_page/mine/mine_share/mine_share_page.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/sign_daily_logic.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/checkin_model.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/congratulations_reward_dialog.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/sign_dialog.dart';
|
||||
import 'package:hgdj/hj_page/mine/welfare/widget/sign_in_model.dart';
|
||||
import 'package:hgdj/hj_utils/api_service/mine_service.dart';
|
||||
import 'package:hgdj/tools_base/global_store/store.dart';
|
||||
import 'package:hgdj/tools_base/toast.dart';
|
||||
import 'package:linked_scroll_controller/linked_scroll_controller.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:hgdj/hj_utils/video_view_type.dart';
|
||||
|
||||
/// 每日签到 Logic
|
||||
/// 负责签到列表加载、签到/补领接口、双倍奖励视频播放、跳转积分兑换 Tab
|
||||
class MineSignLogic extends GetxController {
|
||||
/// 父级页面 Logic(用于切 Tab + 滚动到 Tab 位置)
|
||||
final SignDailyPageLogic? parentLogic;
|
||||
MineSignLogic({this.parentLogic});
|
||||
|
||||
// ========== 状态 ==========
|
||||
bool isSigned = false; // 今日是否签到
|
||||
bool doubleReward = false; // 是否触发双倍奖励
|
||||
int continuousDays = 0; // 连续签到天数
|
||||
int cumulativeDays = 0; // 累计签到天数(本月)
|
||||
String? videoUrl; // 双倍奖励视频 ID
|
||||
List<CheckinPrize>? checkList; // 普通签到奖励
|
||||
List<CheckinPrize>? vipCheckList; // 会员签到奖励(大礼)
|
||||
List<IntegerExchange>? prizeLists; // 积分兑换列表
|
||||
final extraRewardList = <ExtraSignRewardItem>[]; // 额外签到奖励
|
||||
|
||||
// ========== 滚动控制器(三排联动) ==========
|
||||
late final LinkedScrollControllerGroup scrollGroup;
|
||||
late final ScrollController titleScrollCtr; // 第 0 排:天数标题
|
||||
late final ScrollController normalScrollCtr; // 第 1 排:普通奖励
|
||||
late final ScrollController vipScrollCtr; // 第 2 排:会员奖励
|
||||
VideoPlayerController? videoPlayerCtr;
|
||||
|
||||
// ========== 生命周期 ==========
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
scrollGroup = LinkedScrollControllerGroup();
|
||||
titleScrollCtr = scrollGroup.addAndGet();
|
||||
normalScrollCtr = scrollGroup.addAndGet();
|
||||
vipScrollCtr = scrollGroup.addAndGet();
|
||||
getSignList();
|
||||
getExtralSignList();
|
||||
}
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
titleScrollCtr.dispose();
|
||||
normalScrollCtr.dispose();
|
||||
vipScrollCtr.dispose();
|
||||
videoPlayerCtr?.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
// ========== 公开方法 ==========
|
||||
|
||||
/// 获取签到主列表(普通 + 会员奖励 + 积分兑换配置)
|
||||
Future<void> getSignList() async {
|
||||
final res = await MineService.getSignList();
|
||||
if (res == null) return;
|
||||
isSigned = res.checkin?.todayChecked ?? false;
|
||||
continuousDays = res.checkin?.continuouslyDays ?? 0;
|
||||
cumulativeDays = res.checkin?.cumulativeDays ?? 0;
|
||||
doubleReward = res.checkin?.doubleReward ?? false;
|
||||
prizeLists = res.config?.integerExchangeList;
|
||||
checkList = res.prizes;
|
||||
vipCheckList = res.bigPrizes;
|
||||
update();
|
||||
}
|
||||
|
||||
/// 获取额外签到奖励列表
|
||||
Future<void> getExtralSignList() async {
|
||||
try {
|
||||
final res = await MineService.getExtraDayMark();
|
||||
if (res != null) {
|
||||
extraRewardList
|
||||
..clear()
|
||||
..addAll(res);
|
||||
update();
|
||||
}
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
/// 点击签到按钮
|
||||
Future<void> doSignIn() async {
|
||||
if (isSigned) {
|
||||
showToast('今日已签到');
|
||||
return;
|
||||
}
|
||||
final res = await MineService.postDayMark();
|
||||
if (res?.checkin == null) return;
|
||||
showToast('签到成功');
|
||||
// 同步签到状态
|
||||
continuousDays = res!.checkin!.continuouslyDays ?? 0;
|
||||
cumulativeDays = res.checkin!.cumulativeDays ?? 0;
|
||||
isSigned = res.checkin!.todayChecked ?? false;
|
||||
doubleReward = res.checkin!.doubleReward ?? false;
|
||||
videoUrl = res.prizeVideo ?? '';
|
||||
getSignList();
|
||||
update();
|
||||
globalStore.refreshWallet();
|
||||
// 第 8 天起仅 toast 不弹窗;前 7 天:双倍奖励弹特效,否则弹普通签到弹窗
|
||||
if (continuousDays > 7) return;
|
||||
if (doubleReward) {
|
||||
_showDoubleRewardDialog();
|
||||
} else {
|
||||
_showNormalSignDialog();
|
||||
}
|
||||
}
|
||||
|
||||
/// 会员奖励补领
|
||||
Future<void> doCheckinClaimVip() async {
|
||||
final resp = await MineService.claimCheckinVip();
|
||||
if (resp?.checkin == null) {
|
||||
showToast(resp?.message ?? '补领失败');
|
||||
return;
|
||||
}
|
||||
showToast(resp?.message ?? '补领成功');
|
||||
continuousDays = resp!.checkin!.continuouslyDays ?? 0;
|
||||
cumulativeDays = resp.checkin!.cumulativeDays ?? 0;
|
||||
isSigned = resp.checkin!.todayChecked ?? false;
|
||||
doubleReward = resp.checkin!.doubleReward ?? false;
|
||||
videoUrl = resp.prizeVideo ?? '';
|
||||
update();
|
||||
await getSignList();
|
||||
globalStore.refreshWallet();
|
||||
}
|
||||
|
||||
/// 补签:调用接口 + 弹"邀请分享"引导弹窗
|
||||
Future<void> doResign(SignInListItem item) async {
|
||||
await MineService.postReSign(item.id ?? '');
|
||||
Get.dialog(
|
||||
_ResignGuideDialog(
|
||||
onConfirm: () {
|
||||
Get.back();
|
||||
Get.to(() => MineSharePage());
|
||||
},
|
||||
onCancel: Get.back,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 切到"积分兑换" Tab,并把页面滚到 Tab 栏刚好贴在 AppBar 下方
|
||||
void gotoExchangeTab() {
|
||||
final parent = parentLogic;
|
||||
if (parent == null) return;
|
||||
parent.tabCtr.animateTo(1);
|
||||
// 等一帧让弹窗 dismiss 后 layout 稳定,再算位置
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => _scrollTabKeyBelowAppBar());
|
||||
}
|
||||
|
||||
/// 让 parent.tabKey 对应的 widget 滚到 AppBar 下沿
|
||||
void _scrollTabKeyBelowAppBar() {
|
||||
final parent = parentLogic;
|
||||
if (parent == null || !parent.outerCtr.hasClients) return;
|
||||
final ctx = parent.tabKey.currentContext;
|
||||
if (ctx == null) return;
|
||||
final box = ctx.findRenderObject() as RenderBox?;
|
||||
if (box == null || !box.attached) return;
|
||||
// tabKey widget 当前在屏幕中的 Y 坐标
|
||||
final dy = box.localToGlobal(Offset.zero).dy;
|
||||
// AppBar 总高度 = 状态栏 + 工具栏
|
||||
final appBarHeight = MediaQuery.of(ctx).padding.top + kToolbarHeight;
|
||||
// 目标偏移 = 当前偏移 + (widget 屏幕 Y - AppBar 高度)
|
||||
// 滚完后 widget 顶端正好贴 AppBar 底部
|
||||
final target = (parent.outerCtr.offset + dy - appBarHeight).clamp(
|
||||
0.0,
|
||||
parent.outerCtr.position.maxScrollExtent,
|
||||
);
|
||||
parent.outerCtr.animateTo(
|
||||
target,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
}
|
||||
|
||||
// ========== 私有方法 ==========
|
||||
|
||||
/// 弹双倍奖励特效弹窗(视频循环播放)
|
||||
/// 弹窗关闭后会自动暂停并释放 videoPlayerCtr,避免后台仍在播放
|
||||
void _showDoubleRewardDialog() async {
|
||||
videoPlayerCtr?.dispose();
|
||||
final ctr = PlayerFactory.network(
|
||||
'${Address.baseApiPath}/vid/h5/m3u8/$videoUrl?token=${Address.token}&c=${Address.cdnAddress}');
|
||||
videoPlayerCtr = ctr;
|
||||
final dialogFuture = Get.dialog(
|
||||
CongratulationsRewardDialog(
|
||||
onExchange: gotoExchangeTab,
|
||||
prizeList: prizeLists,
|
||||
videoPlayerCtr: ctr,
|
||||
),
|
||||
);
|
||||
try {
|
||||
await ctr.initialize();
|
||||
await ctr.setLooping(true);
|
||||
await ctr.play();
|
||||
} catch (e) {
|
||||
// 弹窗已用此 ctr 构建,无法换 view 重试,仅内存切换;落本地由后续成功播放的播放器确认
|
||||
if (isDecoderError(e)) switchToPlatformView();
|
||||
}
|
||||
// 等弹窗 dismiss(点击关闭/兑换/外部点击/back 都会触发)
|
||||
await dialogFuture;
|
||||
await ctr.pause();
|
||||
await ctr.dispose();
|
||||
// 防止与下次双倍奖励的新实例冲突
|
||||
if (identical(videoPlayerCtr, ctr)) videoPlayerCtr = null;
|
||||
}
|
||||
|
||||
/// 弹普通签到弹窗
|
||||
void _showNormalSignDialog() {
|
||||
Get.dialog(
|
||||
SignInDialog(
|
||||
signInList: checkList,
|
||||
continuousDays: continuousDays,
|
||||
prizeList: prizeLists,
|
||||
callback: gotoExchangeTab,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 补签引导弹窗(私有给 Logic 用)
|
||||
class _ResignGuideDialog extends StatelessWidget {
|
||||
final VoidCallback onConfirm;
|
||||
final VoidCallback onCancel;
|
||||
const _ResignGuideDialog({required this.onConfirm, required this.onCancel});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 300,
|
||||
margin: const EdgeInsets.only(left: 32, right: 32, bottom: 100),
|
||||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 30),
|
||||
padding: const EdgeInsets.fromLTRB(24, 100, 24, 24),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage('icon_resign_bg.webp'.mineImgPath),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(height: 260),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _btn(onCancel, '离开', isPrimary: false)),
|
||||
const SizedBox(width: 16),
|
||||
Expanded(
|
||||
child: _btn(onConfirm, '立即邀请', isPrimary: true)),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 10,
|
||||
child: GestureDetector(
|
||||
onTap: onCancel,
|
||||
child: Image.asset('icon_resign_close.png'.mineImgPath,
|
||||
width: 30, height: 30),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _btn(VoidCallback onTap, String text, {required bool isPrimary}) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
height: 50,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: isPrimary ? null : Colors.white.withValues(alpha: 0.8),
|
||||
gradient: isPrimary
|
||||
? const LinearGradient(
|
||||
colors: [Color(0xFFF68804), Color(0xFFF68804)],
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
)
|
||||
: null,
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
border: isPrimary
|
||||
? null
|
||||
: Border.all(color: const Color(0xFFB7B7B7), width: 1),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: isPrimary ? Colors.white : const Color(0xFF666666),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hgdj/hj_model/mine/happy/happy_model.dart';
|
||||
import 'package:hgdj/hj_model/splash/ads_model.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
import 'package:hgdj/tools_base/banner/ads_banner_widget.dart';
|
||||
|
||||
import '../../../../tools_base/banner/ads_item.dart';
|
||||
|
||||
class RecommendAppPage extends StatelessWidget {
|
||||
final AdTabConfig model;
|
||||
|
||||
const RecommendAppPage(this.model, {super.key});
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return CustomScrollView(
|
||||
slivers: [
|
||||
if (model.bannerAds?.isNotEmpty ?? false)
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.only(left: 16, right: 16, top: 12),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 343 / 143,
|
||||
child: AdsBannerWidget(
|
||||
model.bannerAds ?? [],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (model.hengAds != null)
|
||||
SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: _buildNormalTitle(model.hengAds?.title ?? ''),
|
||||
),
|
||||
SliverToBoxAdapter(
|
||||
child: 10.sizeBoxH,
|
||||
),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverGrid.builder(
|
||||
itemCount: model.hengAds?.items?.length,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 5,
|
||||
crossAxisSpacing: 2,
|
||||
mainAxisSpacing: 10,
|
||||
childAspectRatio: 82 / 105,
|
||||
),
|
||||
itemBuilder: (_, index) =>
|
||||
_buildVItem(model.hengAds!.items![index], index)),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (model.shuAds != null)
|
||||
SliverMainAxisGroup(
|
||||
slivers: [
|
||||
SliverToBoxAdapter(
|
||||
child: _buildNormalTitle(model.shuAds?.title ?? ''),
|
||||
),
|
||||
SliverPadding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
sliver: SliverList.separated(
|
||||
itemCount: model.shuAds?.items?.length ?? 0,
|
||||
separatorBuilder: (_, __) =>
|
||||
model.shuAds?.title == '热门推荐' ? 10.sizeBoxH : 1.line,
|
||||
itemBuilder: (_, index) {
|
||||
final info = model.shuAds!.items![index];
|
||||
if (model.shuAds?.title == '热门推荐')
|
||||
return _buildHBItem(info, index);
|
||||
return _buildHItem(info, index);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNormalTitle(String title) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
|
||||
child: Row(
|
||||
children: [
|
||||
15.sizeBoxW,
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 16.0,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 竖版的广告
|
||||
_buildVItem(AdsInfoModel item, int index) {
|
||||
return AdsItem(
|
||||
adInfo: item,
|
||||
clickType: 0,
|
||||
);
|
||||
}
|
||||
|
||||
_buildHItem(AdsInfoModel item, int index) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
12.sizeBoxH,
|
||||
AdsItem(
|
||||
adInfo: item,
|
||||
showType: AdShowType.hor,
|
||||
clickType: 0,
|
||||
),
|
||||
12.sizeBoxH,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_buildHBItem(AdsInfoModel item, int index) {
|
||||
return AdsItem(
|
||||
adInfo: item,
|
||||
showType: AdShowType.vImgText,
|
||||
clickType: 0,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,287 @@
|
||||
import 'package:easy_rich_text/easy_rich_text.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:hgdj/assets_tool/images.dart';
|
||||
import 'package:hgdj/hj_utils/screen.dart';
|
||||
|
||||
import '../../../../tools_base/widget/net_image_widget.dart';
|
||||
import 'checkin_model.dart';
|
||||
|
||||
class SignInDialog extends StatelessWidget {
|
||||
final List<CheckinPrize>? signInList; // 签到日历数据
|
||||
final int? continuousDays; // 连续签到天数
|
||||
final Function? callback;
|
||||
final List<IntegerExchange>? prizeList;
|
||||
|
||||
SignInDialog(
|
||||
{super.key,
|
||||
this.signInList,
|
||||
this.continuousDays,
|
||||
this.callback,
|
||||
this.prizeList});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
insetPadding: EdgeInsets.symmetric(horizontal: 30),
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 12, right: 12, top: 12, bottom: 40),
|
||||
margin: EdgeInsets.only(top: 50),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: Color(0xff0F0F0F),
|
||||
border: Border.all(width: 1, color: Color(0xffFFE7B4))),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 描述
|
||||
EasyRichText(
|
||||
'已连续签到 $continuousDays 天,第7天有惊喜好礼相送!',
|
||||
defaultStyle: TextStyle(color: Colors.white, fontSize: 14),
|
||||
patternList: [
|
||||
EasyRichTextPattern(
|
||||
stringBeforeTarget: '已连续签到 ',
|
||||
targetString: '$continuousDays',
|
||||
style: TextStyle(color: Color(0xffFFDA0B), fontSize: 14),
|
||||
),
|
||||
EasyRichTextPattern(
|
||||
targetString: '第7天有惊喜好礼相送!',
|
||||
style: TextStyle(color: Color(0xffFFDA0B), fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
12.sizeBoxH,
|
||||
Divider(height: 1, color: Colors.white.withValues(alpha: .1)),
|
||||
12.sizeBoxH,
|
||||
// Grid 奖励
|
||||
_buildGrid(),
|
||||
13.sizeBoxH,
|
||||
Container(
|
||||
padding: EdgeInsets.all(12),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900).withValues(alpha: .1),
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
"- 积分可兑换以下豪礼 -",
|
||||
style: TextStyle(
|
||||
color: Color(0xffFFD900),
|
||||
fontSize: 12,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 12),
|
||||
// 奖励列表
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: prizeList
|
||||
?.map((e) => _buildRewardItem(
|
||||
e.name ?? "", e.icon ?? ""))
|
||||
.toList() ??
|
||||
[],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: 24),
|
||||
// 按钮
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
callback?.call();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(
|
||||
color: const Color(0xFFFFD700), width: 2),
|
||||
),
|
||||
child: Text(
|
||||
"兑换好礼",
|
||||
style: TextStyle(
|
||||
color: const Color(0xFFFFD700),
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Get.back();
|
||||
},
|
||||
child: Container(
|
||||
height: 44,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffFFD900),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
),
|
||||
child: Text(
|
||||
"继续领积分",
|
||||
style: TextStyle(
|
||||
color: Colors.black,
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Image.asset('sign_take_top.webp'.mineImgPath,
|
||||
height: 30, fit: BoxFit.contain)),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// =========================
|
||||
// Grid
|
||||
// =========================
|
||||
Widget _buildGrid() {
|
||||
final list = signInList?.take(6).toList() ?? [];
|
||||
return Container(
|
||||
height: 68,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .05),
|
||||
borderRadius: BorderRadius.circular(20)),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const ScrollPhysics(),
|
||||
itemCount: list.length,
|
||||
padding: EdgeInsets.zero,
|
||||
itemBuilder: (_, i) {
|
||||
final item = list[i];
|
||||
return _buildItem(item, i);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// =========================
|
||||
// 单个格子
|
||||
// =========================
|
||||
Widget _buildItem(CheckinPrize item, int index) {
|
||||
final isSigned = (continuousDays ?? 0) > index;
|
||||
bool active = continuousDays == index;
|
||||
return Container(
|
||||
margin: EdgeInsets.only(right: 7),
|
||||
width: 42,
|
||||
height: 68,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: Colors.white.withValues(alpha: .1),
|
||||
border: active
|
||||
? Border.all(color: const Color(0xffFFDA0B), width: 0.5)
|
||||
: null,
|
||||
),
|
||||
// padding: EdgeInsets.all(5),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
(item.image != null && item.image!.isNotEmpty)
|
||||
? ColorFiltered(
|
||||
colorFilter: isSigned == true
|
||||
? ColorFilter.matrix([
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0.2126,
|
||||
0.7152,
|
||||
0.0722,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
])
|
||||
: ColorFilter.mode(
|
||||
Colors.transparent, BlendMode.multiply),
|
||||
child: NetworkImageLoader(
|
||||
imageUrl: item.image!,
|
||||
width: 34,
|
||||
height: 34,
|
||||
fit: BoxFit.contain))
|
||||
: Image.asset(
|
||||
isSigned == true
|
||||
? 'checked_in_coin.webp'.mineImgPath
|
||||
: 'check_in_coin.webp'.mineImgPath,
|
||||
width: 34,
|
||||
height: 34,
|
||||
fit: BoxFit.cover),
|
||||
Text(
|
||||
item.prizeName ?? '',
|
||||
style: TextStyle(
|
||||
color: isSigned == true ? Colors.white : Color(0xffFFD900),
|
||||
fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildRewardItem(String title, String iconPath) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 53,
|
||||
height: 53,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: .05),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: Colors.white.withValues(alpha: .2), width: 0.5)),
|
||||
padding: EdgeInsets.all(6),
|
||||
child: NetworkImageLoader(imageUrl: iconPath, fit: BoxFit.contain),
|
||||
),
|
||||
SizedBox(height: 6),
|
||||
SizedBox(
|
||||
width: 60,
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
class SignInModel {
|
||||
final int? consecutiveSignDays;
|
||||
final List<SignInListItem>? list;
|
||||
final List<int>? reSign;
|
||||
final int? remainDay;
|
||||
final int? reSignPrice;
|
||||
final int? today;
|
||||
final int? value;
|
||||
final bool? isSign;
|
||||
// final Prize? signPrize;
|
||||
|
||||
SignInModel({
|
||||
this.consecutiveSignDays,
|
||||
this.list,
|
||||
this.remainDay,
|
||||
this.reSignPrice,
|
||||
this.value,
|
||||
this.reSign,
|
||||
this.isSign,
|
||||
this.today,
|
||||
// this.signPrize,
|
||||
});
|
||||
|
||||
factory SignInModel.fromJson(Map<String, dynamic> json) => SignInModel(
|
||||
consecutiveSignDays: json["consecutiveSignDays"],
|
||||
list:
|
||||
json["list"] == null ? [] : List<SignInListItem>.from(json["list"]!.map((x) => SignInListItem.fromJson(x))),
|
||||
reSign: json["reSign"] == null ? [] : List<int>.from(json["reSign"]!.map((x) => x)),
|
||||
remainDay: json["remainDay"],
|
||||
reSignPrice: json["reSignPrice"],
|
||||
value: json["value"],
|
||||
isSign: json["isSign"],
|
||||
today: json["today"],
|
||||
// signPrize: Prize.fromJson(json['signPrize']),
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"consecutiveSignDays": consecutiveSignDays,
|
||||
"list": list == null ? [] : List<dynamic>.from(list!.map((x) => x.toJson())),
|
||||
"reSign": reSign,
|
||||
"reSignPrice": reSignPrice,
|
||||
"remainDay": remainDay,
|
||||
"value": value,
|
||||
"isSign": isSign,
|
||||
"today": today,
|
||||
// "signPrize": signPrize?.toJson(),
|
||||
};
|
||||
}
|
||||
|
||||
class SignInListItem {
|
||||
final int? boonType;
|
||||
final String? desc;
|
||||
final int? finishCondition;
|
||||
final int? finishValue;
|
||||
final String? id;
|
||||
final List<Prize>? prizes;
|
||||
int? status; //任务状态 1:未完成 2:已完成 3:已领取 4:补签
|
||||
final String? title;
|
||||
final String? name;
|
||||
final String? prizeId;
|
||||
bool? isToday;
|
||||
|
||||
SignInListItem({
|
||||
this.boonType,
|
||||
this.desc,
|
||||
this.finishCondition,
|
||||
this.finishValue,
|
||||
this.id,
|
||||
this.prizes,
|
||||
this.status,
|
||||
this.title,
|
||||
this.prizeId,
|
||||
this.isToday,
|
||||
this.name,
|
||||
});
|
||||
|
||||
factory SignInListItem.fromJson(Map<String, dynamic> json) => SignInListItem(
|
||||
boonType: json["boonType"],
|
||||
desc: json["desc"],
|
||||
finishCondition: json["finishCondition"],
|
||||
finishValue: json["finishValue"],
|
||||
id: json["id"],
|
||||
prizes: json["prizes"] == null ? [] : List<Prize>.from(json["prizes"]!.map((x) => Prize.fromJson(x))),
|
||||
status: json["status"],
|
||||
isToday: json["isToday"],
|
||||
title: json["title"],
|
||||
prizeId: json["prizeId"],
|
||||
name: json["name"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"boonType": boonType,
|
||||
"desc": desc,
|
||||
"finishCondition": finishCondition,
|
||||
"finishValue": finishValue,
|
||||
"id": id,
|
||||
"prizes": prizes == null ? [] : List<dynamic>.from(prizes!.map((x) => x.toJson())),
|
||||
"status": status,
|
||||
"title": title,
|
||||
"prizeId": prizeId,
|
||||
"name": name,
|
||||
};
|
||||
}
|
||||
|
||||
class Prize {
|
||||
final String? activityId;
|
||||
final int? count;
|
||||
final String? createTimt;
|
||||
final String? desc;
|
||||
final String? id;
|
||||
final String? image;
|
||||
final int? level;
|
||||
final String? name;
|
||||
final int? price;
|
||||
final int? sort;
|
||||
final bool? status;
|
||||
final int? type;
|
||||
final String? updateTime;
|
||||
final int? validityTime;
|
||||
final int? value;
|
||||
final String? vipCardId;
|
||||
final String? weights;
|
||||
|
||||
Prize({
|
||||
this.activityId,
|
||||
this.count,
|
||||
this.createTimt,
|
||||
this.desc,
|
||||
this.id,
|
||||
this.image,
|
||||
this.level,
|
||||
this.name,
|
||||
this.price,
|
||||
this.sort,
|
||||
this.status,
|
||||
this.type,
|
||||
this.updateTime,
|
||||
this.validityTime,
|
||||
this.value,
|
||||
this.vipCardId,
|
||||
this.weights,
|
||||
});
|
||||
|
||||
factory Prize.fromJson(Map<String, dynamic> json) => Prize(
|
||||
activityId: json["activityId"],
|
||||
count: json["count"],
|
||||
createTimt: json["createTimt"],
|
||||
desc: json["desc"],
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
level: json["level"],
|
||||
name: json["name"],
|
||||
price: json["price"],
|
||||
sort: json["sort"],
|
||||
status: json["status"],
|
||||
type: json["type"],
|
||||
updateTime: json["updateTime"],
|
||||
validityTime: json["validityTime"],
|
||||
value: json["value"],
|
||||
vipCardId: json["vipCardId"],
|
||||
weights: json["weights"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"activityId": activityId,
|
||||
"count": count,
|
||||
"createTimt": createTimt,
|
||||
"desc": desc,
|
||||
"id": id,
|
||||
"image": image,
|
||||
"level": level,
|
||||
"name": name,
|
||||
"price": price,
|
||||
"sort": sort,
|
||||
"status": status,
|
||||
"type": type,
|
||||
"updateTime": updateTime,
|
||||
"validityTime": validityTime,
|
||||
"value": value,
|
||||
"vipCardId": vipCardId,
|
||||
"weights": weights,
|
||||
};
|
||||
}
|
||||
|
||||
class ExtraSignRewardItem {
|
||||
final String? activityId;
|
||||
final int? count;
|
||||
final String? createTimt;
|
||||
final String? desc;
|
||||
final bool? extraPrizeStatus; // 是否已领取额外奖励
|
||||
final int? finishCondition; // 完成条件(需要签到的天数)
|
||||
final String? id;
|
||||
final String? image;
|
||||
final int? level;
|
||||
final String? name;
|
||||
final int? price;
|
||||
final int? sort;
|
||||
final bool? status;
|
||||
final int? type;
|
||||
final String? updateTime;
|
||||
final int? validityTime;
|
||||
final int? value;
|
||||
final String? vipCardId;
|
||||
final String? weights;
|
||||
|
||||
ExtraSignRewardItem({
|
||||
this.activityId,
|
||||
this.count,
|
||||
this.createTimt,
|
||||
this.desc,
|
||||
this.extraPrizeStatus,
|
||||
this.finishCondition,
|
||||
this.id,
|
||||
this.image,
|
||||
this.level,
|
||||
this.name,
|
||||
this.price,
|
||||
this.sort,
|
||||
this.status,
|
||||
this.type,
|
||||
this.updateTime,
|
||||
this.validityTime,
|
||||
this.value,
|
||||
this.vipCardId,
|
||||
this.weights,
|
||||
});
|
||||
|
||||
factory ExtraSignRewardItem.fromJson(Map<String, dynamic> json) => ExtraSignRewardItem(
|
||||
activityId: json["activityId"],
|
||||
count: json["count"],
|
||||
createTimt: json["createTimt"],
|
||||
desc: json["desc"],
|
||||
extraPrizeStatus: json["extraPrizeStatus"],
|
||||
finishCondition: json["finishCondition"],
|
||||
id: json["id"],
|
||||
image: json["image"],
|
||||
level: json["level"],
|
||||
name: json["name"],
|
||||
price: json["price"],
|
||||
sort: json["sort"],
|
||||
status: json["status"],
|
||||
type: json["type"],
|
||||
updateTime: json["updateTime"],
|
||||
validityTime: json["validityTime"],
|
||||
value: json["value"],
|
||||
vipCardId: json["vipCardId"],
|
||||
weights: json["weights"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"activityId": activityId,
|
||||
"count": count,
|
||||
"createTimt": createTimt,
|
||||
"desc": desc,
|
||||
"extraPrizeStatus": extraPrizeStatus,
|
||||
"finishCondition": finishCondition,
|
||||
"id": id,
|
||||
"image": image,
|
||||
"level": level,
|
||||
"name": name,
|
||||
"price": price,
|
||||
"sort": sort,
|
||||
"status": status,
|
||||
"type": type,
|
||||
"updateTime": updateTime,
|
||||
"validityTime": validityTime,
|
||||
"value": value,
|
||||
"vipCardId": vipCardId,
|
||||
"weights": weights,
|
||||
};
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user