Browse Source

优化首页活动海报弹窗-新人弹窗顺序

new_revision_app
wurong 2 years ago
parent
commit
ee6e0f9724
  1. 33
      lib/home/home_page.dart
  2. 2
      lib/retrofit/min_api.dart
  3. 2
      lib/retrofit/retrofit_api.dart
  4. 71
      lib/view_widget/activity_poster.dart
  5. 2
      lib/view_widget/new_people_reward.dart

33
lib/home/home_page.dart

@ -81,9 +81,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
widget.interviewCouponList != null &&
widget.interviewCouponList.length > 0) showInvite = true;
if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
showNew = true;
//
// if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
// showNew = true;
}
@ -98,19 +98,8 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
);
}
///
newShowAlertDialog(newUserCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return NewPeopleReward(newUserCouponList);
},
);
}
///
posterShowAlertDialog(ActivityPos activityPos) {
posterShowAlertDialog(ActivityPos activityPos,firstLoginCouponList) {
var today = DateTime.now().day;
SharedPreferences.getInstance().then((value) {
if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};"))
@ -121,7 +110,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
showDialog(
context: context,
builder: (BuildContext context) {
return ActivityPoster(activityPos);
return ActivityPoster(activityPos,firstLoginCouponList);
},
);
});
@ -283,10 +272,12 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
showInvite = false;
}
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList);
showNew = false;
}
//
// if (showNew) {
// newShowAlertDialog(widget.firstLoginCouponList);
// showNew = false;
// }
}
queryUserBalance() async {
@ -337,7 +328,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
});
if (baseData != null && baseData.isSuccess) {
if(baseData.data?.enabled ?? true)
posterShowAlertDialog(baseData.data);
posterShowAlertDialog(baseData.data,widget.firstLoginCouponList);
}
}

2
lib/retrofit/min_api.dart

@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.dart';
const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///
const localBaseUrl = "http://192.168.10.78:8765/app/";///
// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

2
lib/retrofit/retrofit_api.dart

@ -64,7 +64,7 @@ import 'data/wx_pay.dart';
part 'retrofit_api.g.dart';
const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///
const localBaseUrl = "http://192.168.10.78:8766/app/";///
// const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线

71
lib/view_widget/activity_poster.dart

@ -1,17 +1,18 @@
import 'dart:convert';
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,31 +21,39 @@ 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(
onWillPop: () async => false,
child:Container(
child: Container(
width: double.infinity,
alignment: Alignment.center,
margin: EdgeInsets.only(
left:27.w,
right:27.w,
left: 27.w,
right: 27.w,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: (){
onTap: () {
jumpClick(widget.activityPos);
},
child:
Container(
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
),
child:MImage(
child: MImage(
widget?.activityPos?.showImage ?? "",
aspectRatio: 0.75,
fit: BoxFit.cover,
@ -52,14 +61,19 @@ class _ActivityPoster extends State<ActivityPoster> {
radius: BorderRadius.all(Radius.circular(12)),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),),
),
),
),
Container(
margin: EdgeInsets.only(top:35.h,right: 8.w,bottom:8.w),
child:GestureDetector(
margin: EdgeInsets.only(top: 35.h, right: 8.w, bottom: 8.w),
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){
onTap: () {
Navigator.of(context).pop();
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList);
showNew = false;
}
},
child: Image.asset(
"assets/image/yq_qx.webp",
@ -67,13 +81,23 @@ class _ActivityPoster extends State<ActivityPoster> {
height: 40,
fit: BoxFit.cover,
color: Colors.white,
)
) )
)))
],
),
));
}
///
newShowAlertDialog(newUserCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return NewPeopleReward(newUserCouponList);
},
);
}
/// contentType 0123,4:,5:
jumpClick(ActivityPos activityPos) async {
switch (activityPos.jumpType) {
@ -82,31 +106,28 @@ class _ActivityPoster extends State<ActivityPoster> {
arguments: {"goodsId": widget.activityPos.jumpUrl});
break;
case 2:
Navigator.of(context)
.pushNamed('/router/web_page', arguments: {
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"activityId": widget.activityPos.jumpUrl,
});
break;
case 3:
Navigator.of(context)
.pushNamed('/router/web_page', arguments: {
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"articleId": widget.activityPos.jumpUrl,
});
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);
}
break;
case 5:
Navigator.of(context)
.pushNamed('/router/class_details', arguments: {
Navigator.of(context).pushNamed('/router/class_details', arguments: {
"id": widget.activityPos.jumpUrl,
});
break;

2
lib/view_widget/new_people_reward.dart

@ -42,7 +42,7 @@ class _NewPeopleReward extends State<NewPeopleReward> {
GestureDetector(
onTap: () {
Navigator.of(context).pop();
SmartDialog.showToast("领取成功");
SmartDialog.showToast("领取成功",alignment: Alignment.center);
},
child: Container(
margin: EdgeInsets.only(

Loading…
Cancel
Save