diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index a3259a1..5f0544e 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -112,9 +112,9 @@ android { // 智夜生活 zhiying { applicationId "cn.zhios.zhiying" - versionCode 27 + versionCode 28 dimension "app" - versionName '1.2.27' + versionName '1.2.28' // 签名信息 signingConfig signingConfigs.zhiying } diff --git a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java index 76da23f..836a75d 100644 --- a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java +++ b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java @@ -5,23 +5,29 @@ import android.content.res.Configuration; import android.content.res.Resources; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; +import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.Gravity; import android.view.Window; import android.view.WindowManager; +import android.view.animation.AlphaAnimation; +import android.view.animation.Animation; import android.widget.FrameLayout; import android.widget.ImageView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.UiThread; import com.example.moblink.MoblinkPlugin; import com.mob.moblink.MobLink; import java.util.HashMap; import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; import cn.zhios.zhiying_comm.ZhiyingFlutterCommHandler; import cn.zhios.zhiying_comm.ZhiyingFlutterCommNativable; @@ -52,6 +58,8 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN ///添加启动页 void addLaunchView() { + + view = (FrameLayout) this.getWindow().getDecorView(); launchImageFrame = new FrameLayout(this); @@ -63,7 +71,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN launchImageFrame.setLayoutParams(params); - ImageView launchImageView = new ImageView(this); + ImageView launchImageView = new ImageView(this); FrameLayout.LayoutParams b_p = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT); @@ -77,15 +85,37 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN view.addView(launchImageFrame, params); } + Timer timer=new Timer(); + ///移除启动页 void removeLaunchView() { + //此处延时是为了不显示启动页往上顶 + if(timer!=null){ + timer.schedule(new TimerTask() { + @Override + public void run() { + MainActivity.this.runOnUiThread(new Runnable() { + @Override + public void run() { + if (view != null && launchImageFrame != null) { + getWindow().getDecorView().setBackground(new ColorDrawable(Color.parseColor("#000000"))); +// Animation alphaAnimation = new AlphaAnimation(1, 1); +// alphaAnimation.setDuration(100); +// alphaAnimation.setFillAfter(true); +// launchImageFrame.startAnimation(alphaAnimation); + Log.d("----------------", "----------------------清除启动页---------------"); + view.removeView(launchImageFrame); + launchImageFrame = null; + view = null; + } + } + }); + timer=null; + } + },100); - if(view!=null&&launchImageFrame!=null){ - Log.d("----------------","----------------------清除启动页---------------"); - view.removeView(launchImageFrame); } - launchImageFrame=null; - view=null; + } @Override @@ -138,7 +168,7 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN public Map getSetting() { Map map = new HashMap(); map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); -// map.put("domain", "http://192.168.0.113:5000"); +// map.put("domain", "http://192.168.0.113:5000");45678910, map.put("master_id", "123456"); map.put("secret_key", "123456"); // map.put("token", "123465"); @@ -152,8 +182,8 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN @Override public void initSuccess() { - Log.d("----------------","----------------------清除启动页---------------"); - removeLaunchView(); + Log.d("----------------", "----------------------清除启动页---------------"); + removeLaunchView(); } @Override diff --git a/example/android/app/src/main/res/values/color.xml b/example/android/app/src/main/res/values/color.xml new file mode 100644 index 0000000..cb8eda3 --- /dev/null +++ b/example/android/app/src/main/res/values/color.xml @@ -0,0 +1,4 @@ + + #00000000 + #FFFFF0 + \ No newline at end of file diff --git a/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart b/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart index 04f6039..612a71d 100644 --- a/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart +++ b/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart @@ -59,6 +59,7 @@ class ActivityDialog extends StatelessWidget { // margin: const EdgeInsets.symmetric(horizontal: 40), width: MediaQuery.of(context).size.width * 0.7, child: CachedNetworkImage( + fadeInDuration: Duration(milliseconds: 0), imageUrl: model?.img ?? '', ), ), diff --git a/lib/models/app_config_model.dart b/lib/models/app_config_model.dart index 3a71ade..9a7caca 100644 --- a/lib/models/app_config_model.dart +++ b/lib/models/app_config_model.dart @@ -1,3 +1,6 @@ +import 'dart:convert'; + +import 'package:zhiying_comm/util/shared_prefe_util.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; // 应用配置信息 @@ -5,34 +8,47 @@ import 'package:zhiying_comm/zhiying_comm.dart'; class AppConfigModel { // 应用配置的key AppConfigKeyModel keys; + // 引导页 AppConfigGuideModel guideImage; static AppConfigModel _config; AppConfigModel({this.keys, this.guideImage}); - + static AppConfigModel getConfig() => _config; - static Future init() async { - Map result = - await NetUtil.post('/api/v1/app/guide', method: NetMethod.GET); + static Future init({bool isGetCache = false}) async { try { - var data = result['data']; - _config = AppConfigModel.fromJson(Map.from(data)); - Logger.debug('基础设置初始化'); - return _config; + + String cacheData = await SharedPreferencesUtil.getStringValue(GlobalConfig.MAIN_CONFIG, defaultVal: '1'); + if (isGetCache && cacheData != '1') { + _config = AppConfigModel.fromJson(Map.from(json.decode(cacheData))); + Logger.debug('基础设置初始化'); + NetUtil.request('/api/v1/app/guide', onSuccess: (data) { + print(data); + var cacheString = json.encode(data); + SharedPreferencesUtil.setNetCacheResult(GlobalConfig.GUIDE, cacheString); + }); + return _config; + } else { + Map result = await NetUtil.post('/api/v1/app/guide', method: NetMethod.GET); + var data = result['data']; + _config = AppConfigModel.fromJson(Map.from(data)); + Logger.debug('基础设置初始化'); + SharedPreferencesUtil.setNetCacheResult(GlobalConfig.GUIDE, json.encode(data)); + return _config; + } } catch (err) { Logger.error(err); + + return null; } - return null; } AppConfigModel.fromJson(Map json) { keys = json['keys'] != null ? new AppConfigKeyModel.fromJson(json['keys']) : null; - guideImage = json['guide_image'] != null - ? new AppConfigGuideModel.fromJson(json['guide_image']) - : null; + guideImage = json['guide_image'] != null ? new AppConfigGuideModel.fromJson(json['guide_image']) : null; } Map toJson() { @@ -59,12 +75,9 @@ class AppConfigKeyModel { AppConfigKeyModel.fromJson(Map json) { weibo = json['weibo'] != null ? new AppConfigKeyItemModel.fromJson(json['weibo']) : null; qq = json['qq'] != null ? new AppConfigKeyItemModel.fromJson(json['qq']) : null; - weixin = - json['weixin'] != null ? new AppConfigKeyItemModel.fromJson(json['weixin']) : null; + weixin = json['weixin'] != null ? new AppConfigKeyItemModel.fromJson(json['weixin']) : null; jdIos = json['jd_ios'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_ios']) : null; - jdAndroid = json['jd_android'] != null - ? new AppConfigKeyItemModel.fromJson(json['jd_android']) - : null; + jdAndroid = json['jd_android'] != null ? new AppConfigKeyItemModel.fromJson(json['jd_android']) : null; } Map toJson() { diff --git a/lib/pages/message_notice_page/bloc/message_notice_repository.dart b/lib/pages/message_notice_page/bloc/message_notice_repository.dart index 113b0d9..a1f442f 100644 --- a/lib/pages/message_notice_page/bloc/message_notice_repository.dart +++ b/lib/pages/message_notice_page/bloc/message_notice_repository.dart @@ -84,7 +84,7 @@ class MessageNoticeRepository { try{ _oldData.forEach((element){ if(element.id == selectId) { - element.unread_count = ''; + element.unreadCount = ''; } }); return MessageNoticeDataModel()..list = _oldData; diff --git a/lib/pages/message_notice_page/message_notice_page.dart b/lib/pages/message_notice_page/message_notice_page.dart index 0e82d56..92d3cca 100644 --- a/lib/pages/message_notice_page/message_notice_page.dart +++ b/lib/pages/message_notice_page/message_notice_page.dart @@ -1,3 +1,5 @@ +import 'dart:convert'; + import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; @@ -52,16 +54,15 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 子item点击事件 void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) { - /// 消除消息红点 - BlocProvider.of(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id)); + BlocProvider.of(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id.toString())); /// 如果是消息中心,则重新打开页面加载 Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'NoticePageType': styleModel?.type, 'NoticePageTitle': styleModel?.name}))); } /// 子item点击的公共跳转 - void _onItemClick(SkipModel model){ + void _onItemClick(SkipModel model) { RouterUtil.route(model, model.toJson(), context); } @@ -162,7 +163,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 交易通知 if (styleType == 'transaction_notification') { - return _buildTradeNoticeStyleWidget(styleModel?.transaction_notification, itemDataModel); + return _buildOfficialNoticeStyleWidget2(styleModel?.transaction_notification, itemDataModel); } /// 推广通知 @@ -236,7 +237,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine width: double.infinity, child: Row( children: [ - _buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unread_count), + _buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unreadCount), const SizedBox(width: 10), Expanded( child: Column( @@ -251,14 +252,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine styleModel?.name ?? '官方活动', style: TextStyle(color: HexColor.fromHex(styleModel?.name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 13), ), - Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)), + Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)), ], ), Padding( padding: const EdgeInsets.only(right: 22), child: Text( //'2020年6月23日4:00至6月30日4:00关闭提现aaa', - dataModel?.main_preview ?? '', + dataModel?.messageContent.title ?? '', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12), @@ -280,7 +281,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 官方通知样式 Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(dataModel), + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -303,14 +304,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine children: [ /// 标题 Text( - dataModel?.title ?? '', + dataModel?.messageContent.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), ), const SizedBox(height: 5), /// 内容 Text( - dataModel?.subtitle ?? '', + dataModel?.messageContent.title ?? '', maxLines: 3, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), @@ -325,7 +326,64 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine Padding( padding: const EdgeInsets.only(top: 16), child: Text( - dataModel?.date_time ?? '', + dataModel?.dateTime ?? '', + style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), + )) + ], + ), + ), + ); + } + + /// 交易通知样式 + Widget _buildOfficialNoticeStyleWidget2(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { + return GestureDetector( + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), + behavior: HitTestBehavior.opaque, + child: Container( + padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), + margin: const EdgeInsets.only(bottom: 7.5), + decoration: BoxDecoration( + color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), + borderRadius: BorderRadius.circular(7.5), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildCustomerAvatarWidget(icon: styleModel?.icon), + const SizedBox(width: 10), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + /// 标题 + Text( + dataModel?.messageContent.title ?? '', + style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), + ), + const SizedBox(height: 5), + + /// 内容 + Text( + dataModel?.messageContent.title ?? '', + maxLines: 3, + overflow: TextOverflow.ellipsis, + style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), + ) + ], + ), + ) + ], + ), + + /// 时间 + Padding( + padding: const EdgeInsets.only(top: 16), + child: Text( + dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), )) ], @@ -337,7 +395,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 官方活动样式 Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(dataModel), + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -348,7 +406,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine children: [ /// 标题 Text( - dataModel?.title ?? '', + dataModel?.messageContent.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -359,14 +417,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine ClipRRect( borderRadius: BorderRadius.circular(7.5), child: CachedNetworkImage( - imageUrl: dataModel?.img ?? '', + imageUrl: dataModel?.messageContent?.image ?? '', width: double.infinity, )), const SizedBox(height: 6.5), /// 活动内容 Text( - dataModel?.subtitle ?? '', + dataModel?.messageContent?.content ?? '', maxLines: 2, overflow: TextOverflow.ellipsis, style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')), @@ -374,7 +432,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 时间 const SizedBox(height: 7), - Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) + Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) ], ), ), @@ -384,7 +442,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 交易通知样式 Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(dataModel), + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -406,11 +464,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine crossAxisAlignment: CrossAxisAlignment.start, children: [ /// 标题 - Text(dataModel?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), + Text(dataModel?.messageContent.title ?? '', + style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), const SizedBox(height: 5), /// 内容 - _buildCustomerTradeContentWidget(styleModel, dataModel?.transactions), + // _buildCustomerTradeContentWidget(styleModel, dataModel?.transactions), ], ), ) @@ -420,7 +479,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 时间 Padding( padding: const EdgeInsets.only(top: 16), - child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) + child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) ], ), ), @@ -430,7 +489,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 推广通知样式 Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(dataModel), + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -445,7 +504,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildCustomerAvatarWidget(icon: dataModel?.img), + _buildCustomerAvatarWidget(icon: styleModel?.icon), const SizedBox(width: 10), Expanded( child: Column( @@ -453,14 +512,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine children: [ /// 标题 Text( - dataModel?.title ?? '', + dataModel?.messageContent.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), ), const SizedBox(height: 5), /// 内容 Text( - dataModel?.subtitle ?? '恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!', + dataModel?.messageContent?.content ?? '恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!', maxLines: 3, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), @@ -474,7 +533,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 时间 Padding( padding: const EdgeInsets.only(top: 16), - child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) + child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) ], ), ), @@ -484,7 +543,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 反馈通知样式 Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(dataModel), + onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 14, bottom: 10), @@ -506,11 +565,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine crossAxisAlignment: CrossAxisAlignment.start, children: [ /// 标题 - Text(dataModel?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), + Text(dataModel?.messageContent.title ?? '', + style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), const SizedBox(height: 3), /// 内容 - Text(dataModel?.subtitle ?? '', + Text( dataModel?.messageContent?.content ?? '', maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11)) ], ), @@ -521,7 +581,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 时间 Padding( padding: const EdgeInsets.only(top: 16), - child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) + child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) ], ), ), @@ -581,7 +641,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine borderRadius: BorderRadius.circular(6), border: Border.all(color: HexColor.fromHex('#FFFFFF'), width: 0.5)), child: Text( - value?? '', + value ?? '', textAlign: TextAlign.center, style: TextStyle(fontSize: 9, color: HexColor.fromHex(unreadTextColor ?? '#FFFFFF')), ), @@ -593,28 +653,28 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine ); } - /// 转账自定义widget - Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List transactions) { - List lists = []; - transactions.forEach((element) { - bool isearnings = (element?.type ?? '') == 'earnings'; - lists.add(Padding( - padding: const EdgeInsets.only(bottom: 5), - child: RichText( - textAlign: TextAlign.start, - text: TextSpan(children: [ - TextSpan(text: element?.text ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex( styleModel?.message_value_color ?? '#999999'))), - TextSpan(text: element?.data ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex( isearnings ? - styleModel?.earnings ?? '#FF0100' - : styleModel?.message_value_color ?? '#999999'))), - ]), - ), - )); - }); - - return Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: lists, - ); - } + // /// 转账自定义widget + // Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List transactions) { + // List lists = []; + // transactions.forEach((element) { + // bool isearnings = (element?.type ?? '') == 'earnings'; + // lists.add(Padding( + // padding: const EdgeInsets.only(bottom: 5), + // child: RichText( + // textAlign: TextAlign.start, + // text: TextSpan(children: [ + // TextSpan(text: element?.text ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'))), + // TextSpan( + // text: element?.data ?? '', + // style: TextStyle(fontSize: 11, color: HexColor.fromHex(isearnings ? styleModel?.earnings ?? '#FF0100' : styleModel?.message_value_color ?? '#999999'))), + // ]), + // ), + // )); + // }); + // + // return Column( + // crossAxisAlignment: CrossAxisAlignment.start, + // children: lists, + // ); + // } } diff --git a/lib/pages/message_notice_page/model/message_notice_data_model.dart b/lib/pages/message_notice_page/model/message_notice_data_model.dart index 4c65d4a..27c6ac0 100644 --- a/lib/pages/message_notice_page/model/message_notice_data_model.dart +++ b/lib/pages/message_notice_page/model/message_notice_data_model.dart @@ -1,18 +1,17 @@ -import 'dart:convert'; - -import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/no_goods_dialog_style_model.dart'; -import 'package:zhiying_comm/models/base/skip_model.dart'; -import 'package:zhiying_comm/util/empty_util.dart'; +import 'dart:convert' as Con; class MessageNoticeDataModel { List list; MessageNoticeDataModel({this.list}); - factory MessageNoticeDataModel.fromJson(Map json) { - return MessageNoticeDataModel( - list: json['list'] != null ? (json['list'] as List).map((i) => MessageNoticeDataItemModel.fromJson(i)).toList() : null, - ); + MessageNoticeDataModel.fromJson(Map json) { + if (json['list'] != null) { + list = new List(); + json['list'].forEach((v) { + list.add(new MessageNoticeDataItemModel.fromJson(v)); + }); + } } Map toJson() { @@ -24,100 +23,65 @@ class MessageNoticeDataModel { } } -class MessageNoticeDataItemModel extends SkipModel { - String unread_count; - String receiver; - String body; - String date_time; - String id; - String img; - String main_preview; - String oid; - String sender; - String status; - String subtitle; - String title; +class MessageNoticeDataItemModel { + String unreadCount; String type; - List transactions; + int id; + int receiver; + String content; + String skipIdentifier; + int status; + String dateTime; + MessageContent messageContent; - MessageNoticeDataItemModel({ - this.unread_count, - this.receiver, - this.body, - this.date_time, - this.id, - this.img, - this.main_preview, - this.oid, - this.sender, - this.status, - this.subtitle, - this.title, - this.type, - this.transactions, - }); + MessageNoticeDataItemModel({this.unreadCount, this.type, this.id, this.receiver, this.content, this.skipIdentifier, this.status, this.dateTime}); MessageNoticeDataItemModel.fromJson(Map json) { - super.fromJson(json); - unread_count = json['unread_count']?.toString(); - receiver = json['receiver']?.toString(); - body = json['body']?.toString(); - date_time = json['date_time']?.toString(); - id = json['id']?.toString(); - img = json['img']?.toString(); - main_preview = json['main_preview']?.toString(); - oid = json['oid']?.toString(); - sender = json['sender']?.toString(); - status = json['status']?.toString(); - subtitle = json['subtitle']?.toString(); - title = json['title']?.toString(); - type = json['type']?.toString(); - transactions = (!EmptyUtil.isEmpty(json['body']) && jsonDecode(json['body']) != null) - ? (jsonDecode(json['body']) as List).map((e) => TransactionBodyItemModel.fromJson(e)).toList() - : null; + unreadCount = json['unread_count']; + type = json['type']; + id = json['id']; + receiver = json['receiver']; + content = json['content']; + skipIdentifier = json['skip_identifier']; + status = json['status']; + dateTime = json['date_time']; + if(json['content']!=null){ + messageContent=MessageContent.fromJson(Con.json.decode(json['content'])); + } } Map toJson() { - final Map data = super.toJson(); - data['receiver'] = this.receiver; - data['body'] = this.body; - data['date_time'] = this.date_time; + final Map data = new Map(); + data['unread_count'] = this.unreadCount; + data['type'] = this.type; data['id'] = this.id; - data['img'] = this.img; - data['main_preview'] = this.main_preview; - data['oid'] = this.oid; - data['sender'] = this.sender; + data['receiver'] = this.receiver; + data['content'] = this.content; + data['skip_identifier'] = this.skipIdentifier; data['status'] = this.status; - data['subtitle'] = this.subtitle; - data['title'] = this.title; - data['type'] = this.type; - if (null != this.transactions) { - data['transactions'] = this.transactions.map((e) => e.toJson()).toList(); - } + data['date_time'] = this.dateTime; return data; } } -class TransactionBodyItemModel { - String data; - String text; - String type; +class MessageContent { + String title; + String content; + String image; - TransactionBodyItemModel({this.data, this.text, this.type}); + MessageContent({this.title, this.content, this.image}); - factory TransactionBodyItemModel.fromJson(Map json) { - return TransactionBodyItemModel( - data: json['data'], - text: json['text'], - type: json['type'], - ); + MessageContent.fromJson(Map json) { + title = json['title']; + content = json['content']; + image = json['image']; } Map toJson() { final Map data = new Map(); - data['data'] = this.data; - data['text'] = this.text; - data['type'] = this.type; + data['title'] = this.title; + data['content'] = this.content; + data['image'] = this.image; return data; } } diff --git a/lib/pages/withdraw_page/withdraw_page.dart b/lib/pages/withdraw_page/withdraw_page.dart index 9e02716..1feeda6 100644 --- a/lib/pages/withdraw_page/withdraw_page.dart +++ b/lib/pages/withdraw_page/withdraw_page.dart @@ -138,8 +138,9 @@ class _WithdrawContainerState extends State<_WithdrawContainer> { title: Text( model.appBarName, style: TextStyle( - fontSize: 15, + fontSize: 17, color: HexColor.fromHex(model.appBarNameColor), + fontWeight: FontWeight.w600 ), ), actions:[ GestureDetector( diff --git a/lib/register.dart b/lib/register.dart index 91bf2ca..146e883 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -108,7 +108,7 @@ class BaseWidgetRegister { }); Application.addMethod(() async { - AppConfigModel config = await AppConfigModel.init(); + AppConfigModel config = await AppConfigModel.init(isGetCache: true); if (config == null) { Logger.debug('app 初始化失败'); return; diff --git a/lib/widgets/home/home_goods/home_goods_header.dart b/lib/widgets/home/home_goods/home_goods_header.dart index c60be13..cc701aa 100644 --- a/lib/widgets/home/home_goods/home_goods_header.dart +++ b/lib/widgets/home/home_goods/home_goods_header.dart @@ -90,6 +90,10 @@ class _HomeGoodsHeaderState extends State<_HomeGoodsHeader> Widget build(BuildContext context) { _widgets.clear(); + if(_style.recommendList.length<2){ + return Container(); + } + for (int index = 0; index < _style.recommendList.length; index++) { _widgets.add(_HomeGoodsHeaderItem( _style.recommendList[index], diff --git a/lib/zhiying_base_widget.dart b/lib/zhiying_base_widget.dart index a86f45f..3287e08 100644 --- a/lib/zhiying_base_widget.dart +++ b/lib/zhiying_base_widget.dart @@ -1,3 +1,4 @@ library zhiying_base_widget; export 'dialog/loading/loading.dart'; +export 'package:flutter_swiper/flutter_swiper.dart'; \ No newline at end of file