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. 139
      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 != null &&
widget.interviewCouponList.length > 0) showInvite = true; 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; var today = DateTime.now().day;
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};")) 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( showDialog(
context: context, context: context,
builder: (BuildContext 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]); inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
showInvite = false; showInvite = false;
} }
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList); //
showNew = false; // if (showNew) {
} // newShowAlertDialog(widget.firstLoginCouponList);
// showNew = false;
// }
} }
queryUserBalance() async { queryUserBalance() async {
@ -337,7 +328,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if(baseData.data?.enabled ?? true) 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'; 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 localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/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'; 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 localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线

139
lib/view_widget/activity_poster.dart

@ -1,17 +1,18 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/activity_pos.dart'; import 'package:huixiang/retrofit/data/activity_pos.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/login_info.dart';
import 'custom_image.dart'; import 'custom_image.dart';
import 'new_people_reward.dart';
class ActivityPoster extends StatefulWidget { class ActivityPoster extends StatefulWidget {
final ActivityPos activityPos; final ActivityPos activityPos;
final List<FirstLoginCouponList> firstLoginCouponList;
ActivityPoster(this.activityPos); ActivityPoster(this.activityPos, this.firstLoginCouponList);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -20,58 +21,81 @@ class ActivityPoster extends StatefulWidget {
} }
class _ActivityPoster extends State<ActivityPoster> { class _ActivityPoster extends State<ActivityPoster> {
bool showNew = false;
@override
void initState() {
super.initState();
if (widget.firstLoginCouponList != null &&
widget.firstLoginCouponList.length > 0) showNew = true;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
onWillPop: () async => false, onWillPop: () async => false,
child:Container( child: Container(
width: double.infinity, width: double.infinity,
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only( margin: EdgeInsets.only(
left:27.w, left: 27.w,
right:27.w, right: 27.w,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: (){
jumpClick(widget.activityPos);
},
child:
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
),
child:MImage(
widget?.activityPos?.showImage ?? "",
aspectRatio: 0.75,
fit: BoxFit.cover,
noCompress: true,
radius: BorderRadius.all(Radius.circular(12)),
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),),
), ),
Container( child: Column(
margin: EdgeInsets.only(top:35.h,right: 8.w,bottom:8.w), mainAxisAlignment: MainAxisAlignment.center,
child:GestureDetector( crossAxisAlignment: CrossAxisAlignment.center,
behavior: HitTestBehavior.opaque, children: [
onTap: (){ GestureDetector(
Navigator.of(context).pop(); onTap: () {
jumpClick(widget.activityPos);
}, },
child: Image.asset( child: Container(
"assets/image/yq_qx.webp", decoration: BoxDecoration(
width: 40, borderRadius: BorderRadius.circular(12),
height: 40, ),
fit: BoxFit.cover, child: MImage(
color: Colors.white, widget?.activityPos?.showImage ?? "",
) aspectRatio: 0.75,
) ) fit: BoxFit.cover,
], noCompress: true,
), 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(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pop();
if (showNew) {
newShowAlertDialog(widget.firstLoginCouponList);
showNew = false;
}
},
child: Image.asset(
"assets/image/yq_qx.webp",
width: 40,
height: 40,
fit: BoxFit.cover,
color: Colors.white,
)))
],
),
));
}
///
newShowAlertDialog(newUserCouponList) {
//
showDialog(
context: context,
builder: (BuildContext context) {
return NewPeopleReward(newUserCouponList);
},
);
} }
/// contentType 0123,4:,5: /// contentType 0123,4:,5:
@ -82,31 +106,28 @@ class _ActivityPoster extends State<ActivityPoster> {
arguments: {"goodsId": widget.activityPos.jumpUrl}); arguments: {"goodsId": widget.activityPos.jumpUrl});
break; break;
case 2: case 2:
Navigator.of(context) Navigator.of(context).pushNamed('/router/web_page', arguments: {
.pushNamed('/router/web_page', arguments: {
"activityId": widget.activityPos.jumpUrl, "activityId": widget.activityPos.jumpUrl,
}); });
break; break;
case 3: case 3:
Navigator.of(context) Navigator.of(context).pushNamed('/router/web_page', arguments: {
.pushNamed('/router/web_page', arguments: {
"articleId": widget.activityPos.jumpUrl, "articleId": widget.activityPos.jumpUrl,
}); });
break; break;
case 4: case 4:
String router = widget.activityPos.jumpUrl; String router = widget.activityPos.jumpUrl;
// String router = "/router/store_order?{\"id\":\"1333246101343436800\",\"tenant\":\"1175\",\"storeName\":\"海峡姐妹茶(汉街店)\"}";
if (router.contains("?")) { if (router.contains("?")) {
String params = router.substring(router.indexOf("?")); String params = router.substring(router.indexOf("?")+1);
params = params.replaceAll("?", "");
Map map = jsonDecode(params); Map map = jsonDecode(params);
Navigator.of(context).pushNamed(router, arguments: map); Navigator.of(context).pushNamed(router.substring(0,router.indexOf("?")), arguments: map);
} else { } else {
Navigator.of(context).pushNamed(router); Navigator.of(context).pushNamed(router);
} }
break; break;
case 5: case 5:
Navigator.of(context) Navigator.of(context).pushNamed('/router/class_details', arguments: {
.pushNamed('/router/class_details', arguments: {
"id": widget.activityPos.jumpUrl, "id": widget.activityPos.jumpUrl,
}); });
break; break;

2
lib/view_widget/new_people_reward.dart

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

Loading…
Cancel
Save