From 18a64ab0815ea5219145ca42adb933170cc1225c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyanghuaxuan=E2=80=9D?= <“646903573@qq.com”> Date: Tue, 9 Mar 2021 10:51:43 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E7=83=AD=E6=A6=9C=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=202.=E4=BC=98=E5=8C=96=E5=85=AC=E5=85=B1=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E6=B7=BB=E5=8A=A0data=E5=8F=82=E6=95=B0=203.=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=9B=BE=E7=89=87=E5=88=86=E4=BA=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainActivity.java | 35 ++++++------------- example/lib/main.dart | 17 ++++----- .../goods_share_image/goods_share_image.dart | 19 +++++----- .../hot_ranking_page/hot_ranking_page_sk.dart | 2 +- .../mine_detail_page/mine_detail_page.dart | 2 +- lib/register.dart | 5 ++- .../custom/multi_nav/custom_quick_entry.dart | 4 ++- .../model/custom_quick_entry_model.dart | 3 ++ .../models/home_goods_list_style_model.dart | 2 +- .../hot_ranking_list/hot_ranking_bloc.dart | 7 ++++ .../hot_ranking_list/hot_ranking_list_sk.dart | 16 ++++----- lib/widgets/share/share_alert_select.dart | 24 ++++++++++++- pubspec.yaml | 1 - 13 files changed, 80 insertions(+), 57 deletions(-) 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 82e5a81..33e1cda 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 @@ -85,39 +85,26 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN view.addView(launchImageFrame, params); } - Timer timer=new Timer(); + 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"))); + + 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); - + Log.d("----------------", "----------------------清除启动页---------------"); + view.removeView(launchImageFrame); + launchImageFrame = null; + view = null; } - } + @Override protected void onNewIntent(@NonNull Intent intent) { super.onNewIntent(intent); @@ -167,8 +154,8 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN @Override public Map getSetting() { Map map = new HashMap(); - map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); -// map.put("domain", "http://api.zhios.cn/");45678910, + map.put("domain", "http://inapi.izhyin.cn/"); //"http://120.76.175.204:8989"); + // map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn68703914 map.put("master_id", "123456"); map.put("secret_key", "123456"); // map.put("token", "123465"); diff --git a/example/lib/main.dart b/example/lib/main.dart index 0a1fb93..bce11b8 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -119,18 +119,15 @@ class _MyAppState extends State { print("change language ${locale.toString()}"); return locale; }, - home: GestureDetector( - onTap: () { - FocusScopeNode currentFocus = FocusScope.of(context); - if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) { - FocusManager.instance.primaryFocus.unfocus(); - } - }, - child: LaunchPage( - // builder: (context) => HomePage(), - ), + home: LaunchPage( + // builder: (context) => HomePage(), ), ), ); } } + +// FocusScopeNode currentFocus = FocusScope.of(context); +// if (!currentFocus.hasPrimaryFocus && currentFocus.focusedChild != null) { +// FocusManager.instance.primaryFocus.unfocus(); +// } \ No newline at end of file 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 96d814a..8e924c1 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 @@ -27,6 +27,7 @@ import 'package:zhiying_base_widget/widgets/public/custom_button/custom_button_m import 'package:zhiying_base_widget/widgets/share/models/share_data_model.dart'; import 'package:zhiying_base_widget/widgets/share/share_alert.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; class GoodsShareImage extends StatefulWidget { final Map model; @@ -177,15 +178,15 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A ); List moreImageList = List(); - try{ + try { moreImageList = List.from(widget?.params['image_url_list']).map((e) => e.toString()).toList(); - }catch(e,s){ + } catch (e, s) { print(e); print(s); } _style.customImage.addAll(moreImageList); - _style.customImage=_style.customImage.reversed.toList(); + _style.customImage = _style.customImage.reversed.toList(); for (int index = 0; index < _style.customImage.length; index++) { String image = _style.customImage[index]; // 分享图片 @@ -344,17 +345,16 @@ class _GoodsShareImageContentState extends State<_GoodsShareImageContent> with A } List paths = await ImageDownloadUtil.download(images); - for(var item in paths){ + for (var item in paths) { Uint8List data = File(item).readAsBytesSync(); isSaveSuccess = await SaveImage.save(imageBytes: data); } if (isSaveSuccess) { Fluttertoast.showToast(msg: '保存成功'); - } else{ + } else { Fluttertoast.showToast(msg: '保存失败'); } - Loading.dismiss(); } @@ -363,11 +363,14 @@ 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: 1.5); + ui.Image image = await boundary.toImage(pixelRatio: 4); // 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba + Loading.show(context); ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List pngBytes = byteData.buffer.asUint8List(); - _shareModel.poster = pngBytes; + File file = await EncodeUtil.compressImage(context,images: pngBytes, size: 200); + Loading.dismiss(); + _shareModel.poster = file.readAsBytesSync(); } } else { _shareModel.poster = null; diff --git a/lib/pages/hot_ranking_page/hot_ranking_page_sk.dart b/lib/pages/hot_ranking_page/hot_ranking_page_sk.dart index caefe4d..905bdc9 100644 --- a/lib/pages/hot_ranking_page/hot_ranking_page_sk.dart +++ b/lib/pages/hot_ranking_page/hot_ranking_page_sk.dart @@ -35,7 +35,7 @@ class HotRankingPageSkeleton extends StatelessWidget { _buildBottomListItem() { List listWidget = List(); - for (var index = 0; index < 3; index++) { + for (var index = 0; index < 10; index++) { listWidget.add(Container( margin: EdgeInsets.only(left: 16, top: 10, bottom: 10), child: Row( diff --git a/lib/pages/mine_detail_page/mine_detail_page.dart b/lib/pages/mine_detail_page/mine_detail_page.dart index 7bee974..a5fcb68 100644 --- a/lib/pages/mine_detail_page/mine_detail_page.dart +++ b/lib/pages/mine_detail_page/mine_detail_page.dart @@ -316,7 +316,7 @@ class _MineDetailContainerState extends State<_MineDetailContainer> { if (cropperFile == null) { return; } - File resultFile = await EncodeUtil.compressImage(cropperFile, 800); + File resultFile = await EncodeUtil.compressImage(context,file:cropperFile,size: 800); Loading.show(context); _bloc.uploadAvatar(resultFile); } diff --git a/lib/register.dart b/lib/register.dart index 80e9ae8..acc83e7 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -132,6 +132,10 @@ class BaseWidgetRegister { Jdsdk.init(appKey: config.keys?.jdAndroid?.appkey ?? '', appSecret: config.keys?.jdAndroid?.secret ?? ''); } SharesdkPlugin.regist(register); + + ///微信支付初始化 + bool result = await SyFlutterWechat.register(config?.keys?.weixin?.appId); + print(result); }); // MOB 秒验 @@ -200,7 +204,6 @@ class BaseWidgetRegister { /// 反馈列表页 PageFactory.regist('pub.flutter.feedback_list', (model) => FeedbackRecordPage(model)); - /// 提现页 PageFactory.regist('pub.flutter.cash_out', (model) => WithdrawPage(model)); diff --git a/lib/widgets/custom/multi_nav/custom_quick_entry.dart b/lib/widgets/custom/multi_nav/custom_quick_entry.dart index fed64a0..fb37600 100644 --- a/lib/widgets/custom/multi_nav/custom_quick_entry.dart +++ b/lib/widgets/custom/multi_nav/custom_quick_entry.dart @@ -390,7 +390,9 @@ class __CustomQuickEntryContainerState extends State<_CustomQuickEntryContainer> return GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => _itemIconClick(item), + onTap: () { + _itemIconClick(item); + }, child: Container( height: itemHeight, width: 60, diff --git a/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart b/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart index 5c453d9..c4cb398 100644 --- a/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart +++ b/lib/widgets/custom/multi_nav/model/custom_quick_entry_model.dart @@ -153,6 +153,7 @@ class ListStyle extends SkipModel{ String requiredTaobaoAuth; String skipIdentifier; + ListStyle( {this.img, this.title, @@ -173,6 +174,7 @@ class ListStyle extends SkipModel{ requiredLogin = json['required_login']; requiredTaobaoAuth = json['required_taobao_auth']; skipIdentifier = json['skip_identifier']; + } Map toJson() { @@ -185,6 +187,7 @@ class ListStyle extends SkipModel{ data['required_login'] = this.requiredLogin; data['required_taobao_auth'] = this.requiredTaobaoAuth; data['skip_identifier'] = this.skipIdentifier; + return data; } } diff --git a/lib/widgets/home/home_goods/models/home_goods_list_style_model.dart b/lib/widgets/home/home_goods/models/home_goods_list_style_model.dart index af660f6..b63ded9 100644 --- a/lib/widgets/home/home_goods/models/home_goods_list_style_model.dart +++ b/lib/widgets/home/home_goods/models/home_goods_list_style_model.dart @@ -33,7 +33,7 @@ class HomeGoodsListStyleModel { }); HomeGoodsListStyleModel.fromJson(Map json) { - hotRankIconList = json['hot_rank_icon_list'].cast(); + hotRankIconList = json['hot_rank_icon_list']. cast(); topMargin = json['top_margin']; listColumn = json['list_column']; leftRighMargin = json['left_righ_margin']; diff --git a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart index 5eb4ab3..755e9a1 100644 --- a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart +++ b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart @@ -23,6 +23,8 @@ class HotRankingListBloc extends BlocBase { bool isLoading = false; + bool isFirst=true; + @override void dispose() { _dataController.close(); @@ -35,6 +37,11 @@ class HotRankingListBloc extends BlocBase { // return; // } // isLoading = true; + if(isFirst){ + isFirst=false; + await Future.delayed(Duration(milliseconds: 300)); + } + currentTypeId = typeId; NetUtil.request('/api/v1/rec?pvd=taobao&category_id=' + typeId + '&page=' + page.toString(), method: NetMethod.GET, onCache: (data) { complete(); diff --git a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart index fb0b167..2cef462 100644 --- a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart +++ b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list_sk.dart @@ -10,13 +10,13 @@ class HotRankingSkeleton extends StatelessWidget { child: Column( mainAxisSize: MainAxisSize.min, children: [ - Container( - width: double.infinity, - margin: EdgeInsets.all(16), - height: 48, - child: Row( - children: _buildTopRow(), - )), + // Container( + // width: double.infinity, + // margin: EdgeInsets.all(16), + // height: 48, + // child: Row( + // children: _buildTopRow(), + // )), Expanded( child: Container( child: Column( @@ -30,7 +30,7 @@ class HotRankingSkeleton extends StatelessWidget { _buildBottomListItem() { List listWidget = List(); - for (var index = 0; index < 3; index++) { + for (var index = 0; index < 10; index++) { listWidget.add(Container( margin: EdgeInsets.only(left: 16,top: 10,bottom: 10), child: Row( diff --git a/lib/widgets/share/share_alert_select.dart b/lib/widgets/share/share_alert_select.dart index beffe8a..062f64b 100644 --- a/lib/widgets/share/share_alert_select.dart +++ b/lib/widgets/share/share_alert_select.dart @@ -106,10 +106,11 @@ class _ShareAlertSelectState extends State { if (null != buildContext) { RenderRepaintBoundary boundary = buildContext.findRenderObject(); ///pixelRatio是放大倍数 - ui.Image image = await boundary.toImage(pixelRatio: 1); + ui.Image image = await boundary.toImage(pixelRatio: 5); // 注意:png是压缩后格式,如果需要图片的原始像素数据,请使用rawRgba ByteData byteData = await image.toByteData(format: ui.ImageByteFormat.png); Uint8List pngBytes = byteData.buffer.asUint8List(); + _shareModel.poster = pngBytes; } else { _shareModel.poster = null; @@ -370,6 +371,27 @@ class _ShareAlertContentState extends State<_ShareAlertContent> { ), ), onTap: () async { + + Loading.show(context); + + await Future.delayed(Duration(seconds: 2)); + + if(_shareDataModel.image!=null){ + for(var image in _shareDataModel.image){ + File file = await EncodeUtil.compressImage(context,file: File(image), size: 200); + image=file.path; + } + Loading.dismiss(); + } + + if(_shareDataModel?.poster!=null){ + File file = await EncodeUtil.compressImage(context,images: _shareDataModel?.poster, size: 200); + _shareDataModel.poster=file.readAsBytesSync(); + Loading.dismiss(); + } + + + //检查是否有存储权限 var status = await Permission.storage.status; if (!status.isGranted) { diff --git a/pubspec.yaml b/pubspec.yaml index 0a40247..842c5cb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,7 +37,6 @@ dependencies: # 列表滑动删除 flutter_slidable: 0.5.7 # image_gallery_saver: ^1.6.0 - permission_handler: git: ref: 0.0.1