Browse Source

兼容推送类型;

优化刷新的颜色;
更改订单详情刷新;
new_revision_app
wurong 2 years ago
parent
commit
93de462bfc
  1. 76
      lib/base_state.dart
  2. 25
      lib/main_page.dart
  3. 4
      lib/order/order_detail_page.dart
  4. 7
      lib/view_widget/classic_header.dart

76
lib/base_state.dart

@ -6,6 +6,9 @@ import 'package:shared_preferences/shared_preferences.dart';
abstract class BaseState<T extends StatefulWidget> extends State<T>
with WidgetsBindingObserver {
int lastTime = DateTime.now().millisecondsSinceEpoch;
@override
void dispose() {
super.dispose();
@ -20,8 +23,11 @@ abstract class BaseState<T extends StatefulWidget> extends State<T>
break;
case AppLifecycleState.resumed: //
pushRoute();
if(DateTime.now().millisecondsSinceEpoch - lastTime > 300000)
Navigator.of(context).popAndPushNamed('/router/main_page');
break;
case AppLifecycleState.paused: //
lastTime = DateTime.now().millisecondsSinceEpoch;
break;
case AppLifecycleState.detached: // APP结束时调用
break;
@ -49,41 +55,41 @@ abstract class BaseState<T extends StatefulWidget> extends State<T>
if (pushMap != null) {
String routeName = "";
Map<String, dynamic> params = {};
switch (pushMap["typed"]) {
case 1:
routeName = "/router/store_detail_page";
params["articleId"] = pushMap["info"];
break;
case 2:
routeName = "/router/store_detail_page";
params["activityId"] = pushMap["info"];
break;
case 3:
routeName = "/router/store_order";
params["id"] = pushMap["info"];
params["tenant"] = pushMap["tenant"];
params["storeName"] = pushMap["storeName"];
break;
case 4:
routeName = "/router/integral_store_page";
params["goodsId"] = pushMap["info"];
break;
case 5:
routeName = "/router/order_details";
params["id"] = pushMap["info"];
break;
case 6:
routeName = "/router/community_details";
params["businessId"] = pushMap["info"];
break;
case 8:
routeName = "/router/mine_wallet";
params["id"] = pushMap["info"];
break;
case 9:
routeName = "/router/welfare_page";
params["id"] = pushMap["info"];
break;
switch (pushMap["typed"].toString()) {
case "1":case "ARTICLE":
routeName = "/router/web_page";
params["articleId"] = pushMap["info"];
break;
case "2":case "ACTIVITY":
routeName = "/router/web_page";
params["activityId"] = pushMap["info"];
break;
case "3":case "SHOP":
routeName = "/router/store_order";
params["id"] = pushMap["info"];
params["tenant"] = pushMap["tenant"];
params["storeName"] = pushMap["storeName"];
break;
case "4":case "CREDIT_GOODS":
routeName = "/router/integral_store_page";
params["goodsId"] = pushMap["info"];
break;
case "5":case "ORDER":
routeName = "/router/order_details";
params["id"] = pushMap["info"];
break;
case "6":case "MEMBER":
routeName = "/router/community_details";
params["businessId"] = pushMap["info"];
break;
case "8":case "WALLET":
routeName = "/router/mine_wallet";
params["id"] = pushMap["info"];
break;
case "9":case "WELFARE":
routeName = "/router/welfare_page";
params["id"] = pushMap["info"];
break;
}
sharedPreferences.setString("pushData", "");
print("xgPushClickAction: routeName: $routeName");

25
lib/main_page.dart

@ -57,7 +57,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
final GlobalKey vipPageKey = GlobalKey();
// List<String> iconn;
ApiService apiService;
int lastTime = DateTime.now().millisecondsSinceEpoch;
@override
void dispose() {
@ -73,8 +73,11 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
break;
case AppLifecycleState.resumed: //
pushRoute();
if(DateTime.now().millisecondsSinceEpoch - lastTime > 300000)
Navigator.of(context).popAndPushNamed('/router/main_page');
break;
case AppLifecycleState.paused: //
lastTime = DateTime.now().millisecondsSinceEpoch;
break;
case AppLifecycleState.detached: // APP结束时调用
break;
@ -224,7 +227,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
);
}
/// @typed: 1 2 3 4 5 6 7 8/ 9
/// @typed: ARTICLE(1) ACTIVITY(2) SHOP(3) CREDIT_GOODS(4) ORDER(5) TREND(6) MEMBER(7) WALLET(8)/ WELFARE(9)
xgFlutterPlugin.addEventHandler(xgPushClickAction: (event) async {
print("xgPushClickAction1: $event");
if (event["actionType"] == 2) return event;
@ -288,38 +291,38 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
if (pushMap != null) {
String routeName = "";
Map<String, dynamic> params = {};
switch (pushMap["typed"]) {
case 1:
switch (pushMap["typed"].toString()) {
case "1":case "ARTICLE":
routeName = "/router/web_page";
params["articleId"] = pushMap["info"];
break;
case 2:
case "2":case "ACTIVITY":
routeName = "/router/web_page";
params["activityId"] = pushMap["info"];
break;
case 3:
case "3":case "SHOP":
routeName = "/router/store_order";
params["id"] = pushMap["info"];
params["tenant"] = pushMap["tenant"];
params["storeName"] = pushMap["storeName"];
break;
case 4:
case "4":case "CREDIT_GOODS":
routeName = "/router/integral_store_page";
params["goodsId"] = pushMap["info"];
break;
case 5:
case "5":case "ORDER":
routeName = "/router/order_details";
params["id"] = pushMap["info"];
break;
case 6:
case "6":case "MEMBER":
routeName = "/router/community_details";
params["businessId"] = pushMap["info"];
break;
case 8:
case "8":case "WALLET":
routeName = "/router/mine_wallet";
params["id"] = pushMap["info"];
break;
case 9:
case "9":case "WELFARE":
routeName = "/router/welfare_page";
params["id"] = pushMap["info"];
break;

4
lib/order/order_detail_page.dart

@ -167,7 +167,9 @@ class _OrderDetailPage extends State<OrderDetailPage> {
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(
color: Colors.white,
),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);

7
lib/view_widget/classic_header.dart

@ -11,6 +11,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:rive/rive.dart';
class MyHeader extends StatelessWidget {
final Color color;
MyHeader({this.color});
@override
Widget build(BuildContext context) {
return MyClassicHeader(
@ -22,11 +25,11 @@ class MyHeader extends StatelessWidget {
idleText: S.of(context).xialashuaxin,
iconPos: IconPosition.left,
completeTextStyle: TextStyle(
color: Color(0xFF32A060),
color:color?? Color(0xFF32A060),
),
completeIcon: Icon(
Icons.done,
color: Color(0xFF32A060),
color: color??Color(0xFF32A060),
),
refreshingIcon: SpinKitCircle(
color: Colors.grey,

Loading…
Cancel
Save