Browse Source

Merge remote-tracking branch 'origin/new_revision_app' into new_revision_app

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

25
lib/main_page.dart

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

2
lib/message/system_message.dart

@ -645,7 +645,7 @@ class _SystemMessagePage extends State<SystemMessagePage> {
? "assets/image/icon_system_message.webp" ? "assets/image/icon_system_message.webp"
: (message.typed == 2) : (message.typed == 2)
? "assets/image/icon_system_message.webp" ? "assets/image/icon_system_message.webp"
: "assets/image/icon.webp", : "assets/image/icon_cz.webp",
width: 40.w, width: 40.w,
height: 40.h, height: 40.h,
), ),

134
lib/order/order_detail_page.dart

@ -39,17 +39,14 @@ class _OrderDetailPage extends State<OrderDetailPage> {
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
int jumpState; int jumpState;
final RefreshController refreshController = RefreshController();
@override @override
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
apiService = ApiService( apiService = ApiService(Dio(),
Dio(), context: context, token: value.getString("token"), showLoading: true);
context: context,
token: value.getString("token"),
showLoading: true
);
queryDetails(); queryDetails();
}); });
jumpState = widget.arguments["jumpState"]; jumpState = widget.arguments["jumpState"];
@ -66,7 +63,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String tenant = orderInfo.tenantCode; String tenant = orderInfo.tenantCode;
String storeId = orderInfo.storeId; String storeId = orderInfo.storeId;
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
value.setString('tenant', tenant), value.setString('tenant', tenant),
value.setString('storeId', storeId), value.setString('storeId', storeId),
@ -94,16 +91,19 @@ class _OrderDetailPage extends State<OrderDetailPage> {
queryDetails() async { queryDetails() async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(Dio(),
Dio(),
context: context, context: context,
token: value.getString("token"), token: value.getString("token"),
showLoading: false showLoading: false);
);
} }
BaseData<OrderInfo> baseData = await apiService BaseData<OrderInfo> baseData = await apiService
.orderDetail(widget.arguments["id"]) .orderDetail(widget.arguments["id"])
.catchError((error) {}); .catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
orderInfo = baseData.data; orderInfo = baseData.data;
payStatus = orderInfo.payStatus; payStatus = orderInfo.payStatus;
@ -123,8 +123,12 @@ class _OrderDetailPage extends State<OrderDetailPage> {
setState(() { setState(() {
statusTitle(); statusTitle();
}); });
}else{ refreshController.refreshCompleted();
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); refreshController.loadComplete();
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
} }
} }
@ -159,52 +163,70 @@ class _OrderDetailPage extends State<OrderDetailPage> {
leadingColor: Colors.white, leadingColor: Colors.white,
brightness: Brightness.dark, brightness: Brightness.dark,
), ),
body: Container( body: SmartRefresher(
child: SingleChildScrollView( controller: refreshController,
physics: BouncingScrollPhysics(), enablePullDown: true,
child: Container( enablePullUp: false,
child: Column( header: MyHeader(),
children: [ footer: CustomFooter(
/// builder: (context, mode) {
OrderStatus( return MyFooter(mode);
orderStatus, },
isTakeOut, ),
sendStatus, onRefresh:(){
payStatus, setState(() {
refundStatus, queryDetails();
title, });
center, },
orderInfo, physics: BouncingScrollPhysics(),
), scrollController: ScrollController(),
child: Container(
/// child: SingleChildScrollView(
if(orderInfo != null && orderInfo.addressExt != null) physics: BouncingScrollPhysics(),
OrderAddress( child: Container(
orderStatus, child: Column(
isTakeOut, children: [
sendStatus, ///
payStatus, OrderStatus(
refundStatus, orderStatus,
title, isTakeOut,
center, sendStatus,
paySelected, payStatus,
_orderCancel, refundStatus,
orderInfo, title,
jumpState center,
orderInfo,
), ),
/// ///
if(orderInfo != null) if(orderInfo != null && orderInfo.addressExt != null)
OrderCommodity(orderInfo), OrderAddress(
orderStatus,
isTakeOut,
sendStatus,
payStatus,
refundStatus,
title,
center,
paySelected,
_orderCancel,
orderInfo,
jumpState
),
/// ///
if(orderInfo != null) if(orderInfo != null)
OrderInfoView(orderInfo, isTakeOut), OrderCommodity(orderInfo),
Container( ///
height: 42.h, if(orderInfo != null)
), OrderInfoView(orderInfo, isTakeOut),
],
Container(
height: 42.h,
),
],
),
), ),
), ),
), ),

7
lib/view_widget/classic_header.dart

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

Loading…
Cancel
Save