|
|
@@ -2,9 +2,11 @@ import 'dart:async';
|
|
|
import 'dart:convert';
|
|
|
|
|
|
import 'package:bbyyy/beans/coupon_bean_entity.dart';
|
|
|
+import 'package:bbyyy/beans/grab_a_red_envelope_bean_entity.dart';
|
|
|
import 'package:bbyyy/beans/user_bean_entity.dart';
|
|
|
import 'package:bbyyy/https/MyDio.dart';
|
|
|
import 'package:bbyyy/https/my_request.dart';
|
|
|
+import 'package:bbyyy/my_tools/daily_red_packet/daily_red_packet.dart';
|
|
|
import 'package:bbyyy/my_tools/dims.dart';
|
|
|
import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
|
|
|
import 'package:bbyyy/my_tools/event_bus.dart';
|
|
|
@@ -17,8 +19,10 @@ import 'package:bbyyy/my_tools/pop_up_queue.dart';
|
|
|
import 'package:bbyyy/nsq/nsq.dart' as Nsq;
|
|
|
import 'package:bbyyy/paegs/gang_page/gang_page.dart';
|
|
|
import 'package:bbyyy/paegs/home_page/home_page.dart';
|
|
|
+import 'package:bbyyy/paegs/mine_page/bind_alipay_page/bind_alipay_page.dart';
|
|
|
import 'package:bbyyy/paegs/mine_page/mine_page.dart';
|
|
|
import 'package:bbyyy/paegs/mine_page/order_page/order_page.dart';
|
|
|
+import 'package:bbyyy/paegs/mine_page/wallet_page/withdraw_page/withdraw_page.dart';
|
|
|
import 'package:bbyyy/paegs/msg_page/msg_page.dart';
|
|
|
import 'package:bbyyy/paegs/root_page/root_page_view.dart';
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
@@ -76,7 +80,8 @@ class _RootPageState extends State<RootPage> {
|
|
|
queryPersonalInformation();
|
|
|
checkForUpdates(context);
|
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
|
- checkCouponEvent();
|
|
|
+ // checkCouponEvent();
|
|
|
+ DailyRedPacketTool().queryRedEnvelopeInformation();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -194,22 +199,22 @@ class _RootPageState extends State<RootPage> {
|
|
|
}
|
|
|
|
|
|
//查询优惠券活动
|
|
|
- checkCouponEvent() {
|
|
|
- MyDio().query({
|
|
|
- "key": "coupon_distribute",
|
|
|
- "filters": {
|
|
|
- "conditions": ["valid==true"],
|
|
|
- },
|
|
|
- "dims": couponDistributeDims,
|
|
|
- "paging": [1, 100]
|
|
|
- }, (response, hasError) {
|
|
|
- if (!hasError) {
|
|
|
- CouponBeanEntity entity =
|
|
|
- CouponBeanEntity().fromJson(json.decode(response.data.toString()));
|
|
|
- PopUpQueue().coupon.addAll(entity.data.data);
|
|
|
- }
|
|
|
- }, (error) {});
|
|
|
- }
|
|
|
+ // checkCouponEvent() {
|
|
|
+ // MyDio().query({
|
|
|
+ // "key": "coupon_distribute",
|
|
|
+ // "filters": {
|
|
|
+ // "conditions": ["valid==true"],
|
|
|
+ // },
|
|
|
+ // "dims": couponDistributeDims,
|
|
|
+ // "paging": [1, 100]
|
|
|
+ // }, (response, hasError) {
|
|
|
+ // if (!hasError) {
|
|
|
+ // CouponBeanEntity entity =
|
|
|
+ // CouponBeanEntity().fromJson(json.decode(response.data.toString()));
|
|
|
+ // PopUpQueue().coupon.addAll(entity.data.data);
|
|
|
+ // }
|
|
|
+ // }, (error) {});
|
|
|
+ // }
|
|
|
|
|
|
int showWitch = 0;
|
|
|
|
|
|
@@ -220,36 +225,39 @@ class _RootPageState extends State<RootPage> {
|
|
|
barrierDismissible: false,
|
|
|
// false = user must tap button, true = tap outside dialog
|
|
|
builder: (BuildContext dialogContext) {
|
|
|
- return StatefulBuilder(builder: (BuildContext context, void Function(void Function()) setState) {
|
|
|
- return Container(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- showRedEnvelope(setState),
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- showWitch = 0;
|
|
|
- Navigator.pop(context);
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- margin: EdgeInsets.only(top: 24 * ppx),
|
|
|
- child: Icon(
|
|
|
- Icons.clear,
|
|
|
- color: Colors.white,
|
|
|
+ return StatefulBuilder(
|
|
|
+ builder:
|
|
|
+ (BuildContext context, void Function(void Function()) setState) {
|
|
|
+ return Container(
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ showRedEnvelope(setState),
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ showWitch = 0;
|
|
|
+ Navigator.pop(context);
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ margin: EdgeInsets.only(top: 24 * ppx),
|
|
|
+ child: Icon(
|
|
|
+ Icons.clear,
|
|
|
+ color: Colors.white,
|
|
|
+ ),
|
|
|
+ height: 28 * ppx,
|
|
|
+ width: 28 * ppx,
|
|
|
+ alignment: Alignment.center,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: MyColors.c25E7E7E7,
|
|
|
+ borderRadius: BorderRadius.circular(14 * ppx)),
|
|
|
),
|
|
|
- height: 28 * ppx,
|
|
|
- width: 28 * ppx,
|
|
|
- alignment: Alignment.center,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: MyColors.c25E7E7E7,
|
|
|
- borderRadius: BorderRadius.circular(14 * ppx)),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- ),
|
|
|
- alignment: Alignment.center,
|
|
|
- );
|
|
|
- },);
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ ),
|
|
|
+ alignment: Alignment.center,
|
|
|
+ );
|
|
|
+ },
|
|
|
+ );
|
|
|
},
|
|
|
);
|
|
|
}
|
|
|
@@ -267,6 +275,8 @@ class _RootPageState extends State<RootPage> {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ bool grab = false;
|
|
|
+
|
|
|
Stack redEnvelopeP1(void Function(void Function() p1) setState) {
|
|
|
return Stack(
|
|
|
children: [
|
|
|
@@ -289,9 +299,31 @@ class _RootPageState extends State<RootPage> {
|
|
|
left: ((375 / 2 - 45) * ppx),
|
|
|
child: GestureDetector(
|
|
|
onTap: () {
|
|
|
- setState((){
|
|
|
- showWitch = 1;
|
|
|
+ setState(() {
|
|
|
+ grab = true;
|
|
|
});
|
|
|
+ if (DailyRedPacketTool().dailyRedPacket.valid) {
|
|
|
+ EventBus().on('grabARedEnvelope', (arg) {
|
|
|
+ if (arg is GrabARedEnvelopeBeanData) {
|
|
|
+ if (arg.success) {
|
|
|
+ setState(() {
|
|
|
+ showWitch = 1;
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ setState(() {
|
|
|
+ showWitch = 2;
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ EventBus().off('grabARedEnvelope');
|
|
|
+ });
|
|
|
+ DailyRedPacketTool().grabARedEnvelope();
|
|
|
+ } else {
|
|
|
+ setState(() {
|
|
|
+ showWitch = 2;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
behavior: HitTestBehavior.translucent,
|
|
|
child: Container(
|
|
|
@@ -300,14 +332,25 @@ class _RootPageState extends State<RootPage> {
|
|
|
borderRadius: BorderRadius.circular(45 * ppx)),
|
|
|
height: 90 * ppx,
|
|
|
width: 90 * ppx,
|
|
|
- child: Text(
|
|
|
- '抢',
|
|
|
- style: TextStyle(
|
|
|
- color: MyColors.c333333,
|
|
|
- fontSize: 40 * ppx,
|
|
|
- decoration: TextDecoration.none,
|
|
|
- fontWeight: FontWeight.normal),
|
|
|
- ),
|
|
|
+ child: grab
|
|
|
+ ? Container(
|
|
|
+ height: 40,
|
|
|
+ width: 40,
|
|
|
+ padding: const EdgeInsets.all(2.0),
|
|
|
+ child: CircularProgressIndicator(
|
|
|
+ backgroundColor: Colors.transparent,
|
|
|
+ valueColor: AlwaysStoppedAnimation(Colors.white),
|
|
|
+ strokeWidth: 2,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Text(
|
|
|
+ '抢',
|
|
|
+ style: TextStyle(
|
|
|
+ color: MyColors.c333333,
|
|
|
+ fontSize: 40 * ppx,
|
|
|
+ decoration: TextDecoration.none,
|
|
|
+ fontWeight: FontWeight.normal),
|
|
|
+ ),
|
|
|
alignment: Alignment.center,
|
|
|
),
|
|
|
),
|
|
|
@@ -319,7 +362,7 @@ class _RootPageState extends State<RootPage> {
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(top: 28 * ppx),
|
|
|
child: Text(
|
|
|
- '登陆红包',
|
|
|
+ '登录红包',
|
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
|
fontSize: 32 * ppx,
|
|
|
@@ -356,7 +399,7 @@ class _RootPageState extends State<RootPage> {
|
|
|
width: double.infinity,
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
- color: MyColors.cF55544),
|
|
|
+ color: MyColors.cEB4935),
|
|
|
margin: EdgeInsets.symmetric(horizontal: 45 * ppx),
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
),
|
|
|
@@ -366,76 +409,63 @@ class _RootPageState extends State<RootPage> {
|
|
|
children: [
|
|
|
SvgPicture.asset('images/svg/logo.svg'),
|
|
|
Container(
|
|
|
- margin: EdgeInsets.only(top: 48 * ppx),
|
|
|
+ margin: EdgeInsets.only(top: 67 * ppx),
|
|
|
child: Text(
|
|
|
- '0.30元',
|
|
|
+ '${DailyRedPacketTool().grabARedEnvelopeBeanData.amount}元',
|
|
|
style: TextStyle(
|
|
|
color: MyColors.cF1D19B,
|
|
|
- fontSize: 30 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
+ fontSize: 38 * ppx,
|
|
|
+ fontWeight: FontWeight.bold,
|
|
|
decoration: TextDecoration.none),
|
|
|
),
|
|
|
),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(top: 10 * ppx),
|
|
|
- child: RichText(
|
|
|
- text: TextSpan(
|
|
|
- text: '自动划入钱包,去',
|
|
|
- style: TextStyle(
|
|
|
- color: MyColors.c333333,
|
|
|
- decoration: TextDecoration.none,
|
|
|
- fontSize: 13 * ppx),
|
|
|
- children: [
|
|
|
- TextSpan(
|
|
|
- text: '提现',
|
|
|
- style: TextStyle(
|
|
|
- color: MyColors.c44D7B6,
|
|
|
- decoration: TextDecoration.underline,
|
|
|
- fontSize: 13 * ppx),
|
|
|
- recognizer: TapGestureRecognizer()
|
|
|
- ..onTap = () {
|
|
|
- setState((){
|
|
|
- showWitch = 2;
|
|
|
- });
|
|
|
- }),
|
|
|
- ]),
|
|
|
- ),
|
|
|
- )
|
|
|
],
|
|
|
),
|
|
|
top: 37 * ppx,
|
|
|
),
|
|
|
Positioned(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- '详细规则',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 12 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(top: 4 * ppx),
|
|
|
- child: Text(
|
|
|
- '每人每天限领一份,每天八点官方准时派发登陆活动,',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 9 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- '每天10000元,最高可直接领取100元!!!',
|
|
|
+ child: RichText(
|
|
|
+ text: TextSpan(
|
|
|
+ text: '自动划入钱包,去',
|
|
|
style: TextStyle(
|
|
|
color: Colors.white,
|
|
|
- fontSize: 9 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ decoration: TextDecoration.none,
|
|
|
+ fontSize: 13 * ppx),
|
|
|
+ children: [
|
|
|
+ TextSpan(
|
|
|
+ text: '提现',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ decoration: TextDecoration.underline,
|
|
|
+ fontSize: 13 * ppx),
|
|
|
+ recognizer: TapGestureRecognizer()
|
|
|
+ ..onTap = () {
|
|
|
+ if (MyCookie().userBean.aliPayAccount.isEmpty ||
|
|
|
+ MyCookie().userBean.aliPayName.isEmpty) {
|
|
|
+ MyTools().toPage(context, BindAlipayPage(),
|
|
|
+ (then) {
|
|
|
+ if (MyCookie()
|
|
|
+ .userBean
|
|
|
+ .aliPayAccount
|
|
|
+ .isNotEmpty &&
|
|
|
+ MyCookie()
|
|
|
+ .userBean
|
|
|
+ .aliPayName
|
|
|
+ .isNotEmpty) {
|
|
|
+ MyTools().toPage(context, WithdrawPage(),
|
|
|
+ (then) {
|
|
|
+ queryPersonalInformation();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ MyTools().toPage(context, WithdrawPage(),
|
|
|
+ (then) {
|
|
|
+ queryPersonalInformation();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }),
|
|
|
+ ]),
|
|
|
),
|
|
|
bottom: 20 * ppx,
|
|
|
)
|
|
|
@@ -453,7 +483,7 @@ class _RootPageState extends State<RootPage> {
|
|
|
width: double.infinity,
|
|
|
decoration: BoxDecoration(
|
|
|
borderRadius: BorderRadius.circular(16),
|
|
|
- color: MyColors.cF55544),
|
|
|
+ color: MyColors.cEB4935),
|
|
|
margin: EdgeInsets.symmetric(horizontal: 45 * ppx),
|
|
|
),
|
|
|
),
|
|
|
@@ -463,13 +493,17 @@ class _RootPageState extends State<RootPage> {
|
|
|
SvgPicture.asset('images/svg/logo.svg'),
|
|
|
Container(
|
|
|
margin: EdgeInsets.only(top: 64 * ppx),
|
|
|
+ padding: EdgeInsets.symmetric(horizontal: 12*ppx),
|
|
|
+ width: ppx*285,
|
|
|
child: Text(
|
|
|
- '呀!来晚了,明天我一定准时!',
|
|
|
+ '${DailyRedPacketTool().grabARedEnvelopeBeanData.msg}',
|
|
|
+ textAlign: TextAlign.center,
|
|
|
style: TextStyle(
|
|
|
color: MyColors.cF1D19B,
|
|
|
- fontSize: 15 * ppx,
|
|
|
+ fontSize: 18 * ppx,
|
|
|
fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
+ decoration: TextDecoration.none,),
|
|
|
+ maxLines: 5,
|
|
|
),
|
|
|
)
|
|
|
],
|
|
|
@@ -477,36 +511,13 @@ class _RootPageState extends State<RootPage> {
|
|
|
top: 37 * ppx,
|
|
|
),
|
|
|
Positioned(
|
|
|
- child: Column(
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- '详细规则',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 12 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- Container(
|
|
|
- margin: EdgeInsets.only(top: 4 * ppx),
|
|
|
- child: Text(
|
|
|
- '每人每天限领一份,每天八点官方准时派发登陆活动,',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 9 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- ),
|
|
|
- Text(
|
|
|
- '每天10000元,最高可直接领取100元!!!',
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 9 * ppx,
|
|
|
- fontWeight: FontWeight.normal,
|
|
|
- decoration: TextDecoration.none),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ child: Text(
|
|
|
+ '谢谢支持,欢迎参与后续活动!',
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 13 * ppx,
|
|
|
+ fontWeight: FontWeight.normal,
|
|
|
+ decoration: TextDecoration.none),
|
|
|
),
|
|
|
bottom: 20 * ppx,
|
|
|
)
|
|
|
@@ -524,7 +535,6 @@ class RedEnvelopePath extends CustomPainter {
|
|
|
..strokeWidth = 15.0; //画笔的宽度
|
|
|
@override
|
|
|
void paint(Canvas canvas, Size size) {
|
|
|
- print(size);
|
|
|
var path = Path()
|
|
|
..moveTo(0, 0)
|
|
|
..quadraticBezierTo(size.width / 2, 80, size.width, 0)
|
|
|
@@ -538,6 +548,6 @@ class RedEnvelopePath extends CustomPainter {
|
|
|
|
|
|
@override
|
|
|
bool shouldRepaint(covariant CustomPainter oldDelegate) {
|
|
|
- return null;
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|