diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 7ca3eba..8ad1ad1 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -112,9 +112,9 @@ android { // 智夜生活 zhiying { applicationId "cn.zhios.zhiying" - versionCode 35 + versionCode 37 dimension "app" - versionName '1.2.35' + versionName '1.2.37' // 签名信息 signingConfig signingConfigs.zhiying } @@ -227,6 +227,8 @@ MobSDK { enable true } QZone { + appId "1111030588" + appKey "XoHKlrBybXy7ORBt" enable true } SinaWeibo { diff --git a/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart b/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart index 612a71d..01c46e7 100644 --- a/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart +++ b/lib/dialog/global_dialog/activity_dialog/activity_dialog.dart @@ -18,12 +18,15 @@ class ActivityDialog extends StatelessWidget { try { Map result = await NetUtil.post('/api/v1/mod/pub.flutter.current_activity_dialog', method: NetMethod.GET); if (!EmptyUtil.isEmpty(result)) { - var modListData = result['data']['mod_list'][0]['data']; - if (!EmptyUtil.isEmpty(modListData)) { - Map da = Map.from(jsonDecode(modListData)); - ActivityDialogModel model = ActivityDialogModel.fromJson(Map.from(da)); - if(!EmptyUtil.isEmpty(model) && model.isOpen == '1' ) { - return await showCupertinoDialog(context: context, builder: (_) => ActivityDialog(model)); + var dialogList=result['data']['mod_list']; + for(var item in dialogList){ + var modListData = item['data']; + if (!EmptyUtil.isEmpty(modListData)) { + Map da = Map.from(jsonDecode(modListData)); + ActivityDialogModel model = ActivityDialogModel.fromJson(Map.from(da)); + if(!EmptyUtil.isEmpty(model) && model.isOpen == '1' ) { + return await showCupertinoDialog(context: context, builder: (_) => ActivityDialog(model)); + } } } } @@ -36,7 +39,9 @@ class ActivityDialog extends StatelessWidget { void _jumpTo(BuildContext context){ Navigator.maybePop(context); if(!EmptyUtil.isEmpty(model)){ - RouterUtil.route(model, model.toJson(), context); + + RouterUtil.route(model, model.toJson(), context); + } } diff --git a/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart b/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart new file mode 100644 index 0000000..ceb8609 --- /dev/null +++ b/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart @@ -0,0 +1,90 @@ +import 'dart:convert'; + +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +import 'package:zhiying_comm/zhiying_comm.dart'; + +import '../activity_dialog/activity_dialog_model.dart'; +import 'advertising_model.dart'; + +/// +/// 广告弹窗接口 +/// +class AdvertisingDialog extends StatelessWidget { + final AdvertisingDialogModel model; + + const AdvertisingDialog(this.model, {Key key}) : super(key: key); + + static Future show(BuildContext context) async { + try { + Map result = await NetUtil.post('/api/v1/app/push_dialog', method: NetMethod.GET); + if (!EmptyUtil.isEmpty(result)) { + var dialogList = result['data']; + for (var item in dialogList) { + if (!EmptyUtil.isEmpty(item)) { + AdvertisingDialogModel model = AdvertisingDialogModel.fromJson(item); + if (!EmptyUtil.isEmpty(model)) { + await Future.delayed(Duration(milliseconds: model?.interval*1000)); + await showCupertinoDialog(context: context, builder: (_) => AdvertisingDialog(model)); + } + } + } + } + } catch (e, s) { + Logger.error(e, s); + } + } + + /// 跳转 + void _jumpTo(BuildContext context) { + Navigator.maybePop(context); + RouterUtil.route(SkipModel.fromJson(json.decode(model?.skip)), json.decode(model?.skip), context); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.transparent, + body: Container( + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + /// 图片 + GestureDetector( + onTap: () => _jumpTo(context), + behavior: HitTestBehavior.opaque, + child: Container( + // margin: const EdgeInsets.symmetric(horizontal: 40), + width: MediaQuery.of(context).size.width * 0.7, + child: CachedNetworkImage( + fadeInDuration: Duration(milliseconds: 0), + imageUrl: model?.image ?? '', + fit: BoxFit.fitWidth, + ), + ), + ), + + /// 关闭按钮 + GestureDetector( + child: Container( + width: 30, + height: 30, + margin: EdgeInsets.only(top: 10), + child: Icon( + Icons.cancel, + color: Colors.white, + size: 32, + )), + onTap: () { + Navigator.pop(context); + }, + ) + ], + ), + ), + ); + } +} diff --git a/lib/dialog/global_dialog/advertising_dialog/advertising_model.dart b/lib/dialog/global_dialog/advertising_dialog/advertising_model.dart new file mode 100644 index 0000000..f45bc68 --- /dev/null +++ b/lib/dialog/global_dialog/advertising_dialog/advertising_model.dart @@ -0,0 +1,68 @@ +class AdvertisingDialogModel { + int id; + int uid; + String name; + String conditionType; + String condition; + String position; + String image; + int interval; + String skip; + int type; + String popupTime; + int state; + String createAt; + String updateAt; + + AdvertisingDialogModel( + {this.id, + this.uid, + this.name, + this.conditionType, + this.condition, + this.position, + this.image, + this.interval, + this.skip, + this.type, + this.popupTime, + this.state, + this.createAt, + this.updateAt}); + + AdvertisingDialogModel.fromJson(Map json) { + id = json['id']; + uid = json['uid']; + name = json['name']; + conditionType = json['condition_type']; + condition = json['condition']; + position = json['position']; + image = json['image']; + interval = json['interval']; + skip = json['skip']; + type = json['type']; + popupTime = json['popup_time']; + state = json['state']; + createAt = json['create_at']; + updateAt = json['update_at']; + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['uid'] = this.uid; + data['name'] = this.name; + data['condition_type'] = this.conditionType; + data['condition'] = this.condition; + data['position'] = this.position; + data['image'] = this.image; + data['interval'] = this.interval; + data['skip'] = this.skip; + data['type'] = this.type; + data['popup_time'] = this.popupTime; + data['state'] = this.state; + data['create_at'] = this.createAt; + data['update_at'] = this.updateAt; + return data; + } +} diff --git a/lib/models/app_config_model.dart b/lib/models/app_config_model.dart index 6dcc1a1..4ab6574 100644 --- a/lib/models/app_config_model.dart +++ b/lib/models/app_config_model.dart @@ -54,7 +54,7 @@ class AppConfigModel { keys = json['keys'] != null ? new AppConfigKeyModel.fromJson(json['keys']) : null; guideImage = json['guide_image'] != null ? new AppConfigGuideModel.fromJson(json['guide_image']) : null; guideData = json['guide_data'] != null ? GuideData.fromJson(json['guide_data']) : null; - appStartDelay=json['app_start_delay']; + appStartDelay=json['app_start_delay']!=null?json['app_start_delay']:'0.5'; } Map toJson() { diff --git a/lib/pages/goods_details_page/goods_details_page.dart b/lib/pages/goods_details_page/goods_details_page.dart index 746fdf4..9745472 100644 --- a/lib/pages/goods_details_page/goods_details_page.dart +++ b/lib/pages/goods_details_page/goods_details_page.dart @@ -315,7 +315,7 @@ class _FloatViewState extends State with TickerProviderStateMixin { setState(() {}); }); - // animationController.repeat(reverse: true); + animationController.repeat(reverse: true); super.initState(); } @@ -328,7 +328,7 @@ class _FloatViewState extends State with TickerProviderStateMixin { @override Widget build(BuildContext context) { - return Container(); + // return Container(); return Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/lib/pages/home_page/home_page.dart b/lib/pages/home_page/home_page.dart index 394389a..2a17532 100644 --- a/lib/pages/home_page/home_page.dart +++ b/lib/pages/home_page/home_page.dart @@ -16,6 +16,7 @@ import 'package:mobpush_plugin/mobpush_notify_message.dart'; import 'package:mobpush_plugin/mobpush_plugin.dart'; import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/activity_dialog/activity_dialog.dart'; +import 'package:zhiying_base_widget/dialog/global_dialog/advertising_dialog/advertising_dialog.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/notification_setting_dialog/notification_setting_dialog.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/policy_dialog/policy_dialog.dart'; @@ -271,7 +272,7 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker } // 活动弹窗 - await ActivityDialog.show(context); + await AdvertisingDialog.show(context); await AppUpdateUtil.updateApp(context); diff --git a/lib/widgets/custom/notice/custom_notice_widget.dart b/lib/widgets/custom/notice/custom_notice_widget.dart index 83fddfd..2e2ddd8 100644 --- a/lib/widgets/custom/notice/custom_notice_widget.dart +++ b/lib/widgets/custom/notice/custom_notice_widget.dart @@ -81,7 +81,7 @@ class _CustomNoticeWidgetContainerState extends State<_CustomNoticeWidgetContain right: ParseUtil.stringParseDouble(model?.leftRightMargin)), padding: EdgeInsets.symmetric(horizontal:7.5, vertical: 7.5), child: Container( - decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex('#F6F6F6')), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex(model?.outsideBgColor??'#F6F6F6')), padding: const EdgeInsets.only(top: 8, bottom: 8, left: 12, right: 8), width: double.infinity, child: _getChildWidget(model), diff --git a/lib/widgets/custom/notice/model/custom_notice_model.dart b/lib/widgets/custom/notice/model/custom_notice_model.dart index 588fe27..f759959 100644 --- a/lib/widgets/custom/notice/model/custom_notice_model.dart +++ b/lib/widgets/custom/notice/model/custom_notice_model.dart @@ -19,6 +19,7 @@ class CustomNoticeModel { String appNameImg; String jumpImg; String bg_color; + String outsideBgColor; List listStyle; CustomNoticeModel( @@ -68,6 +69,7 @@ class CustomNoticeModel { listStyle.add(new NoticeListStyle.fromJson(v)); }); } + outsideBgColor=json['outside_bg_color']!=null?json['outside_bg_color']:null; } Map toJson() { diff --git a/lib/widgets/custom/slide_banner/custom_slide_banner.dart b/lib/widgets/custom/slide_banner/custom_slide_banner.dart index e8efd8c..d66d587 100644 --- a/lib/widgets/custom/slide_banner/custom_slide_banner.dart +++ b/lib/widgets/custom/slide_banner/custom_slide_banner.dart @@ -119,23 +119,22 @@ class _CustomSlideBannerContainerState extends State Column( children: [ Flexible( - flex: 6, child: Container( + decoration: BoxDecoration( + color: size > 1 ? HexColor.fromHex(datas?.bgColor??"#00000000") : Colors.transparent, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(double.tryParse(datas?.topLeftRadius)??0), + topRight: Radius.circular(double.tryParse(datas?.topRightRadius)??0), + bottomRight: Radius.circular(double.tryParse(datas?.bottomRightRadius)??0), + bottomLeft: Radius.circular(double.tryParse(datas?.bottomLeftRadius)??0) + ) + ), width: double.infinity, height: double.infinity, - color: size > 1 ? HexColor.fromHex(datas?.bgColor2??"#00000000") : Colors.transparent, + // color: Colors.yellow, ), ), - Flexible( - flex: 4, - child: Container( - height: double.infinity, - width: double.infinity, - color: size > 1 ? HexColor.fromHex(datas?.bgColor??"#FFFFFF") : Colors.transparent, - // color: Colors.yellow, - ), - ) ], ), Padding( diff --git a/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart b/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart index d356152..ac2e74f 100644 --- a/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart +++ b/lib/widgets/custom/slide_banner/model/custom_slide_banner_model.dart @@ -21,6 +21,11 @@ class CustomSlideBannerModel { String bgColor2; List indexCarouselList; int moduleKeyId; + String topLeftRadius; + String topRightRadius; + String bottomLeftRadius; + String bottomRightRadius; + CustomSlideBannerModel({ this.name, @@ -64,6 +69,10 @@ class CustomSlideBannerModel { leftRightMargin = json['left_right_margin']; bgColor=json['bg_color']; bgColor2=json['bg_color2']; + topLeftRadius=json['top_left_radius']; + topRightRadius=json['top_right_radius']; + bottomRightRadius=json['bottom_right_radius']; + bottomLeftRadius=json['bottom_left_radius']; if (json['index_carousel_list'] != null) { indexCarouselList = new List(); json['index_carousel_list'].forEach((v) { diff --git a/lib/widgets/share/share_alert.dart b/lib/widgets/share/share_alert.dart index bf61443..ea2f4a7 100644 --- a/lib/widgets/share/share_alert.dart +++ b/lib/widgets/share/share_alert.dart @@ -1,3 +1,4 @@ +import 'dart:async'; import 'dart:convert'; import 'dart:io'; import 'dart:ui'; @@ -233,6 +234,10 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { } Loading.show(context); + Timer(Duration(milliseconds: 2000),(){ + Loading.dismiss(); + }); + SSDKMap params; if (widget.model.poster != null) { String path = await _savePoster(); @@ -263,11 +268,15 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { }else if(widget?.model?.title!=null||widget.model?.content!=null){ type=SSDKContentTypes.text; } + if(plateform==ShareSDKPlatforms.qZone){ + widget?.model?.title=null; + type=SSDKContentTypes.message; + } params = SSDKMap() ..setGeneral( - widget.model?.title ?? '123', - widget.model?.content ?? '', + widget.model?.title ?? '', + widget?.model?.content??'', Platform.isIOS ? widget.model.image : null, Platform.isAndroid ? widget?.model?.image?.first : null, null, diff --git a/lib/zhiying_base_widget.dart b/lib/zhiying_base_widget.dart index 3287e08..c210465 100644 --- a/lib/zhiying_base_widget.dart +++ b/lib/zhiying_base_widget.dart @@ -1,4 +1,6 @@ library zhiying_base_widget; export 'dialog/loading/loading.dart'; -export 'package:flutter_swiper/flutter_swiper.dart'; \ No newline at end of file +export 'package:flutter_swiper/flutter_swiper.dart'; +export 'package:zhiying_base_widget/pages/main_page/model/background_model.dart'; +export 'package:zhiying_base_widget/pages/custom_page/bloc/background_bloc.dart'; \ No newline at end of file