feat:新增鑫泓佳首页二次退出逻辑

This commit is contained in:
anfe 2024-05-03 09:21:08 +08:00
parent 8d34a727f8
commit f49f7712b7
5 changed files with 31 additions and 6 deletions

View File

@ -316,7 +316,7 @@ SPEC CHECKSUMS:
flutter_native_contact_picker: bd430ba0fbf82768bb50c2c52a69a65759a8f907
flutter_pcm_sound: de0572ca4f99091cc2abfcc31601b8a4ddd33c0e
flutter_voice_processor: 2b89b93d69b02227ae3fd58589ee0bcfa3ca2a82
fluttertoast: 9f2f8e81bb5ce18facb9748d7855bf5a756fe3db
fluttertoast: 31b00dabfa7fb7bacd9e7dbee580d7a2ff4bf265
fluwx: daa284756ce53442b3d0417ceeda66e981906811
google_maps_flutter_ios: d1318b4ff711612cab16862d7a87e31a7403d458
GoogleMaps: 20d7b12be49a14287f797e88e0e31bc4156aaeb4

View File

@ -28,6 +28,8 @@ class F {
static String get name => appFlavor?.name ?? '';
static bool get isXHJ => appFlavor == Flavor.xhj;
//便
static dynamic sw(
{required fCallFunction defaultCall, fCallFunction? xhjCall}) {

View File

@ -15,6 +15,8 @@ class LockMainXHJLogic extends BaseGetXController {
update();
}
bool get isMall => state.index ==1;
//
void openEquipment() {
showModalBottomSheet(

View File

@ -25,6 +25,7 @@ class StarLockMainXHJPage extends StatefulWidget {
class _StarLockMainXHJPageState extends State<StarLockMainXHJPage>
with BaseWidget {
@override
void initState() {
super.initState();

View File

@ -1,8 +1,12 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get/get.dart';
import 'package:star_lock/flavors.dart';
import 'package:star_lock/main/lockMian/lockMain/xhj/lockMain_xhj_logic.dart';
import 'package:star_lock/mine/mall/lockMall_entity.dart';
import 'package:star_lock/mine/mall/lockMall_state.dart';
import 'package:star_lock/network/api_repository.dart';
@ -16,8 +20,10 @@ import '../../tools/baseGetXController.dart';
class LockMallLogic extends BaseGetXController {
late LockMallState state;
DateTime? _lastPressedAt; //
LockMallLogic({required bool allowReturn})
: state = LockMallState(allowReturn: allowReturn );
: state = LockMallState(allowReturn: allowReturn);
//
Future<void> getMallURLRequest() async {
@ -98,19 +104,33 @@ class LockMallLogic extends BaseGetXController {
//webview 退退
Future<bool> canGoBack(bool didPop) async {
bool canGoBack = await state.mallWebView.canGoBack();
if (canGoBack) {
bool isMall = true;
if (Get.isRegistered<LockMainXHJLogic>() && F.isXHJ) {
isMall = Get.find<LockMainXHJLogic>().isMall;
}
if (canGoBack && isMall) {
await state.mallWebView.goBack();
} else if (state.allowReturn) {
} else if (state.allowReturn && isMall) {
Get.back();
} else {
if (_lastPressedAt == null ||
DateTime.now().difference(_lastPressedAt!) > Duration(seconds: 2)) {
// 2 退
_lastPressedAt = DateTime.now();
showToast('再返回一次退出${F.title}');
return false; //
}
SystemNavigator.pop();
return true;
}
refreshGoBack();
return false;
}
//
void refreshGoBack(){
void refreshGoBack() {
//退
if(state.allowReturn){
if (state.allowReturn) {
return;
}
state.mallWebView.canGoBack().then((value) {