浏览代码

1.增加路由监听,只有首页显示才进行智能弹窗检查

tags/0.0.11+2
“yanghuaxuan” 3 年前
父节点
当前提交
99040eb4ca
共有 6 个文件被更改,包括 107 次插入30 次删除
  1. +27
    -26
      example/android/app/build.gradle
  2. 二进制
     
  3. +6
    -0
      example/android/build.gradle
  4. +1
    -0
      example/lib/main.dart
  5. +17
    -3
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart
  6. +56
    -1
      lib/pages/home_page/home_page.dart

+ 27
- 26
example/android/app/build.gradle 查看文件

@@ -109,19 +109,19 @@ android {


// 应用信息配置
productFlavors {
// 智夜生活
zhiying {
applicationId "cn.zhios.zhiying"
versionCode 59
dimension "app"
versionName '1.3.19'
// 签名信息
signingConfig signingConfigs.zhiying
}
}
// 打包脚本
// productFlavors {
// // 智夜生活
// zhiying {
// applicationId "cn.zhios.zhiying"
// versionCode 59
// dimension "app"
// versionName '1.3.19'
// // 签名信息
// signingConfig signingConfigs.zhiying
// }
// }
//
// // 打包脚本
// android.applicationVariants.all { variant ->
// if (variant.buildType.name != "debug") {
// variant.getPackageApplicationProvider().get().outputDirectory = new File(project.rootDir.absolutePath + "/app/build/outputs/apk")
@@ -136,18 +136,18 @@ android {
// }
// }
// }
//
// configurations.all {
// resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// def requested = details.requested
// if (requested.group == 'com.android.support') {
// if (!requested.name.startsWith("multidex")) {
// details.useVersion '28.0.3'
// }
// }
// resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
// }
// }
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '28.0.3'
}
}
resolutionStrategy.force 'com.android.support:support-v4:28.0.0'
}
}


}
@@ -185,9 +185,10 @@ dependencies {
implementation 'com.alibaba.sdk.android:AlibcTradeBiz:4.0.0.16@aar'
implementation 'com.alibaba.sdk.android:nb_trade:4.0.0.16@aar'
implementation 'com.alibaba:fastjson:1.2.41@jar'

implementation 'com.amap.api:location:5.2.0'

implementation (name: 'kaduofensdk', ext: 'aar')

}




二进制
查看文件


+ 6
- 0
example/android/build.gradle 查看文件

@@ -2,6 +2,9 @@ buildscript {
repositories {
google()
jcenter()
flatDir {
dirs 'libs'
}
}

dependencies {
@@ -18,6 +21,9 @@ allprojects {
maven {
url "http://repo.baichuan-android.taobao.com/content/groups/BaichuanRepositories/"
}
flatDir {
dirs 'libs'
}

}
}


+ 1
- 0
example/lib/main.dart 查看文件

@@ -107,6 +107,7 @@ class _MyAppState extends State<MyApp> {
child: child,
);
},
navigatorObservers: [lifeObserver],
theme: ThemeData(
fontFamily: 'PingFang',
primaryColor: HexColor.fromHex('#FF4242'),


+ 17
- 3
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart 查看文件

@@ -20,9 +20,19 @@ class IntellectCreate {
static IntellectSearchSetModel _setModel;
static bool isRequest = false;

//是否检查粘贴板
static bool check = false;

static setCheck(bool isCheck){
check=isCheck;
}

///判断规则
static checkAndCreate(AppLifecycleState state, BuildContext context) async {
if (state == AppLifecycleState.resumed && !isRequest) {


if (state == AppLifecycleState.resumed && !isRequest &&check) {
print("读取粘贴版");
isRequest = true;
Timer(Duration(milliseconds: 2000), () {
@@ -96,7 +106,11 @@ class IntellectCreate {
///弹起存在不存在商品的弹窗
if (!Constants.isShowIntellectDialog) {
Constants.isShowIntellectDialog = true;
await showDialog(context: context, child: IntellectSearchNoGoodsDialog(setModel: _setModel,));
await showDialog(
context: context,
child: IntellectSearchNoGoodsDialog(
setModel: _setModel,
));
Constants.isShowIntellectDialog = false;
}
} else if (data.toString() == "403032") {
@@ -162,6 +176,6 @@ class IntellectCreate {
}
}
}
requestDialog(context, content,setModel);
requestDialog(context, content, setModel);
}
}

+ 56
- 1
lib/pages/home_page/home_page.dart 查看文件

@@ -59,7 +59,7 @@ class HomePage extends StatefulWidget {
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin {
class _HomePageState extends LifeState<HomePage> with WidgetsBindingObserver, TickerProviderStateMixin {
int _currentIndex = 0;
List<Map<String, dynamic>> _data = List();
static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER');
@@ -389,4 +389,59 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
)
]));
}

@override
void onPaused() {
print("首页调用不可见");
IntellectCreate.setCheck(false);
}

@override
void onResume() {
print("首页调用可见");
IntellectCreate.setCheck(true);
}
}

final RouteObserver<Route> lifeObserver = RouteObserver();

abstract class LifeState<T extends StatefulWidget> extends State<T>
with RouteAware {
@override
void initState() {
super.initState();
}

@override
void didChangeDependencies() {
lifeObserver.subscribe(this, ModalRoute.of(context));
super.didChangeDependencies();
}

@override
void dispose() {
lifeObserver.unsubscribe(this);
super.dispose();
}


void didPop() {
onPaused();
}

void didPopNext() {
onResume();
}

void didPush() {
onResume();
}

void didPushNext() {
onPaused();
}

void onResume();

void onPaused();
}

正在加载...
取消
保存