From 1959af55fb9554b7f51a00a99dbd7b78764fa747 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Sat, 20 Feb 2021 14:50:33 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E5=88=86=E4=BA=AB=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=98=AF=E7=9A=84=E6=8C=89=E9=92=AE=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/android/app/build.gradle | 4 ++-- .../goods_share_image/goods_share_image.dart | 2 +- .../goods_share_link/goods_share_link.dart | 2 +- .../models/goods_share_style_model.dart | 2 ++ lib/pages/home_page/home_page.dart | 20 +++++++++++-------- pubspec.yaml | 2 ++ 6 files changed, 20 insertions(+), 12 deletions(-) diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index 199de77..b001aef 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -113,9 +113,9 @@ android { // 智夜生活 zhiying { applicationId "cn.zhios.zhiying" - versionCode 45 + versionCode 46 dimension "app" - versionName '1.3.3' + versionName '1.3.4' // 签名信息 signingConfig signingConfigs.zhiying } diff --git a/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart b/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart index ffb644c..96d814a 100644 --- a/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart +++ b/lib/pages/goods_share_page/goods_share_image/goods_share_image.dart @@ -363,7 +363,7 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A BuildContext buildContext = _globalKey.currentContext; if (null != buildContext) { RenderRepaintBoundary boundary = buildContext.findRenderObject(); - ui.Image image = await boundary.toImage(pixelRatio: 2.0); + ui.Image image = await boundary.toImage(pixelRatio: 1.5); // 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List pngBytes = byteData.buffer.asUint8List(); diff --git a/lib/pages/goods_share_page/goods_share_link/goods_share_link.dart b/lib/pages/goods_share_page/goods_share_link/goods_share_link.dart index b40199e..1acc067 100644 --- a/lib/pages/goods_share_page/goods_share_link/goods_share_link.dart +++ b/lib/pages/goods_share_page/goods_share_link/goods_share_link.dart @@ -180,7 +180,7 @@ class _GoodsShareLinkContentState extends State<_GoodsShareLinkContent> } Widget _createBottom() { - Map shareImages = _style?.cssList?.shareImage; + Map shareImages = _style?.cssList?.shareLink; if (shareImages == null) { return Container(); } diff --git a/lib/pages/goods_share_page/models/goods_share_style_model.dart b/lib/pages/goods_share_page/models/goods_share_style_model.dart index af8773c..cd3875f 100644 --- a/lib/pages/goods_share_page/models/goods_share_style_model.dart +++ b/lib/pages/goods_share_page/models/goods_share_style_model.dart @@ -10,6 +10,7 @@ class GoodsShareStyleModel { String rewardText; Map shareImage; GoodsShareTempEditorModel editTemplate; + Map shareLink; GoodsShareStyleModel( {this.unChooseColor, @@ -31,6 +32,7 @@ class GoodsShareStyleModel { rewardImage = json['reward_image']; rewardText = json['reward_text']; shareImage = json['share_image']; + shareLink=json['share_link']; if (json['edit_template'] != null) { editTemplate = GoodsShareTempEditorModel.fromJson( Map.from(json['edit_template'])); diff --git a/lib/pages/home_page/home_page.dart b/lib/pages/home_page/home_page.dart index 2a17532..dbba4fc 100644 --- a/lib/pages/home_page/home_page.dart +++ b/lib/pages/home_page/home_page.dart @@ -50,13 +50,19 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker int _currentIndex = 0; List> _data = List(); static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); + StreamSubscription streamSubscription; @override void initState() { - ///初始化一些数据 initAsync(); + //如果登出则重新打开首页 + streamSubscription = EventUtil.instance.on().listen((event) { + Navigator.maybePop(context); + Navigator.pushReplacementNamed(context, "/homePage"); + }); + super.initState(); } @@ -64,10 +70,11 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker initAsync() async { try { WidgetsBinding.instance.addObserver(this); + ///渲染完第一帧后调用 WidgetsBinding.instance.addPostFrameCallback((timeStamp) { - int delay=((num.tryParse(AppConfigModel.appStartDelay)??0.5)*1000).toInt(); - Timer(Duration(milliseconds: delay), (){ + int delay = ((num.tryParse(AppConfigModel.appStartDelay) ?? 0.5) * 1000).toInt(); + Timer(Duration(milliseconds: delay), () { NativeUtil.notifyInitSuccess(); }); }); @@ -137,6 +144,7 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker @override void dispose() { WidgetsBinding.instance.removeObserver(this); + streamSubscription.cancel(); super.dispose(); } @@ -262,8 +270,6 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker /// 3、活动弹窗 /// Future _showPolicy() async { - - // 通知弹窗 String isShowNotiPermission = await SharedPreferencesUtil.getStringValue(Constants.isShowNotiPermission); if (isShowNotiPermission == null || isShowNotiPermission != '1') { @@ -329,8 +335,7 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker void showAlert(String text, BuildContext context) { showDialog( context: context, - builder: (BuildContext context) => - CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: [ + builder: (BuildContext context) => CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: [ new FlatButton( child: new Text("OK"), onPressed: () { @@ -339,5 +344,4 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker ) ])); } - } diff --git a/pubspec.yaml b/pubspec.yaml index 7c52f17..0a40247 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -53,6 +53,8 @@ dependencies: loading_indicator: ^1.2.0 mobpush_plugin: + plugin_platform_interface: ^1.0.1 + permission_handler_platform_interface: ^2.0.1