# Conflicts: # lib/register.darttags/0.0.1
@@ -23,9 +23,15 @@ if (flutterVersionName == null) { | |||
flutterVersionName = '1.0' | |||
} | |||
// 获取当前时间(年月日) | |||
def releaseTime() { | |||
return new Date().format("YYYYMMdd", TimeZone.getTimeZone("UTC")) | |||
} | |||
apply plugin: 'com.android.application' | |||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" | |||
android { | |||
compileSdkVersion 28 | |||
@@ -33,23 +39,116 @@ android { | |||
disable 'InvalidPackage' | |||
} | |||
// 默认配置 | |||
defaultConfig { | |||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | |||
applicationId "cn.zhios.zhiying_base_widget_example" | |||
minSdkVersion 19 | |||
applicationId "cn.zhios.zhiying" | |||
minSdkVersion 21 | |||
targetSdkVersion 28 | |||
versionCode flutterVersionCode.toInteger() | |||
versionName flutterVersionName | |||
versionCode 1 | |||
versionName "1.0" | |||
aaptOptions.cruncherEnabled = false | |||
aaptOptions.useNewCruncher = false | |||
multiDexEnabled true | |||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" | |||
ndk { | |||
//选择要添加的对应cpu类型的.so库。 | |||
abiFilters 'armeabi', 'armeabi-v7a', 'x86','x86_64', 'mips', 'mips64', 'arm64-v8a' | |||
} | |||
} | |||
buildTypes { | |||
debug { | |||
buildConfigField "boolean", "LOG_DEBUG", "true" | |||
minifyEnabled false | |||
zipAlignEnabled true | |||
shrinkResources false | |||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |||
} | |||
release { | |||
// TODO: Add your own signing config for the release build. | |||
// Signing with the debug keys for now, so `flutter run --release` works. | |||
signingConfig signingConfigs.debug | |||
buildConfigField "boolean", "LOG_DEBUG", "false" | |||
minifyEnabled false | |||
shrinkResources false | |||
zipAlignEnabled true | |||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | |||
} | |||
} | |||
dexOptions { | |||
//最大堆内存 | |||
javaMaxHeapSize "4g"//4g | |||
//使用增量模式构建 | |||
incremental true | |||
//是否支持大工程模式 | |||
jumboMode = true | |||
//预编译 | |||
preDexLibraries = false | |||
//线程数 | |||
threadCount = 8 | |||
} | |||
// | |||
// // 签名配置 | |||
// signingConfigs { | |||
// // 智夜生活 | |||
// zhiying { | |||
// storeFile file('zhiying.jks') | |||
// storePassword 'zhioscom' | |||
// keyAlias 'zysh' | |||
// keyPassword 'zhioscom' | |||
// v1SigningEnabled true | |||
// v2SigningEnabled true | |||
// } | |||
// | |||
// } | |||
// | |||
// flavorDimensions "app" | |||
// | |||
// | |||
// // 应用信息配置 | |||
// productFlavors { | |||
// // 智夜生活 | |||
// zhiying { | |||
// applicationId "cn.zhios.zhiying" | |||
// versionCode 1 | |||
// dimension "app" | |||
// versionName '1.0.0' | |||
// // 签名信息 | |||
// 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 -> | |||
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' | |||
} | |||
} | |||
} | |||
flutter { | |||
@@ -10,6 +10,7 @@ | |||
android:name="io.flutter.app.FlutterApplication" | |||
android:label="zhiying_base_widget_example" | |||
android:icon="@mipmap/ic_launcher" | |||
android:usesCleartextTraffic="true" | |||
tools:replace="android:label"> | |||
<activity | |||
android:name=".MainActivity" | |||
@@ -38,7 +38,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN | |||
@Override | |||
public Map getSetting() { | |||
Map map = new HashMap(); | |||
map.put("domain", "http://192.168.0.113:5000"); //"http://120.76.175.204:8989"); | |||
map.put("domain", "http://inapi.izhyin.cn"); //"http://120.76.175.204:8989"); | |||
map.put("master_id", "123456"); | |||
map.put("secret_key", "123456"); | |||
// map.put("token", "123465"); | |||
@@ -37,8 +37,9 @@ class _MyAppState extends State<MyApp> { | |||
super.initState(); | |||
print('初始化~~~~'); | |||
BaseWidgetRegister.init(); | |||
print('初始化百川'); | |||
FlutterAlibc.initAlibc(version: "", appName: "").then((result) { | |||
Logger.debug('${result.errorCode} ${result.errorMessage}'); | |||
print("白川"+'${result.errorCode} ${result.errorMessage}'); | |||
}); | |||
} | |||
@@ -5,6 +5,7 @@ import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/Intellect_search_set_model.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; | |||
import 'package:zhiying_base_widget/utils/contants.dart'; | |||
import 'package:zhiying_comm/util/shared_prefe_util.dart'; | |||
@@ -15,13 +16,22 @@ import 'package:string_validator/string_validator.dart'; | |||
class IntellectCreate { | |||
static IntellectSearchSetModel _setModel; | |||
static bool isRequest = false; | |||
///判断规则 | |||
static checkAndCreate(AppLifecycleState state, BuildContext context) async { | |||
if (state == AppLifecycleState.resumed && | |||
!Constants.isShowIntellectDialog) { | |||
if (state == AppLifecycleState.resumed && !isRequest) { | |||
isRequest = true; | |||
_requestSetData(context); | |||
} | |||
// Timer(Duration(milliseconds: 500), () async { | |||
// if (!Constants.isShowIntellectDialog) { | |||
// Constants.isShowIntellectDialog = true; | |||
// await showDialog( | |||
// context: context, child: IntellectSearchGoodsDialog()); | |||
// Constants.isShowIntellectDialog = false; | |||
// } | |||
// }); | |||
} | |||
///请求设置参数 | |||
@@ -30,31 +40,36 @@ class IntellectCreate { | |||
var param = {"webId": ""}; | |||
//请求参数 | |||
NetUtil.request('/api/v1/cfg/app_clipboard', params: param, | |||
await NetUtil.request('/api/v1/cfg/clipboard_base', params: param, | |||
onSuccess: (data) async { | |||
print("设置参数" + data.toString()); | |||
///检查是否已缓存过设置信息 | |||
String result = await SharedPreferencesUtil.getStringValue( | |||
Constants.spIsCacheSetModel); | |||
_setModel = IntellectSearchSetModel.fromJson(data); | |||
_setModel = IntellectSearchSetModel.fromJson( | |||
json.decode(data['clipboard_base'])); | |||
if (result.isEmpty) { | |||
validate(context, _setModel); | |||
} | |||
SharedPreferencesUtil.setNetCacheResult( | |||
Constants.spIsCacheSetModel, json.encode(data)); | |||
Constants.spIsCacheSetModel, data['clipboard_base']); | |||
}); | |||
isRequest = false; | |||
///拿缓存数据 | |||
var cacheData = await SharedPreferencesUtil.getNetCacheResult( | |||
Constants.spIsCacheSetModel); | |||
///如果存在缓存直接进入验证阶段 | |||
if (cacheData.isNotEmpty) { | |||
if (cacheData != null) { | |||
_setModel = IntellectSearchSetModel.fromJson(cacheData); | |||
validate(context, _setModel); | |||
} | |||
} else { | |||
validate(context, _setModel); | |||
isRequest = false; | |||
} | |||
} | |||
@@ -65,46 +80,73 @@ class IntellectCreate { | |||
///请求数据打开弹窗 | |||
static requestDialog(BuildContext context, String content) async { | |||
Constants.isShowIntellectDialog = true; | |||
await showDialog(context: context, child: IntellectSearchGoodsDialog()); | |||
Constants.isShowIntellectDialog = false; | |||
content = | |||
"6緮置内容 Http:/T¢ZKkjceixTjW¢转移至ta0寶【URBANISTA/爱班Stockholm斯德哥尔摩 真无线蓝牙运动耳机半入耳式】"; | |||
var params = {"content": content}; | |||
NetUtil.request("/api/v1/clipboard/parse", | |||
params: params, method: NetMethod.POST, onSuccess: (data) async { | |||
isRequest = false; | |||
if (data == null || data.toString().length == 0) { | |||
if (!Constants.isShowIntellectDialog) { | |||
Constants.isShowIntellectDialog = true; | |||
await showDialog( | |||
context: context, child: IntellectSearchNoGoodsDialog()); | |||
Constants.isShowIntellectDialog = false; | |||
} | |||
} else { | |||
IntellectDialogDataModel model = | |||
IntellectDialogDataModel.fromJson(data); | |||
if (!Constants.isShowIntellectDialog) { | |||
Constants.isShowIntellectDialog = true; | |||
await showDialog( | |||
context: context, | |||
child: IntellectSearchGoodsDialog( | |||
model: model, | |||
)); | |||
Constants.isShowIntellectDialog = false; | |||
} | |||
} | |||
}); | |||
} | |||
///检查字段是否被监听 | |||
static void validate( | |||
BuildContext context, IntellectSearchSetModel setModel) async { | |||
ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); | |||
String content = data.text; | |||
//是否监听 | |||
if (setModel.state != "1") { | |||
return; | |||
} | |||
///长度大小限制 | |||
if (setModel.keywordLimitState == "1" && | |||
(int.tryParse(setModel.keywordLimitMin) < content.length) || | |||
(int.tryParse(setModel.keywordLimitMax) > content.length)) { | |||
return; | |||
} | |||
//是否纯数字 | |||
if (setModel.keywordNum == "1" && isNumeric(content)) { | |||
return; | |||
} | |||
///是否纯字母 | |||
if (setModel.keywordAlpha == "1" && isAlpha(content)) { | |||
return; | |||
} | |||
///是否仅包含数字和字母 | |||
if (setModel.keywordAlphanum == "1" && isAlphanumeric(content)) { | |||
return; | |||
} | |||
String content = data?.text ?? ""; | |||
// //是否监听 | |||
// if (setModel.isListen != "1") { | |||
// return; | |||
// } | |||
// | |||
// if(content==null||content.length==0){ | |||
// return; | |||
// } | |||
// ///长度大小限制 | |||
// if (setModel.isKeyLength == "1" && | |||
// (int.tryParse(setModel.keyLengthMin) > content.length) || | |||
// (int.tryParse(setModel.keyLengthMax) < content.length)) { | |||
// return; | |||
// } | |||
// | |||
// //是否纯数字 | |||
// if (setModel.isNumber == "1" && isNumeric(content)) { | |||
// return; | |||
// } | |||
// | |||
// ///是否纯字母 | |||
// if (setModel.isLetter == "1" && isAlpha(content)) { | |||
// return; | |||
// } | |||
// | |||
// ///是否仅包含数字和字母 | |||
// if (setModel.isNumAndLet == "1" && isAlphanumeric(content)) { | |||
// return; | |||
// } | |||
///是否包含某个排除词 | |||
if (setModel.exclude.length > 0) { | |||
for (var item in setModel.exclude) { | |||
if (setModel.banWords != null && setModel.banWords.length > 0) { | |||
for (var item in setModel.banWords) { | |||
if (contains(content, item)) { | |||
return; | |||
} | |||
@@ -1,10 +1,24 @@ | |||
import 'dart:convert'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/has_goods_dialog_style_model.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; | |||
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/model/wallet_detail_model.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:provider/provider.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:flutter_alibc/flutter_alibc.dart'; | |||
import 'package:flutter_alibc/alibc_model.dart'; | |||
class IntellectSearchGoodsDialog extends StatefulWidget { | |||
final IntellectDialogDataModel model; | |||
const IntellectSearchGoodsDialog({Key key, this.model}) : super(key: key); | |||
@override | |||
_IntellectSearchGoodsDialogState createState() => | |||
_IntellectSearchGoodsDialogState(); | |||
@@ -12,8 +26,19 @@ class IntellectSearchGoodsDialog extends StatefulWidget { | |||
class _IntellectSearchGoodsDialogState | |||
extends State<IntellectSearchGoodsDialog> { | |||
HasGoodsDialogStyleModel _styleModel; | |||
UserInfoModel _userInfo; | |||
@override | |||
void initState() { | |||
//Clipboard.setData(ClipboardData(text: "")); | |||
requestStyle(); | |||
super.initState(); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
_userInfo = Provider.of<UserInfoNotifier>(context).userInfo; | |||
return Scaffold( | |||
backgroundColor: Colors.transparent, | |||
body: InkWell( | |||
@@ -35,7 +60,8 @@ class _IntellectSearchGoodsDialogState | |||
right: 30.w, | |||
bottom: 48.h), | |||
decoration: BoxDecoration( | |||
color: Colors.white, | |||
color: | |||
HexColor.fromHex(_styleModel?.bgColor ?? "#FFFFFF"), | |||
borderRadius: BorderRadius.circular(16)), | |||
width: double.infinity, | |||
child: Column( | |||
@@ -46,11 +72,11 @@ class _IntellectSearchGoodsDialogState | |||
height: 76.h, | |||
child: Center( | |||
child: Container( | |||
color: Colors.red, | |||
height: 76.h, | |||
width: 216.w, | |||
child: CachedNetworkImage( | |||
imageUrl: "", | |||
imageUrl: _styleModel?.titleImg ?? "", | |||
fit: BoxFit.fill, | |||
), | |||
)), | |||
), | |||
@@ -68,9 +94,14 @@ class _IntellectSearchGoodsDialogState | |||
crossAxisAlignment: CrossAxisAlignment.start, | |||
children: <Widget>[ | |||
Container( | |||
color: Colors.red, | |||
width: 160.w, | |||
height: 160.w, | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(6), | |||
image: DecorationImage( | |||
image: | |||
CachedNetworkImageProvider(widget.model?.thumbnail ?? ""), | |||
fit: BoxFit.fill)), | |||
), | |||
SizedBox( | |||
width: 19.w, | |||
@@ -84,7 +115,7 @@ class _IntellectSearchGoodsDialogState | |||
Column( | |||
children: <Widget>[ | |||
Text( | |||
"2020新款春款波点连衣裙新短发dfasdfas短发时代发发呆发顺丰的打算萨阿啊", | |||
widget.model?.title ?? "", | |||
maxLines: 2, | |||
overflow: TextOverflow.ellipsis, | |||
style: TextStyle(color: Colors.black, fontSize: 24.sp), | |||
@@ -105,21 +136,30 @@ class _IntellectSearchGoodsDialogState | |||
Container( | |||
width: 30.w, | |||
height: 30.w, | |||
decoration: BoxDecoration(color: Colors.white), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList?.coupon?.bgColor ?? | |||
"")), | |||
child: Center( | |||
child: Text( | |||
"券", | |||
_styleModel?.moduleList?.coupon?.content ?? | |||
"", | |||
style: TextStyle( | |||
color: Colors.red, fontSize: 20.sp), | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList?.coupon?.fontColor ?? | |||
""), | |||
fontSize: 20.sp), | |||
), | |||
), | |||
), | |||
Padding( | |||
padding: const EdgeInsets.only(left: 4, right: 4), | |||
child: Text( | |||
"¥100", | |||
"¥" + (widget.model?.couponPrice ?? ""), | |||
style: TextStyle( | |||
color: Colors.white, fontSize: 20.sp), | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList?.couponPrice?.fontColor), | |||
fontSize: 20.sp), | |||
), | |||
) | |||
], | |||
@@ -130,7 +170,8 @@ class _IntellectSearchGoodsDialogState | |||
), | |||
Container( | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex("#FFFFF6C1"), | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.commission?.bgColor), | |||
borderRadius: BorderRadius.circular(2)), | |||
padding: EdgeInsets.all(2), | |||
child: Row( | |||
@@ -144,9 +185,17 @@ class _IntellectSearchGoodsDialogState | |||
padding: | |||
const EdgeInsets.only(left: 4, right: 4), | |||
child: Text( | |||
"预计返", | |||
(_styleModel?.moduleList?.commission | |||
?.content ?? | |||
"") + | |||
" ¥" + | |||
(widget.model?.commission ?? ""), | |||
style: TextStyle( | |||
color: Colors.deepOrangeAccent, | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList | |||
?.commission | |||
?.fontColor ?? | |||
""), | |||
fontSize: 20.sp), | |||
), | |||
), | |||
@@ -167,8 +216,12 @@ class _IntellectSearchGoodsDialogState | |||
Padding( | |||
padding: const EdgeInsets.only(bottom: 2), | |||
child: Text( | |||
"券后", | |||
style: TextStyle(fontSize: 20.sp, color: Colors.red), | |||
_styleModel?.moduleList?.couponAfter?.content ?? "", | |||
style: TextStyle( | |||
fontSize: 20.sp, | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList?.couponAfterPrice?.fontColor ?? | |||
"")), | |||
), | |||
), | |||
Padding( | |||
@@ -176,14 +229,19 @@ class _IntellectSearchGoodsDialogState | |||
const EdgeInsets.only(bottom: 2, left: 4, right: 4), | |||
child: Text( | |||
"¥", | |||
style: TextStyle(fontSize: 20.sp, color: Colors.red), | |||
style: TextStyle( | |||
fontSize: 20.sp, | |||
color: HexColor.fromHex(_styleModel | |||
?.moduleList?.couponAfterPrice?.fontColor ?? | |||
"")), | |||
), | |||
), | |||
Text( | |||
"999", | |||
widget?.model?.price ?? "", | |||
style: TextStyle( | |||
fontSize: 32.sp, | |||
color: Colors.red, | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.couponAfterPrice?.fontColor), | |||
), | |||
) | |||
], | |||
@@ -201,46 +259,108 @@ class _IntellectSearchGoodsDialogState | |||
SizedBox( | |||
height: 24, | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 20.w, right: 20.w), | |||
decoration: BoxDecoration( | |||
color: Colors.red, borderRadius: BorderRadius.circular(50)), | |||
child: Center( | |||
child: Padding( | |||
padding: const EdgeInsets.all(12.0), | |||
child: Text( | |||
"合法化 ", | |||
style: TextStyle(color: Colors.white, fontSize: 24.sp), | |||
), | |||
)), | |||
)) | |||
], | |||
InkWell( | |||
child: Row( | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 20.w, right: 20.w), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.saveBtn?.bgColor ?? ""), | |||
borderRadius: BorderRadius.circular(50)), | |||
child: Center( | |||
child: Padding( | |||
padding: const EdgeInsets.all(12.0), | |||
child: Text( | |||
(_styleModel?.moduleList?.saveBtn?.content ?? "") + | |||
" ¥" + | |||
(double.tryParse(widget?.model?.couponPrice ?? '0') + | |||
double.tryParse( | |||
widget?.model?.commission ?? '0')) | |||
.toString() | |||
.toString(), | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.saveBtn?.fontColor), | |||
fontSize: 24.sp), | |||
), | |||
)), | |||
)) | |||
], | |||
), | |||
onTap: () { | |||
openUrl(); | |||
}, | |||
), | |||
SizedBox( | |||
height: 16, | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 20.w, right: 20.w), | |||
decoration: BoxDecoration( | |||
color: Colors.red, borderRadius: BorderRadius.circular(50)), | |||
child: Center( | |||
child: Padding( | |||
padding: const EdgeInsets.all(12.0), | |||
child: Text( | |||
"合法化 ", | |||
style: TextStyle(color: Colors.white, fontSize: 24.sp), | |||
), | |||
)), | |||
)) | |||
], | |||
InkWell( | |||
child: Row( | |||
children: <Widget>[ | |||
Expanded( | |||
child: Container( | |||
margin: EdgeInsets.only(left: 20.w, right: 20.w), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.viewGoodsBtn?.bgColor ?? ""), | |||
borderRadius: BorderRadius.circular(50)), | |||
child: Center( | |||
child: Padding( | |||
padding: const EdgeInsets.all(12.0), | |||
child: Text( | |||
_styleModel?.moduleList?.viewGoodsBtn?.content ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.viewGoodsBtn?.fontColor ?? | |||
""), | |||
fontSize: 24.sp), | |||
), | |||
)), | |||
)) | |||
], | |||
), | |||
onTap: () { | |||
openGoodsDetails(); | |||
}, | |||
) | |||
], | |||
); | |||
} | |||
void requestStyle() { | |||
NetUtil.request("/api/v1/cfg/clipboard_identified", onSuccess: (data) { | |||
_styleModel = HasGoodsDialogStyleModel.fromJson( | |||
json.decode(data['clipboard_identified'])); | |||
setState(() {}); | |||
}); | |||
} | |||
void openUrl() async { | |||
///跳转购买 | |||
if (_userInfo?.token == null || _userInfo.token == '') { | |||
print('need login...'); | |||
RouterUtil.goLogin(context); | |||
return; | |||
} else { | |||
if (widget?.model?.provider == 'taobao') { | |||
TradeResult result = | |||
await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl); | |||
Logger.debug('${result.errorCode} ${result.errorMessage} '); | |||
} else { | |||
RouterUtil.openWebview(widget?.model?.couponUrl, context); | |||
} | |||
} | |||
} | |||
///打开详情 | |||
void openGoodsDetails() { | |||
String provider = widget.model.provider; | |||
String goodId = widget.model.itemId; | |||
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), | |||
{"provider": provider, "good_id": goodId}, context).then((data){ | |||
Navigator.pop(context); | |||
}); | |||
} | |||
} |
@@ -1,11 +1,19 @@ | |||
import 'dart:convert'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:flutter/services.dart'; | |||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; | |||
import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/no_goods_dialog_style_model.dart'; | |||
import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; | |||
import 'package:cached_network_image/cached_network_image.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
class IntellectSearchNoGoodsDialog extends StatefulWidget { | |||
final IntellectDialogDataModel model; | |||
const IntellectSearchNoGoodsDialog({Key key, this.model}) : super(key: key); | |||
@override | |||
_IntellectSearchNoGoodsDialogState createState() => | |||
_IntellectSearchNoGoodsDialogState(); | |||
@@ -15,10 +23,13 @@ class _IntellectSearchNoGoodsDialogState | |||
extends State<IntellectSearchNoGoodsDialog> { | |||
TextEditingController _textEditingController; | |||
NoGoodsDialogStyleModel _styleModel; | |||
@override | |||
void initState() { | |||
_textEditingController = TextEditingController(); | |||
_getClipBoardData(); | |||
super.initState(); | |||
} | |||
@@ -26,47 +37,62 @@ class _IntellectSearchNoGoodsDialogState | |||
_getClipBoardData() async { | |||
ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); | |||
_textEditingController.text = data.text; | |||
requestStyle(); | |||
setState(() {}); | |||
} | |||
void requestStyle() { | |||
NetUtil.request("/api/v1/cfg/clipboard_unidentified", onSuccess: (data) { | |||
_styleModel = NoGoodsDialogStyleModel.fromJson( | |||
json.decode(data['clipboard_unidentified'])); | |||
setState(() {}); | |||
}); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
return Scaffold( | |||
backgroundColor: Colors.transparent, | |||
body: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
Stack( | |||
backgroundColor: Colors.transparent, | |||
body: InkWell( | |||
onTap: () { | |||
Navigator.of(context).pop(); | |||
}, | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
Container( | |||
margin: EdgeInsets.only(top: 38.h, left: 92.w, right: 92.w), | |||
padding: EdgeInsets.only( | |||
top: (38 + 15).h, left: 30.w, right: 30.w, bottom: 48.h), | |||
decoration: BoxDecoration( | |||
color: Colors.white, | |||
borderRadius: BorderRadius.circular(16)), | |||
width: double.infinity, | |||
child: Column( | |||
children: <Widget>[_buildTopItem(), _buildBottomItem()], | |||
), | |||
), | |||
Container( | |||
height: 76.h, | |||
child: Center( | |||
child: Container( | |||
color: Colors.red, | |||
height: 76.h, | |||
width: 216.w, | |||
child: CachedNetworkImage( | |||
imageUrl: "", | |||
Stack( | |||
children: <Widget>[ | |||
Container( | |||
margin: EdgeInsets.only(top: 38.h, left: 92.w, right: 92.w), | |||
padding: EdgeInsets.only( | |||
top: (38 + 15).h, | |||
left: 30.w, | |||
right: 30.w, | |||
bottom: 48.h), | |||
decoration: BoxDecoration( | |||
color: HexColor.fromHex(_styleModel?.bgColor ?? ""), | |||
borderRadius: BorderRadius.circular(16)), | |||
width: double.infinity, | |||
child: Column( | |||
children: <Widget>[_buildTopItem(), _buildBottomItem()], | |||
), | |||
), | |||
)), | |||
), | |||
Container( | |||
height: 76.h, | |||
child: Center( | |||
child: Container( | |||
height: 76.h, | |||
width: 216.w, | |||
child: CachedNetworkImage( | |||
imageUrl: _styleModel?.titleImg ?? "", | |||
), | |||
)), | |||
), | |||
], | |||
) | |||
], | |||
) | |||
], | |||
), | |||
); | |||
), | |||
)); | |||
} | |||
_buildTopItem() { | |||
@@ -75,22 +101,30 @@ class _IntellectSearchNoGoodsDialogState | |||
child: Column( | |||
children: <Widget>[ | |||
Text( | |||
"猜你要搜索以下商品", | |||
style: TextStyle(color: Colors.red, fontSize: 30.sp), | |||
_styleModel?.moduleList?.title?.content ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.title?.textColor ?? ""), | |||
fontSize: 30.sp), | |||
), | |||
Container( | |||
margin: EdgeInsets.only(top: 12), | |||
decoration: BoxDecoration( | |||
color: Colors.deepOrangeAccent, | |||
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: 22.sp), | |||
decoration: InputDecoration( | |||
contentPadding: EdgeInsets.only(left: 10, top: 10, bottom: 4), | |||
border: InputBorder.none, | |||
), | |||
maxLines: 5, | |||
maxLines: 8, | |||
), | |||
) | |||
], | |||
@@ -109,13 +143,18 @@ class _IntellectSearchNoGoodsDialogState | |||
Expanded( | |||
child: Container( | |||
decoration: BoxDecoration( | |||
color: Colors.red, borderRadius: BorderRadius.circular(50)), | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.btn?.bgColor ?? ""), | |||
borderRadius: BorderRadius.circular(50)), | |||
child: Center( | |||
child: Padding( | |||
padding: const EdgeInsets.all(12.0), | |||
child: Text( | |||
"立即搜索 ", | |||
style: TextStyle(color: Colors.white, fontSize: 24.sp), | |||
_styleModel?.moduleList?.btn?.content ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.btn?.textColor), | |||
fontSize: 24.sp), | |||
), | |||
)), | |||
)) | |||
@@ -130,13 +169,20 @@ class _IntellectSearchNoGoodsDialogState | |||
Container( | |||
height: 1, | |||
width: 137.w, | |||
color: Colors.deepOrange, | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.segment?.textColor ?? ""), | |||
), | |||
Text( | |||
_styleModel?.moduleList?.segment?.content ?? "", | |||
style: TextStyle( | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.segment?.textColor ?? "")), | |||
), | |||
Text("搜索平台"), | |||
Container( | |||
height: 1, | |||
width: 137.w, | |||
color: Colors.deepOrange, | |||
color: HexColor.fromHex( | |||
_styleModel?.moduleList?.segment?.textColor ?? ""), | |||
), | |||
], | |||
), | |||
@@ -148,7 +194,7 @@ class _IntellectSearchNoGoodsDialogState | |||
child: ListView.builder( | |||
scrollDirection: Axis.horizontal, | |||
shrinkWrap: true, | |||
itemCount: 10, | |||
itemCount: _styleModel?.iconList?.length ?? 0, | |||
itemBuilder: _buildBottomListItem), | |||
) | |||
], | |||
@@ -156,28 +202,34 @@ class _IntellectSearchNoGoodsDialogState | |||
} | |||
Widget _buildBottomListItem(BuildContext context, int index) { | |||
var item = _styleModel.iconList[index]; | |||
return Container( | |||
margin: EdgeInsets.only(left: 11,right: 11), | |||
child: Column( | |||
children: <Widget>[ | |||
Container( | |||
color: Colors.deepOrange, | |||
child: Image.network( | |||
"", | |||
width: 60.w, | |||
height: 60.w, | |||
fit: BoxFit.fill, | |||
), | |||
), | |||
SizedBox( | |||
height: 2, | |||
margin: EdgeInsets.only(left: 11, right: 11), | |||
child: InkWell( | |||
child: Column( | |||
children: <Widget>[ | |||
Container( | |||
color: Colors.deepOrange, | |||
child: Image.network( | |||
"", | |||
width: 60.w, | |||
height: 60.w, | |||
fit: BoxFit.fill, | |||
), | |||
), | |||
SizedBox( | |||
height: 2, | |||
), | |||
Text( | |||
item.title ?? "", | |||
style: TextStyle( | |||
fontSize: 22.sp, | |||
color: HexColor.fromHex(item.textColor ?? "")), | |||
) | |||
], | |||
), | |||
Text( | |||
"淘宝", | |||
style: TextStyle(fontSize: 22.sp), | |||
) | |||
], | |||
), | |||
); | |||
onTap: () {}, | |||
)); | |||
} | |||
} |
@@ -1,50 +1,78 @@ | |||
///智能粘贴板设置参数 | |||
///杨华轩 | |||
class IntellectSearchSetModel { | |||
List<String> exclude; | |||
String keywordAlpha; | |||
String keywordAlphanum; | |||
String keywordLimitMax; | |||
String keywordLimitMin; | |||
String keywordLimitState; | |||
String keywordNum; | |||
List<String> pvd; | |||
String state; | |||
String isListen; | |||
String isShiftUrl; | |||
List<String> platform; | |||
String isKeyLength; | |||
String keyLengthMin; | |||
String keyLengthMax; | |||
String isNumber; | |||
String numberMin; | |||
String numberMax; | |||
String isLetter; | |||
String letterMin; | |||
String letterMax; | |||
String isNumAndLet; | |||
String numAndLetMin; | |||
String numAndLetMax; | |||
List<String> banWords; | |||
IntellectSearchSetModel( | |||
{this.exclude, | |||
this.keywordAlpha, | |||
this.keywordAlphanum, | |||
this.keywordLimitMax, | |||
this.keywordLimitMin, | |||
this.keywordLimitState, | |||
this.keywordNum, | |||
this.pvd, | |||
this.state}); | |||
{this.isListen, | |||
this.isShiftUrl, | |||
this.platform, | |||
this.isKeyLength, | |||
this.keyLengthMin, | |||
this.keyLengthMax, | |||
this.isNumber, | |||
this.numberMin, | |||
this.numberMax, | |||
this.isLetter, | |||
this.letterMin, | |||
this.letterMax, | |||
this.isNumAndLet, | |||
this.numAndLetMin, | |||
this.numAndLetMax, | |||
this.banWords}); | |||
IntellectSearchSetModel.fromJson(Map<String, dynamic> json) { | |||
exclude = json['exclude'].cast<String>(); | |||
keywordAlpha = json['keyword_alpha'].toString(); | |||
keywordAlphanum = json['keyword_alphanum'].toString(); | |||
keywordLimitMax = json['keyword_limit_max'].toString(); | |||
keywordLimitMin = json['keyword_limit_min'].toString(); | |||
keywordLimitState = json['keyword_limit_state'].toString(); | |||
keywordNum = json['keyword_num'].toString(); | |||
pvd = json['pvd'].cast<String>(); | |||
state = json['state'].toString(); | |||
isListen = json['isListen']; | |||
isShiftUrl = json['isShiftUrl']; | |||
platform = json['platform'].cast<String>(); | |||
isKeyLength = json['isKeyLength']; | |||
keyLengthMin = json['keyLengthMin']; | |||
keyLengthMax = json['keyLengthMax']; | |||
isNumber = json['isNumber']; | |||
numberMin = json['numberMin']; | |||
numberMax = json['numberMax']; | |||
isLetter = json['isLetter']; | |||
letterMin = json['letterMin']; | |||
letterMax = json['letterMax']; | |||
isNumAndLet = json['isNumAndLet']; | |||
numAndLetMin = json['numAndLetMin']; | |||
numAndLetMax = json['numAndLetMax']; | |||
banWords = json['banWords'].cast<String>(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['exclude'] = this.exclude; | |||
data['keyword_alpha'] = this.keywordAlpha; | |||
data['keyword_alphanum'] = this.keywordAlphanum; | |||
data['keyword_limit_max'] = this.keywordLimitMax; | |||
data['keyword_limit_min'] = this.keywordLimitMin; | |||
data['keyword_limit_state'] = this.keywordLimitState; | |||
data['keyword_num'] = this.keywordNum; | |||
data['pvd'] = this.pvd; | |||
data['state'] = this.state; | |||
data['isListen'] = this.isListen; | |||
data['isShiftUrl'] = this.isShiftUrl; | |||
data['platform'] = this.platform; | |||
data['isKeyLength'] = this.isKeyLength; | |||
data['keyLengthMin'] = this.keyLengthMin; | |||
data['keyLengthMax'] = this.keyLengthMax; | |||
data['isNumber'] = this.isNumber; | |||
data['numberMin'] = this.numberMin; | |||
data['numberMax'] = this.numberMax; | |||
data['isLetter'] = this.isLetter; | |||
data['letterMin'] = this.letterMin; | |||
data['letterMax'] = this.letterMax; | |||
data['isNumAndLet'] = this.isNumAndLet; | |||
data['numAndLetMin'] = this.numAndLetMin; | |||
data['numAndLetMax'] = this.numAndLetMax; | |||
data['banWords'] = this.banWords; | |||
return data; | |||
} | |||
} |
@@ -0,0 +1,167 @@ | |||
///有商品弹窗model | |||
class HasGoodsDialogStyleModel { | |||
String titleImg; | |||
String bgColor; | |||
ModuleList moduleList; | |||
HasGoodsDialogStyleModel({this.titleImg, this.bgColor, this.moduleList}); | |||
HasGoodsDialogStyleModel.fromJson(Map<String, dynamic> json) { | |||
titleImg = json['title_img']; | |||
bgColor = json['bg_color']; | |||
moduleList = json['module_list'] != null | |||
? new ModuleList.fromJson(json['module_list']) | |||
: null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['title_img'] = this.titleImg; | |||
data['bg_color'] = this.bgColor; | |||
if (this.moduleList != null) { | |||
data['module_list'] = this.moduleList.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class ModuleList { | |||
Coupon coupon; | |||
Coupon commission; | |||
Coupon shopTitle; | |||
Coupon couponPrice; | |||
Coupon couponAfter; | |||
Coupon couponAfterPrice; | |||
SaveBtn saveBtn; | |||
SaveBtn viewGoodsBtn; | |||
ModuleList( | |||
{this.coupon, | |||
this.commission, | |||
this.shopTitle, | |||
this.couponPrice, | |||
this.couponAfter, | |||
this.couponAfterPrice, | |||
this.saveBtn, | |||
this.viewGoodsBtn}); | |||
ModuleList.fromJson(Map<String, dynamic> json) { | |||
coupon = | |||
json['coupon'] != null ? new Coupon.fromJson(json['coupon']) : null; | |||
commission = json['commission'] != null | |||
? new Coupon.fromJson(json['commission']) | |||
: null; | |||
shopTitle = json['shop_title'] != null | |||
? new Coupon.fromJson(json['shop_title']) | |||
: null; | |||
couponPrice = json['coupon_price'] != null | |||
? new Coupon.fromJson(json['coupon_price']) | |||
: null; | |||
couponAfter = json['coupon_after'] != null | |||
? new Coupon.fromJson(json['coupon_after']) | |||
: null; | |||
couponAfterPrice = json['coupon_after_price'] != null | |||
? new Coupon.fromJson(json['coupon_after_price']) | |||
: null; | |||
saveBtn = json['save_btn'] != null | |||
? new SaveBtn.fromJson(json['save_btn']) | |||
: null; | |||
viewGoodsBtn = json['view_goods_btn'] != null | |||
? new SaveBtn.fromJson(json['view_goods_btn']) | |||
: null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
if (this.coupon != null) { | |||
data['coupon'] = this.coupon.toJson(); | |||
} | |||
if (this.commission != null) { | |||
data['commission'] = this.commission.toJson(); | |||
} | |||
if (this.shopTitle != null) { | |||
data['shop_title'] = this.shopTitle.toJson(); | |||
} | |||
if (this.couponPrice != null) { | |||
data['coupon_price'] = this.couponPrice.toJson(); | |||
} | |||
if (this.couponAfter != null) { | |||
data['coupon_after'] = this.couponAfter.toJson(); | |||
} | |||
if (this.couponAfterPrice != null) { | |||
data['coupon_after_price'] = this.couponAfterPrice.toJson(); | |||
} | |||
if (this.saveBtn != null) { | |||
data['save_btn'] = this.saveBtn.toJson(); | |||
} | |||
if (this.viewGoodsBtn != null) { | |||
data['view_goods_btn'] = this.viewGoodsBtn.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class Coupon { | |||
String name; | |||
String content; | |||
String bgColor; | |||
String bgImg; | |||
String fontColor; | |||
Coupon({this.name, this.content, this.bgColor, this.bgImg, this.fontColor}); | |||
Coupon.fromJson(Map<String, dynamic> json) { | |||
name = json['name']; | |||
content = json['content']; | |||
bgColor = json['bg_color']; | |||
bgImg = json['bg_img']; | |||
fontColor = json['font_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['content'] = this.content; | |||
data['bg_color'] = this.bgColor; | |||
data['bg_img'] = this.bgImg; | |||
data['font_color'] = this.fontColor; | |||
return data; | |||
} | |||
} | |||
class SaveBtn { | |||
String name; | |||
String content; | |||
String type; | |||
String bgColor; | |||
String bgImg; | |||
String fontColor; | |||
SaveBtn( | |||
{this.name, | |||
this.content, | |||
this.type, | |||
this.bgColor, | |||
this.bgImg, | |||
this.fontColor}); | |||
SaveBtn.fromJson(Map<String, dynamic> json) { | |||
name = json['name']; | |||
content = json['content']; | |||
type = json['type']; | |||
bgColor = json['bg_color']; | |||
bgImg = json['bg_img']; | |||
fontColor = json['font_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['content'] = this.content; | |||
data['type'] = this.type; | |||
data['bg_color'] = this.bgColor; | |||
data['bg_img'] = this.bgImg; | |||
data['font_color'] = this.fontColor; | |||
return data; | |||
} | |||
} |
@@ -0,0 +1,52 @@ | |||
class IntellectDialogDataModel { | |||
String itemId; | |||
String title; | |||
String price; | |||
String priceOriginal; | |||
String commission; | |||
String commissionRate; | |||
String thumbnail; | |||
String provider; | |||
String couponUrl; | |||
String couponPrice; | |||
IntellectDialogDataModel( | |||
{this.itemId, | |||
this.title, | |||
this.price, | |||
this.priceOriginal, | |||
this.commission, | |||
this.commissionRate, | |||
this.thumbnail, | |||
this.provider, | |||
this.couponUrl, | |||
this.couponPrice}); | |||
IntellectDialogDataModel.fromJson(Map<String, dynamic> json) { | |||
itemId = json['item_id'].toString(); | |||
title = json['title'].toString(); | |||
price = json['price'].toString(); | |||
priceOriginal = json['price_original'].toString(); | |||
commission = json['commission'].toString(); | |||
commissionRate = json['commission_rate'].toString(); | |||
thumbnail = json['thumbnail'].toString(); | |||
provider = json['provider'].toString(); | |||
couponUrl = json['coupon_url'].toString(); | |||
couponPrice = json['coupon_price'].toString(); | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['item_id'] = this.itemId; | |||
data['title'] = this.title; | |||
data['price'] = this.price; | |||
data['price_original'] = this.priceOriginal; | |||
data['commission'] = this.commission; | |||
data['commission_rate'] = this.commissionRate; | |||
data['thumbnail'] = this.thumbnail; | |||
data['provider'] = this.provider; | |||
data['coupon_url'] = this.couponUrl; | |||
data['coupon_price'] = this.couponPrice; | |||
return data; | |||
} | |||
} |
@@ -0,0 +1,174 @@ | |||
class NoGoodsDialogStyleModel { | |||
String titleImg; | |||
String bgColor; | |||
List<IconList> iconList; | |||
ModuleList moduleList; | |||
NoGoodsDialogStyleModel( | |||
{this.titleImg, this.bgColor, this.iconList, this.moduleList}); | |||
NoGoodsDialogStyleModel.fromJson(Map<String, dynamic> json) { | |||
titleImg = json['title_img']; | |||
bgColor = json['bg_color']; | |||
if (json['icon_list'] != null) { | |||
iconList = new List<IconList>(); | |||
json['icon_list'].forEach((v) { | |||
iconList.add(new IconList.fromJson(v)); | |||
}); | |||
} | |||
moduleList = json['module_list'] != null | |||
? new ModuleList.fromJson(json['module_list']) | |||
: null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['title_img'] = this.titleImg; | |||
data['bg_color'] = this.bgColor; | |||
if (this.iconList != null) { | |||
data['icon_list'] = this.iconList.map((v) => v.toJson()).toList(); | |||
} | |||
if (this.moduleList != null) { | |||
data['module_list'] = this.moduleList.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class IconList { | |||
String image; | |||
String title; | |||
String textColor; | |||
IconList({this.image, this.title, this.textColor}); | |||
IconList.fromJson(Map<String, dynamic> json) { | |||
image = json['image']; | |||
title = json['title']; | |||
textColor = json['text_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['image'] = this.image; | |||
data['title'] = this.title; | |||
data['text_color'] = this.textColor; | |||
return data; | |||
} | |||
} | |||
class ModuleList { | |||
Title title; | |||
Title segment; | |||
Content content; | |||
Btn btn; | |||
ModuleList({this.title, this.segment, this.content, this.btn}); | |||
ModuleList.fromJson(Map<String, dynamic> json) { | |||
title = json['title'] != null ? new Title.fromJson(json['title']) : null; | |||
segment = | |||
json['segment'] != null ? new Title.fromJson(json['segment']) : null; | |||
content = | |||
json['content'] != null ? new Content.fromJson(json['content']) : null; | |||
btn = json['btn'] != null ? new Btn.fromJson(json['btn']) : null; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
if (this.title != null) { | |||
data['title'] = this.title.toJson(); | |||
} | |||
if (this.segment != null) { | |||
data['segment'] = this.segment.toJson(); | |||
} | |||
if (this.content != null) { | |||
data['content'] = this.content.toJson(); | |||
} | |||
if (this.btn != null) { | |||
data['btn'] = this.btn.toJson(); | |||
} | |||
return data; | |||
} | |||
} | |||
class Title { | |||
String name; | |||
String content; | |||
String textColor; | |||
Title({this.name, this.content, this.textColor}); | |||
Title.fromJson(Map<String, dynamic> json) { | |||
name = json['name']; | |||
content = json['content']; | |||
textColor = json['text_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['content'] = this.content; | |||
data['text_color'] = this.textColor; | |||
return data; | |||
} | |||
} | |||
class Content { | |||
String name; | |||
String textColor; | |||
String bgColor; | |||
Content({this.name, this.textColor, this.bgColor}); | |||
Content.fromJson(Map<String, dynamic> json) { | |||
name = json['name']; | |||
textColor = json['text_color']; | |||
bgColor = json['bg_color']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['text_color'] = this.textColor; | |||
data['bg_color'] = this.bgColor; | |||
return data; | |||
} | |||
} | |||
class Btn { | |||
String name; | |||
String content; | |||
String type; | |||
String textColor; | |||
String bgColor; | |||
String bgImage; | |||
Btn( | |||
{this.name, | |||
this.content, | |||
this.type, | |||
this.textColor, | |||
this.bgColor, | |||
this.bgImage}); | |||
Btn.fromJson(Map<String, dynamic> json) { | |||
name = json['name']; | |||
content = json['content']; | |||
type = json['type']; | |||
textColor = json['text_color']; | |||
bgColor = json['bg_color']; | |||
bgImage = json['bg_image']; | |||
} | |||
Map<String, dynamic> toJson() { | |||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||
data['name'] = this.name; | |||
data['content'] = this.content; | |||
data['type'] = this.type; | |||
data['text_color'] = this.textColor; | |||
data['bg_color'] = this.bgColor; | |||
data['bg_image'] = this.bgImage; | |||
return data; | |||
} | |||
} |
@@ -13,6 +13,8 @@ import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||
import 'package:zhiying_comm/util/custom_sliver_persistent_header_delegate.dart'; | |||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||
import 'package:flutter_alibc/flutter_alibc.dart'; | |||
class BilDetailPage extends StatefulWidget { | |||
final Map<String, dynamic> data; | |||
@@ -59,12 +61,13 @@ class _BilDetailPageContainerState extends State<BilDetailPageContainer> { | |||
@override | |||
void initState() { | |||
_bloc = BlocProvider.of<BilDetailPageBloc>(context); | |||
// showDate=DateFormat(DateFormat.YEAR_MONTH).parse(DateTime.now()); | |||
showDate = DateFormat('yyyy-MM').format(DateTime.now()); | |||
super.initState(); | |||
} | |||
@override | |||
Widget build(BuildContext context) { | |||
return StreamBuilder( | |||
builder: (context, sny) { | |||
return Scaffold( | |||
@@ -75,9 +78,7 @@ class _BilDetailPageContainerState extends State<BilDetailPageContainer> { | |||
body: Container( | |||
child: ListView( | |||
shrinkWrap: true, | |||
children: <Widget>[ | |||
_buildType(), | |||
], | |||
children: <Widget>[_buildType(), _buildBottomItem()], | |||
), | |||
), | |||
); | |||
@@ -90,13 +91,13 @@ class _BilDetailPageContainerState extends State<BilDetailPageContainer> { | |||
children: <Widget>[ | |||
SizedBox(width: 12.5), | |||
InkWell( | |||
onTap: (){ | |||
onTap: () { | |||
///显示日期选择弹窗 | |||
_selectDate(); | |||
}, | |||
child: Padding( | |||
padding: const EdgeInsets.only(top: 8,bottom: 8), | |||
child: Text("2020-08"), | |||
padding: const EdgeInsets.only(top: 8, bottom: 8), | |||
child: Text(showDate ?? ""), | |||
), | |||
), | |||
Icon(Icons.arrow_drop_down), | |||
@@ -108,9 +109,9 @@ class _BilDetailPageContainerState extends State<BilDetailPageContainer> { | |||
shrinkWrap: true, | |||
itemCount: 3, | |||
itemBuilder: (context, index) { | |||
return Container( | |||
return InkWell(child: Container( | |||
margin: | |||
EdgeInsets.only(top: 10, left: 8, right: 8, bottom: 10), | |||
EdgeInsets.only(top: 10, left: 8, right: 8, bottom: 10), | |||
decoration: BoxDecoration( | |||
color: Colors.grey[200], | |||
borderRadius: BorderRadius.circular(50)), | |||
@@ -118,18 +119,148 @@ class _BilDetailPageContainerState extends State<BilDetailPageContainer> { | |||
padding: const EdgeInsets.only(left: 16, right: 16), | |||
child: Center( | |||
child: Text( | |||
"推广", | |||
style: TextStyle(color: Colors.grey), | |||
)), | |||
"推广", | |||
style: TextStyle(color: Colors.grey), | |||
)), | |||
), | |||
); | |||
),onTap: () async { | |||
print("ok"); | |||
await FlutterAlibc.loginTaoBao(); | |||
},); | |||
}), | |||
)) | |||
], | |||
); | |||
} | |||
void _selectDate() { | |||
showDialog(context: context, builder: (context)=>SelectDateYMDialog()); | |||
void _selectDate() async { | |||
showDialog(context: context, builder: (context) => SelectDateYMDialog()); | |||
} | |||
_buildBottomItem() { | |||
return ListView.builder( | |||
shrinkWrap: true, itemCount: 10, itemBuilder: _buildItem); | |||
} | |||
Widget _buildItem(BuildContext context, int index) { | |||
return Container( | |||
margin: EdgeInsets.only(left: 12.5, right: 12.5, bottom: 4, top: 4), | |||
padding: | |||
EdgeInsets.only(left: 25.w, right: 25.w, top: 20.h, bottom: 20.h), | |||
child: Column( | |||
children: <Widget>[ | |||
Row( | |||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | |||
children: <Widget>[ | |||
Row( | |||
children: <Widget>[ | |||
Container( | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(4), | |||
color: Colors.red[100], | |||
border: Border.all(color: Colors.red)), | |||
child: Padding( | |||
padding: const EdgeInsets.only( | |||
left: 4, right: 4, top: 2, bottom: 2), | |||
child: Center( | |||
child: Text( | |||
"自购", | |||
style: TextStyle(color: Colors.red, fontSize: 20.sp), | |||
), | |||
), | |||
), | |||
), | |||
Container( | |||
width: 443.w, | |||
margin: EdgeInsets.only(left: 15.w), | |||
child: Text( | |||
"Segway Ninebot mini Pro智能代的卅饭店发生的范德萨地方撒发生", | |||
maxLines: 1, | |||
overflow: TextOverflow.ellipsis, | |||
style: TextStyle(fontSize: 28.sp), | |||
)) | |||
], | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Text( | |||
"+", | |||
style: TextStyle(color: Colors.red), | |||
), | |||
Text( | |||
"¥8.00", | |||
style: TextStyle(color: Colors.red, fontSize: 30.sp), | |||
) | |||
], | |||
) | |||
], | |||
), | |||
SizedBox( | |||
height: 4, | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Text( | |||
"订单编号:", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
Text( | |||
"1233333333", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
SizedBox( | |||
width: 28.w, | |||
), | |||
Container( | |||
decoration: BoxDecoration( | |||
borderRadius: BorderRadius.circular(4), | |||
color: HexColor.fromHex("#FFF5F5F5"), | |||
border: Border.all(color: HexColor.fromHex("#FFD6D6D6"))), | |||
child: Padding( | |||
padding: | |||
EdgeInsets.only(left: 16, right: 16, top: 1, bottom: 1), | |||
child: Text( | |||
"复制", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
), | |||
) | |||
], | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Text( | |||
"订单编号:", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
Text( | |||
"1233333333", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
], | |||
), | |||
Row( | |||
children: <Widget>[ | |||
Text( | |||
"订单编号:", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
Text( | |||
"1233333333", | |||
style: TextStyle( | |||
color: HexColor.fromHex("#FF999999"), fontSize: 22.sp), | |||
), | |||
], | |||
) | |||
], | |||
), | |||
); | |||
} | |||
} |
@@ -70,7 +70,7 @@ class _MainPageContainerState extends State<_MainPageContainer> | |||
@override | |||
void didChangeAppLifecycleState(AppLifecycleState state) async { | |||
///智能粘贴板 | |||
// IntellectCreate.checkAndCreate(state, context); | |||
IntellectCreate.checkAndCreate(state, context); | |||
super.didChangeAppLifecycleState(state); | |||
} | |||
@@ -102,7 +102,7 @@ class _MainPageContainerState extends State<_MainPageContainer> | |||
} | |||
}); | |||
///监听app生命周期变化 | |||
// WidgetsBinding.instance.addObserver(this); | |||
WidgetsBinding.instance.addObserver(this); | |||
IntellectCreate.checkAndCreateFirst(context); | |||
super.initState(); | |||
} | |||
@@ -1,4 +1,5 @@ | |||
import 'package:sharesdk_plugin/sharesdk_plugin.dart'; | |||
import 'package:sharesdk_plugin/sharesdk_interface.dart'; | |||
import 'package:sharesdk_plugin/sharesdk_register.dart'; | |||
import 'package:zhiying_base_widget/pages/bil_detail_page/bil_detail_page.dart'; | |||
import 'package:zhiying_base_widget/pages/favorite_page/favorite_page.dart'; | |||
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart'; | |||
@@ -91,7 +92,7 @@ class BaseWidgetRegister { | |||
PageFactory.regist('pub.flutter.index', (model) => MainPage(model)); | |||
PageFactory.regist('pub.flutter.profile', (model) => MainPage(model)); | |||
PageFactory.regist( | |||
'pub.flutter.my_wallet', (model) => BilDetailPage(model)); | |||
'pub.flutter.my_wallet', (model) => WalletPage(data: model)); | |||
PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model)); | |||
PageFactory.regist('search', (model) => SearchPage(model)); | |||
PageFactory.regist('search_item_page', (model) => SearchItemPage(model)); | |||
@@ -115,13 +116,13 @@ class BaseWidgetRegister { | |||
PageFactory.regist( | |||
'pub.flutter.account_security', (model) => SecurityPage(model)); | |||
PageFactory.regist('pub.flutter.account_security_alipay', | |||
(model) => SecurityBindAlipayPage(model)); | |||
(model) => SecurityBindAlipayPage(model)); | |||
// 登录密码 | |||
PageFactory.regist('pub.flutter.account_security_password', | |||
(model) => SecurityPassword(model)); | |||
(model) => SecurityPassword(model)); | |||
// 修改手机号 | |||
PageFactory.regist('pub.flutter.account_security_mobile', | |||
(model) => SecurityMobile(model)); | |||
(model) => SecurityMobile(model)); | |||
// 邀请好友 | |||
PageFactory.regist( | |||
'pub.flutter.invite_friends', (model) => InvitedFriendsPage(model)); | |||
@@ -268,11 +269,14 @@ class BaseWidgetRegister { | |||
WidgetFactory.regist('profile_my_functions', | |||
DefaultWidgetCreater((model) => MineQuickEntry(model))); | |||
// WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model))); | |||
WidgetFactory.regist('profile_carousel', | |||
DefaultWidgetCreater((model) => HomeBannerWidget(model))); | |||
// ==================== 钱包 | |||
WidgetFactory.regist( | |||
'my_wallet_appbar', | |||
DefaultWidgetCreater((model) => WalletAppbar( | |||
DefaultWidgetCreater((model) => | |||
WalletAppbar( | |||
data: model, | |||
))); | |||
WidgetFactory.regist( | |||
@@ -31,15 +31,15 @@ dependencies: | |||
flutter_native_image: ^0.0.5 | |||
#字符检测 | |||
string_validator: 0.1.4 | |||
intl: 0.15.7 | |||
permission_handler: | |||
git: | |||
ref: 0.0.1 | |||
url: http://192.168.0.138:3000/FnuoOS_Flutter_Components/permission_handler.git | |||
zhiying_comm: | |||
path: ../zhiying_comm | |||
intl: 0.16.0 | |||
dev_dependencies: | |||
flutter_test: | |||