From 549e7a5bfe054fba300f558e0c7d8932a0f208e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Wed, 3 Mar 2021 15:28:54 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E6=99=BA=E8=83=BD=E7=B2=98?= =?UTF-8?q?=E8=B4=B4=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/android/app/build.gradle | 58 +++++----- .../intellect_create.dart | 15 +-- .../intellect_search_goods_dialog.dart | 14 ++- .../intellect_search_no_goods_dialog.dart | 105 ++++++++---------- 4 files changed, 97 insertions(+), 95 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 2a75064..79ef042 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -53,8 +53,8 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" ndk { //选择要添加的对应cpu类型的.so库。 - //abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' - abiFilters 'armeabi-v7a','x86_64' + abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a' + //abiFilters 'armeabi-v7a','x86_64' } } @@ -109,33 +109,33 @@ android { // // 应用信息配置 - productFlavors { - // 智夜生活 - zhiying { - applicationId "cn.zhios.zhiying" - versionCode 48 - dimension "app" - versionName '1.3.6' - // 签名信息 - 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") - } - - variant.outputs.all { output -> - def outputFile = output.outputFile - if (outputFile != null && outputFile.name.endsWith('.apk')) { - //这里修改apk文件名 - def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" - outputFileName = fileName - } - } - } +// productFlavors { +// // 智夜生活 +// zhiying { +// applicationId "cn.zhios.zhiying" +// versionCode 48 +// dimension "app" +// versionName '1.3.6' +// // 签名信息 +// 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") +// } +// +// variant.outputs.all { output -> +// def outputFile = output.outputFile +// if (outputFile != null && outputFile.name.endsWith('.apk')) { +// //这里修改apk文件名 +// def fileName = "${variant.productFlavors[0].name}_${releaseTime()}01_&V${variant.productFlavors[0].versionCode}.apk" +// outputFileName = fileName +// } +// } +// } configurations.all { resolutionStrategy.eachDependency { DependencyResolveDetails details -> diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart index 73b0a36..7f10c80 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart @@ -20,7 +20,6 @@ class IntellectCreate { ///判断规则 static checkAndCreate(AppLifecycleState state, BuildContext context) async { - if (state == AppLifecycleState.resumed && !isRequest) { print("读取粘贴版"); isRequest = true; @@ -85,7 +84,7 @@ class IntellectCreate { } ///请求数据打开弹窗 - static requestDialog(BuildContext context, String content) async { + static requestDialog(BuildContext context, String content, IntellectSearchSetModel setModel) async { // content = // "6緮置内容 Http:/T¢ZKkjceixTjW¢转移至ta0寶【URBANISTA/爱班Stockholm斯德哥尔摩 真无线蓝牙运动耳机半入耳式】"; var params = {"content": content}; @@ -96,7 +95,7 @@ class IntellectCreate { ///弹起存在不存在商品的弹窗 if (!Constants.isShowIntellectDialog) { Constants.isShowIntellectDialog = true; - await showDialog(context: context, child: IntellectSearchNoGoodsDialog()); + await showDialog(context: context, child: IntellectSearchNoGoodsDialog(setModel: _setModel,)); Constants.isShowIntellectDialog = false; } } else if (data.toString() == "403032") { @@ -139,17 +138,19 @@ class IntellectCreate { } //是否纯数字 - if (setModel.isNumber == "1" && isNumeric(content)) { + if (setModel.isNumber == "1" && isNumeric(content) && ((int.tryParse(setModel.numberMin) > content.length) || (int.tryParse(setModel.numberMax) < content.length))) { return; } ///是否纯字母 - if (setModel.isLetter == "1" && isAlpha(content)) { + if (setModel.isLetter == "1" && isAlpha(content) && ((int.tryParse(setModel.letterMin) > content.length) || (int.tryParse(setModel.letterMax) < content.length))) { return; } ///是否仅包含数字和字母 - if (setModel.isNumAndLet == "1" && isAlphanumeric(content)) { + if (setModel.isNumAndLet == "1" && + isAlphanumeric(content) && + ((int.tryParse(setModel.numAndLetMin) > content.length) || (int.tryParse(setModel.numAndLetMax) < content.length))) { return; } @@ -161,6 +162,6 @@ class IntellectCreate { } } } - requestDialog(context, content); + requestDialog(context, content,setModel); } } diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart index 3268f86..5609773 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart @@ -76,7 +76,19 @@ class _IntellectSearchGoodsDialogState ), ], ), - ) + ), + SizedBox( + height: 16, + ), + IconButton( + iconSize: 36, + icon: Icon( + Icons.cancel, + color: Colors.white, + ), + onPressed: () { + Navigator.pop(context); + }) ], ), ), diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart index 891bf9d..c5b1501 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart @@ -6,18 +6,19 @@ import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_ import 'package:cached_network_image/cached_network_image.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; +import 'model/Intellect_search_set_model.dart'; + class IntellectSearchNoGoodsDialog extends StatefulWidget { final IntellectDialogDataModel model; + final IntellectSearchSetModel setModel; - const IntellectSearchNoGoodsDialog({Key key, this.model}) : super(key: key); + const IntellectSearchNoGoodsDialog({Key key, this.model, this.setModel}) : super(key: key); @override - _IntellectSearchNoGoodsDialogState createState() => - _IntellectSearchNoGoodsDialogState(); + _IntellectSearchNoGoodsDialogState createState() => _IntellectSearchNoGoodsDialogState(); } -class _IntellectSearchNoGoodsDialogState - extends State { +class _IntellectSearchNoGoodsDialogState extends State { TextEditingController _textEditingController; NoGoodsDialogStyleModel _styleModel; @@ -42,8 +43,20 @@ class _IntellectSearchNoGoodsDialogState void requestStyle() { NetUtil.request("/api/v1/cfg/clipboard_unidentified", onSuccess: (data) { - _styleModel = NoGoodsDialogStyleModel.fromJson( - json.decode(data['clipboard_unidentified'])); + _styleModel = NoGoodsDialogStyleModel.fromJson(json.decode(data['clipboard_unidentified'])); + if (_styleModel?.iconList != null && widget?.setModel?.platform != null) { + for (var index = _styleModel?.iconList?.length - 1; index >= 0; index--) { + bool isExits = false; + for (var item in widget?.setModel?.platform) { + if (_styleModel?.iconList[index].pvd == item) { + isExits = true; + } + } + if (!isExits) { + _styleModel?.iconList?.removeAt(index); + } + } + } setState(() {}); }); } @@ -63,11 +76,8 @@ class _IntellectSearchNoGoodsDialogState children: [ Container( margin: EdgeInsets.only(top: 19, left: 42.5, right: 42.5), - padding: EdgeInsets.only( - top: 26, left: 15, right: 15, bottom: 24), - decoration: BoxDecoration( - color: HexColor.fromHex(_styleModel?.bgColor ?? ""), - borderRadius: BorderRadius.circular(16)), + padding: EdgeInsets.only(top: 26, left: 15, right: 15, bottom: 24), + decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.bgColor ?? ""), borderRadius: BorderRadius.circular(16)), width: double.infinity, child: Column( children: [_buildTopItem(), _buildBottomItem()], @@ -85,7 +95,19 @@ class _IntellectSearchNoGoodsDialogState )), ), ], - ) + ), + SizedBox( + height: 16, + ), + IconButton( + iconSize: 36, + icon: Icon( + Icons.cancel, + color: Colors.white, + ), + onPressed: () { + Navigator.pop(context); + }) ], ), )); @@ -98,24 +120,15 @@ class _IntellectSearchNoGoodsDialogState children: [ Text( _styleModel?.moduleList?.title?.content ?? "", - style: TextStyle( - color: HexColor.fromHex( - _styleModel?.moduleList?.title?.textColor ?? ""), - fontSize: 15), + style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.title?.textColor ?? ""), fontSize: 15), ), Container( margin: EdgeInsets.only(top: 12), - decoration: BoxDecoration( - color: HexColor.fromHex( - _styleModel?.moduleList?.content?.bgColor ?? ""), - borderRadius: BorderRadius.circular(10)), + decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.content?.bgColor ?? ""), borderRadius: BorderRadius.circular(10)), child: TextField( controller: _textEditingController, textAlign: TextAlign.start, - style: TextStyle( - color: HexColor.fromHex( - _styleModel?.moduleList?.content?.textColor ?? ''), - fontSize: 11), + style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.content?.textColor ?? ''), fontSize: 11), decoration: InputDecoration( contentPadding: EdgeInsets.only(left: 10, top: 10, bottom: 4), border: InputBorder.none, @@ -139,31 +152,19 @@ class _IntellectSearchNoGoodsDialogState Expanded( child: InkWell( child: Container( - decoration: BoxDecoration( - color: HexColor.fromHex( - _styleModel?.moduleList?.btn?.bgColor ?? ""), - borderRadius: BorderRadius.circular(50)), + decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.btn?.bgColor ?? ""), borderRadius: BorderRadius.circular(50)), child: Center( child: Padding( padding: const EdgeInsets.all(12.0), child: Text( _styleModel?.moduleList?.btn?.content ?? "", - style: TextStyle( - color: HexColor.fromHex( - _styleModel?.moduleList?.btn?.textColor), - fontSize: 12), + style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.btn?.textColor), fontSize: 12), ), )), ), onTap: () { RouterUtil.route( - SkipModel.fromJson( - _styleModel.moduleList.btn.skipInfo.toJson()), - { - "keywords": searchText, - "type": _styleModel.moduleList.btn.skipInfo.pvd - }, - context) + SkipModel.fromJson(_styleModel.moduleList.btn.skipInfo.toJson()), {"keywords": searchText, "type": _styleModel.moduleList.btn.skipInfo.pvd}, context) .then((_) { Navigator.pop(context); }); @@ -181,20 +182,16 @@ class _IntellectSearchNoGoodsDialogState Container( height: 1, width: 68.5, - color: HexColor.fromHex( - _styleModel?.moduleList?.segment?.textColor ?? ""), + color: HexColor.fromHex(_styleModel?.moduleList?.segment?.textColor ?? ""), ), Text( _styleModel?.moduleList?.segment?.content ?? "", - style: TextStyle( - color: HexColor.fromHex( - _styleModel?.moduleList?.segment?.textColor ?? "")), + style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.segment?.textColor ?? "")), ), Container( height: 1, width: 68.5, - color: HexColor.fromHex( - _styleModel?.moduleList?.segment?.textColor ?? ""), + color: HexColor.fromHex(_styleModel?.moduleList?.segment?.textColor ?? ""), ), ], ), @@ -203,11 +200,7 @@ class _IntellectSearchNoGoodsDialogState ), Container( height: 50, - child: ListView.builder( - scrollDirection: Axis.horizontal, - shrinkWrap: true, - itemCount: _styleModel?.iconList?.length ?? 0, - itemBuilder: _buildBottomListItem), + child: ListView.builder(scrollDirection: Axis.horizontal, shrinkWrap: true, itemCount: _styleModel?.iconList?.length ?? 0, itemBuilder: _buildBottomListItem), ) ], ); @@ -234,16 +227,12 @@ class _IntellectSearchNoGoodsDialogState ), Text( item.title ?? "", - style: TextStyle( - fontSize: 11, - color: HexColor.fromHex(item.textColor ?? "")), + style: TextStyle(fontSize: 11, color: HexColor.fromHex(item.textColor ?? "")), ) ], ), onTap: () { - RouterUtil.route(SkipModel.fromJson(item.skipInfo.toJson()), - {"keywords": searchText, "type": item.pvd}, context) - .then((value) { + RouterUtil.route(SkipModel.fromJson(item.skipInfo.toJson()), {"keywords": searchText, "type": item.pvd}, context).then((value) { Navigator.pop(context); }); },