diff --git a/assets/home_coins_bg.png b/assets/home_coins_bg.png new file mode 100644 index 0000000..01f4bf5 Binary files /dev/null and b/assets/home_coins_bg.png differ diff --git a/assets/home_coins_btn.png b/assets/home_coins_btn.png new file mode 100644 index 0000000..79f18f6 Binary files /dev/null and b/assets/home_coins_btn.png differ diff --git a/assets/home_coins_close.png b/assets/home_coins_close.png new file mode 100644 index 0000000..0aa0aab Binary files /dev/null and b/assets/home_coins_close.png differ diff --git a/assets/home_coins_right.png b/assets/home_coins_right.png new file mode 100644 index 0000000..56236d5 Binary files /dev/null and b/assets/home_coins_right.png differ diff --git a/assets/home_coins_right_btn.png b/assets/home_coins_right_btn.png new file mode 100644 index 0000000..4123b6d Binary files /dev/null and b/assets/home_coins_right_btn.png differ diff --git a/lib/dio_cilent/kt_apis.dart b/lib/dio_cilent/kt_apis.dart index a6ffdc8..f139bd8 100644 --- a/lib/dio_cilent/kt_apis.dart +++ b/lib/dio_cilent/kt_apis.dart @@ -51,7 +51,11 @@ 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"; static const String getCustomerBuyRecords = "/getCustomerBuyRecords"; diff --git a/lib/kt_pages/kt_home/logic.dart b/lib/kt_pages/kt_home/logic.dart index 9883516..ce593f3 100644 --- a/lib/kt_pages/kt_home/logic.dart +++ b/lib/kt_pages/kt_home/logic.dart @@ -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), + ), + ], + ), + ); + } + } + } } diff --git a/lib/kt_pages/kt_home/view.dart b/lib/kt_pages/kt_home/view.dart index cbb9a0a..5365c67 100644 --- a/lib/kt_pages/kt_home/view.dart +++ b/lib/kt_pages/kt_home/view.dart @@ -66,6 +66,44 @@ class _KtHomePageState extends State ), ), ), + 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( diff --git a/lib/kt_pages/kt_routes.dart b/lib/kt_pages/kt_routes.dart index 64e6f8b..97ce1c2 100644 --- a/lib/kt_pages/kt_routes.dart +++ b/lib/kt_pages/kt_routes.dart @@ -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()), ]; }