|
|
|
@ -6,12 +6,15 @@ import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:huixiang/retrofit/data/activity_pos.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
|
|
import '../retrofit/data/login_info.dart'; |
|
|
|
|
import 'custom_image.dart'; |
|
|
|
|
import 'new_people_reward.dart'; |
|
|
|
|
|
|
|
|
|
class ActivityPoster extends StatefulWidget { |
|
|
|
|
final ActivityPos activityPos; |
|
|
|
|
final List<FirstLoginCouponList> firstLoginCouponList; |
|
|
|
|
|
|
|
|
|
ActivityPoster(this.activityPos); |
|
|
|
|
ActivityPoster(this.activityPos,this.firstLoginCouponList); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
@ -20,6 +23,15 @@ class ActivityPoster extends StatefulWidget {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _ActivityPoster extends State<ActivityPoster> { |
|
|
|
|
bool showNew = false; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void initState() { |
|
|
|
|
super.initState(); |
|
|
|
|
if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0) |
|
|
|
|
showNew = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return WillPopScope( |
|
|
|
@ -60,6 +72,11 @@ class _ActivityPoster extends State<ActivityPoster> {
|
|
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
|
onTap: (){ |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
|
|
|
|
|
if (showNew) { |
|
|
|
|
newShowAlertDialog(widget.firstLoginCouponList); |
|
|
|
|
showNew = false; |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/yq_qx.webp", |
|
|
|
@ -74,6 +91,17 @@ class _ActivityPoster extends State<ActivityPoster> {
|
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///新用户奖励弹窗 |
|
|
|
|
newShowAlertDialog(newUserCouponList) { |
|
|
|
|
//显示对话框 |
|
|
|
|
showDialog( |
|
|
|
|
context: context, |
|
|
|
|
builder: (BuildContext context) { |
|
|
|
|
return NewPeopleReward(newUserCouponList); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程) |
|
|
|
|
jumpClick(ActivityPos activityPos) async { |
|
|
|
|
switch (activityPos.jumpType) { |
|
|
|
@ -95,11 +123,12 @@ class _ActivityPoster extends State<ActivityPoster> {
|
|
|
|
|
break; |
|
|
|
|
case 4: |
|
|
|
|
String router = widget.activityPos.jumpUrl; |
|
|
|
|
|
|
|
|
|
// String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}"; |
|
|
|
|
if (router.contains("?")) { |
|
|
|
|
String params = router.substring(router.indexOf("?")); |
|
|
|
|
params = params.replaceAll("?", ""); |
|
|
|
|
String params = router.substring(router.indexOf("?")+1); |
|
|
|
|
Map map = jsonDecode(params); |
|
|
|
|
Navigator.of(context).pushNamed(router, arguments: map); |
|
|
|
|
Navigator.of(context).pushNamed(router.substring(0,router.indexOf("?")), arguments: map); |
|
|
|
|
} else { |
|
|
|
|
Navigator.of(context).pushNamed(router); |
|
|
|
|
} |
|
|
|
|