feat:首页金币包弹框

This commit is contained in:
pengtao 2025-10-15 15:53:36 +08:00
parent 1cca41b1de
commit 191c7fa58d
9 changed files with 146 additions and 2 deletions

BIN
assets/home_coins_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 KiB

BIN
assets/home_coins_btn.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
assets/home_coins_close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/home_coins_right.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -51,6 +51,10 @@ class KtApis {
static const String createGooglePay = "/googlePaid";
static const String buyVideo = "/buy_video";
static const String openNotify = "/openNotify";
static const String getReceiveDayCoin = "/getReceiveDayCoin";
static const String receiveDayCoin = "/receiveDayCoin";
static const String getReceiveDayCoinInfo = "/getReceiveDayCoinInfo";
static const String getRetainVipPaySetting = "/getRetainVipPaySetting";
///
static const String getCustomerOrder = "/getCustomerOrder";

View File

@ -1,5 +1,7 @@
import 'package:easy_refresh/easy_refresh.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_kinetra/kt_utils/kt_string_extend.dart';
import 'package:flutter_kinetra/kt_model/kt_home_category_bean.dart';
import 'package:flutter_kinetra/kt_pages/kt_home/state.dart';
import 'package:get/get.dart';
@ -8,6 +10,7 @@ import '../../dio_cilent/kt_apis.dart';
import '../../dio_cilent/kt_request.dart';
import '../../kt_model/kt_short_video_bean.dart';
import '../../kt_widgets/kt_status_widget.dart';
import '../kt_routes.dart';
class KtHomeLogic extends GetxController {
final state = KtHomeState();
@ -21,6 +24,7 @@ class KtHomeLogic extends GetxController {
void onReady() {
super.onReady();
refreshData();
getReceiveDayCoin();
}
refreshData() {
@ -178,4 +182,101 @@ class KtHomeLogic extends GetxController {
update();
}
}
getReceiveDayCoin() async {
ApiResponse res = await KtHttpClient().request(
KtApis.getReceiveDayCoin,
method: HttpMethod.get,
);
if (res.success) {
state.receiveCoin = res.data['coins'];
state.hasSubCoin = res.data['is_exist_sub'] == 1 && state.receiveCoin > 0;
if (state.hasSubCoin) {
Get.dialog(
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 301.w,
height: 260.w,
padding: EdgeInsets.only(top: 140.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('home_coins_bg.png'.ktIcon),
fit: BoxFit.fill,
),
),
child: Column(
children: [
Text(
'Daily Reward',
style: TextStyle(
color: Color(0xFFFF4306),
fontSize: 22.sp,
fontWeight: FontWeight.w900,
),
),
Text(
'is waiting!',
style: TextStyle(
color: Colors.black,
fontSize: 20.sp,
fontWeight: FontWeight.w700,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('ic_coin.png'.ktIcon, width: 28.w),
SizedBox(width: 4.w),
Text(
'+${state.receiveCoin}',
style: TextStyle(
color: Color(0xFFFF9500),
fontSize: 22.sp,
fontWeight: FontWeight.w700,
),
),
],
),
],
),
),
GestureDetector(
onTap: () {
Get.back();
Get.toNamed(KtRoutes.refill);
},
child: Container(
width: 200.w,
height: 50.w,
margin: EdgeInsets.only(bottom: 12.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('home_coins_btn.png'.ktIcon),
fit: BoxFit.fill,
),
),
child: Center(
child: Text(
'Claim Now',
style: TextStyle(
color: Colors.white,
fontSize: 18.sp,
fontWeight: FontWeight.w700,
),
),
),
),
),
GestureDetector(
onTap: () => Get.back(),
child: Image.asset('home_coins_close.png'.ktIcon, width: 24.w),
),
],
),
);
}
}
}
}

View File

@ -66,6 +66,44 @@ class _KtHomePageState extends State<KtHomePage>
),
),
),
Positioned(
bottom: 90.w,
right: 0,
child: GestureDetector(
onTap: () => Get.toNamed(KtRoutes.refill),
child: Stack(
children: [
Image.asset(
'home_coins_right.png'.ktIcon,
width: 100.w,
height: 69.w,
),
Container(
width: 84.w,
height: 22.w,
margin: EdgeInsets.only(top: 54.w, left: 8.w),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('home_coins_right_btn.png'.ktIcon),
fit: BoxFit.fill,
),
),
child: Center(
child: Text(
'Daily Coins',
style: TextStyle(
color: Colors.white,
fontSize: 12.sp,
fontWeight: FontWeight.w800,
),
),
),
),
],
),
),
),
//
if (state.showVideo && state.curVideo != null)
Positioned(

View File

@ -11,7 +11,7 @@ import 'kt_mine/kt_store/view.dart';
import 'kt_short_video/view.dart';
import 'kt_splash_page.dart';
import 'kt_webview_page.dart';
import 'kt_refill/view.dart';
///
class KtRoutes {
static const String splash = '/';
@ -52,5 +52,6 @@ class KtRoutes {
name: webView,
page: () => const KtWebViewPage(url: 'url'),
),
GetPage(name: refill, page: () => const KtRefillPage()),
];
}