From 4959dd06264f84fd7562448713616913fff501cf Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Sat, 22 Jan 2022 14:26:43 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community_view/community_dynamic.dart | 4 ++-- lib/community/release_dynamic.dart | 2 +- lib/retrofit/min_api.dart | 8 ++++---- lib/retrofit/min_api.g.dart | 2 +- lib/retrofit/retrofit_api.dart | 8 ++++---- lib/retrofit/retrofit_api.g.dart | 2 +- lib/view_widget/custom_image.dart | 17 +++++++++++------ 7 files changed, 24 insertions(+), 19 deletions(-) diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 02c421ec..01ee9c1e 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -185,7 +185,7 @@ class _CommunityDynamic extends State { }, child: MImage( - (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg") + "?imageView2/1/w/200/h/200/format/jpg/q/75", + (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg"), width: 44, height: 44, isCircle: true, @@ -372,7 +372,7 @@ class _CommunityDynamic extends State { fit: BoxFit.contain, radius: BorderRadius.circular(2), width: MediaQuery.of(context).size.width/1.5, - height:MediaQuery.of(context).size.width, + height:MediaQuery.of(context).size.width/1.5, errorSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png", )), diff --git a/lib/community/release_dynamic.dart b/lib/community/release_dynamic.dart index 5d19ede5..6cffea20 100644 --- a/lib/community/release_dynamic.dart +++ b/lib/community/release_dynamic.dart @@ -110,7 +110,7 @@ class _ReleaseDynamic extends State { style: TextStyle( fontWeight: MyFontWeight.medium, fontSize: 14.sp, - color: Colors.black, + color: Color(0xFFA0A0A0), ), ),) ], diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 557ac24e..80e51624 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -21,15 +21,15 @@ import 'data/shoppingCart.dart'; part 'min_api.g.dart'; -// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 -const base_url = "http://192.168.10.236:8765/app/";///费韬 -const baseUrl = "http://192.168.10.236:8765/app/";///费韬 +// const base_url = "http://192.168.10.236:8765/app/";///费韬 +// const baseUrl = "http://192.168.10.236:8765/app/";///费韬 // const base_url = "http://192.168.10.142:8765/app/";///詹云久 diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 1c1cc751..02d9988a 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -9,7 +9,7 @@ part of 'min_api.dart'; class _MinApiService implements MinApiService { _MinApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8765/app/'; + baseUrl ??= 'https://pos.api.lotus-wallet.com/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 2bb9d4b8..c4b10859 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -54,14 +54,14 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 -const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.159:8766/app/"; ///费韬 // const baseUrl = "http://192.168.10.159:8766/app/"; ///费韬 diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index b39600ce..5735110a 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.142:8766/app/'; + baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; } final Dio _dio; diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index de07a63d..8c9f81f6 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -35,14 +35,19 @@ class MImage extends StatelessWidget { builder: (context, constraints) { String imageUrl = ""; ///压缩图片 - if (src != null && src != "" && src.startsWith("http")) { - String oper = src.contains("?") ? "" :"?"; - imageUrl = - "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" - "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; + // if (src != null && src != "" && src.startsWith("http")) { + // String oper = src.contains("?") ? "" :"?"; + // imageUrl = + // "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" + // "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; + // } + + ///压缩图片 + if (src != "" && src.startsWith("http")) { + imageUrl = "$src?imageView2/1/w/${(constraints.constrainWidth() * scaleIndex).toInt()}/h/${(constraints.constrainHeight() * scaleIndex).toInt()}/format/jpg/q/75"; } - // print(imageUrl); + // print("imageUrl:$imageUrl"); // print("constrainWidth: ${constraints.constrainWidth()}"); // print("constrainHeight: ${constraints.constrainHeight()}"); From 13f61ef139e8955c7affe2374e91d2d2d1cac080 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 24 Jan 2022 10:50:11 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=95=86=E5=93=81=E9=80=89=E8=A6=8F?= =?UTF-8?q?=E6=A0=BC=E4=BB=B7=E6=A0=BC=E6=98=BE=E7=A4=BA=E6=9B=B4=E6=94=B9?= =?UTF-8?q?;=20=E6=8E=A8=E8=8D=90=E5=88=B7=E6=96=B0=E6=9B=B4=E6=94=B9;=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85=E4=BC=98=E6=83=A0=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=9B=B4=E6=94=B9;=20=E4=BC=98=E6=83=A0=E5=88=B8?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=9B=B4=E6=94=B9;=20=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E8=A6=8F=E6=A0=BC=E6=98=BE=E7=A4=BA=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 11 ++++++++--- .../community_view/community_dynamic.dart | 3 +-- lib/home/home_view/coupon.dart | 6 +++--- lib/home/home_view/featured_acticvity.dart | 6 +++--- lib/integral/integral_detailed_page.dart | 1 + lib/settlement/settlement.dart | 8 ++++++-- lib/settlement/settlement_view/coupon.dart | 4 ++-- .../settlement_view/settlement_coupon.dart | 2 +- .../settlement_order_commodity.dart | 17 ++++++++++++----- lib/store/store_view/product_sku.dart | 16 ++++++++-------- lib/store/store_view/shop_goods.dart | 2 +- lib/store/store_view/store_order_list.dart | 7 +------ lib/view_widget/custom_image.dart | 4 ++-- lib/view_widget/text_image_dialog.dart | 2 +- 14 files changed, 50 insertions(+), 39 deletions(-) diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 0295df8b..051bf228 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -27,8 +27,9 @@ class CommunityChildPage extends StatefulWidget { class _CommunityChildPage extends State { RefreshController refreshController = RefreshController(); ApiService apiService; - int pageNum = 0; + int pageNum = 1; String userId; + bool isLoadMore = false; List
articles = []; @@ -39,7 +40,6 @@ class _CommunityChildPage extends State { } _onRefresh() async { - pageNum = 0; setState(() {}); } @@ -54,7 +54,11 @@ class _CommunityChildPage extends State { token: value.getString("token"), ); } - pageNum += 1; + if(isLoadMore){ + pageNum += 1; + isLoadMore = false; + } + else pageNum = 1; BaseData> baseData = await apiService.trendList({ "onlyFollow": widget.typeStr == "关注" ? true : false, "onlyMe": false, @@ -113,6 +117,7 @@ class _CommunityChildPage extends State { ), onRefresh: _onRefresh, onLoading: () { + isLoadMore = true; setState(() {}); }, child: ListView.builder( diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 01ee9c1e..c87e5207 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -368,10 +368,9 @@ class _CommunityDynamic extends State { ); }, child: MImage( - cnt["images"][0].replaceAll(".jpg", ".jpg?imageView2/0/q/75"), + cnt["images"][0], fit: BoxFit.contain, radius: BorderRadius.circular(2), - width: MediaQuery.of(context).size.width/1.5, height:MediaQuery.of(context).size.width/1.5, errorSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png", diff --git a/lib/home/home_view/coupon.dart b/lib/home/home_view/coupon.dart index 0f1f42b8..7114a1d7 100644 --- a/lib/home/home_view/coupon.dart +++ b/lib/home/home_view/coupon.dart @@ -87,12 +87,12 @@ class _CouponView extends State { Widget couponItem(Coupon coupon) { return Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: Stack( children: [ Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: SvgPicture.asset( "assets/svg/youhuiquan_bg.svg", @@ -102,7 +102,7 @@ class _CouponView extends State { ), ), Container( - width: 0.9.sw, + width: 0.9, height: 122.h, child: Row( children: [ diff --git a/lib/home/home_view/featured_acticvity.dart b/lib/home/home_view/featured_acticvity.dart index bab089a3..12324473 100644 --- a/lib/home/home_view/featured_acticvity.dart +++ b/lib/home/home_view/featured_acticvity.dart @@ -119,9 +119,9 @@ class _FeaturedActivity extends State { ), ), ), - SizedBox( - height: 5, - ), + // SizedBox( + // height: 5, + // ), // GestureDetector( // onTap: () { // Navigator.of(context).pushNamed('/router/web_page', diff --git a/lib/integral/integral_detailed_page.dart b/lib/integral/integral_detailed_page.dart index c943880c..390dcd7c 100644 --- a/lib/integral/integral_detailed_page.dart +++ b/lib/integral/integral_detailed_page.dart @@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index eb7905b2..3d120e31 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -307,7 +307,9 @@ class _Settlement extends State { } BaseData baseData = await minService .settlementWx(placeOrderFirst.toJson()) - .catchError((error) {}); + .catchError((error) { + print(error); + }); if (baseData != null && baseData.isSuccess) { WxPay wxPay = baseData.data; await registerWxApi( @@ -332,7 +334,9 @@ class _Settlement extends State { } else { BaseData baseData = await minService .settlementApi(placeOrderFirst.toJson()) - .catchError((error) {}); + .catchError((error) { + print(error); + }); if (baseData != null && baseData.isSuccess) { toOrderDetails(placeOrderFirst.id); } else { diff --git a/lib/settlement/settlement_view/coupon.dart b/lib/settlement/settlement_view/coupon.dart index bae2b62b..2eb17ba3 100644 --- a/lib/settlement/settlement_view/coupon.dart +++ b/lib/settlement/settlement_view/coupon.dart @@ -171,8 +171,8 @@ class _CouponWidget extends State { }, child: Image.asset( widget.selected - ? "assets/image/icon_radio_unselected.png" - : "assets/image/icon_radio_selected.png", + ? "assets/image/icon_radio_selected.png" + : "assets/image/icon_radio_unselected.png", width: 24, height: 24, ), diff --git a/lib/settlement/settlement_view/settlement_coupon.dart b/lib/settlement/settlement_view/settlement_coupon.dart index d9bf735f..a8469317 100644 --- a/lib/settlement/settlement_view/settlement_coupon.dart +++ b/lib/settlement/settlement_view/settlement_coupon.dart @@ -115,7 +115,7 @@ class _SettlementCoupon extends State { return CouponWidget( couponCan[position], widget.storeInfo, - selected: widget.couponBean == couponCan[position], + selected: widget?.couponBean?.id == couponCan[position]?.id, ); }, ), diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 67529d5b..ea89f6ab 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -122,7 +122,7 @@ class _SettlementOrderCommodity extends State { children: [ MImage( productList.skuImg, - width: 44.w, + width: 44, height: 44, fit: BoxFit.cover, errorSrc: "assets/image/default_1.png", @@ -342,10 +342,7 @@ class _SettlementOrderCommodity extends State { ), Container( child: Text( - "已优惠:¥${(widget.minOrderInfo != null) ? (double.parse(widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0")) : - (double.parse(widget.tableId <= 0 ? "0" : (widget.settleOrderInfo.discountAmount ?? "0")) - + double.parse(widget?.settleOrderInfo?.benefitDiscountAmount ?? "0")) - }", + "已优惠:¥${discountPrice()}", style: TextStyle( fontSize: 12.sp, color: Color(0xFF7B7B7B), @@ -384,6 +381,16 @@ class _SettlementOrderCommodity extends State { ); } + String discountPrice(){ + if(widget.minOrderInfo != null){ + return (widget.minOrderInfo.discountAmount ?? "0") + double.parse(widget.settleOrderInfo.benefitDiscountAmount ?? "0"); + }else if(widget.tableId < 0){ + return "0"; + }else { + return widget?.settleOrderInfo?.discountAmount ?? "0"; + } + } + String totalPrice() { if (widget.minOrderInfo != null && widget.minOrderInfo.orderProductVOList != null) { diff --git a/lib/store/store_view/product_sku.dart b/lib/store/store_view/product_sku.dart index 8e7f6e0a..eb6b34b2 100644 --- a/lib/store/store_view/product_sku.dart +++ b/lib/store/store_view/product_sku.dart @@ -34,8 +34,8 @@ class ProductSku extends StatefulWidget { class _ProductSku extends State { List selectSkus = []; - int count = 1; + String selectedPrice = ""; @override void initState() { @@ -59,6 +59,7 @@ class _ProductSku extends State { return; } if (productSku == null) return; + selectedPrice = productSku.skuPrice; String skuId = productSku.id; if (widget.shopCarGoods == null || widget.shopCarGoods.shoppingCartSkuItemList == null) return; int shopSkuIndex = widget.shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); @@ -98,6 +99,7 @@ class _ProductSku extends State { height: MediaQuery.of(context).size.height / 3 * 2, width: double.infinity, decoration: BoxDecoration( + // color: Color(0xFFFAFAFA), color: Color(0xFFFAFAFA), borderRadius: BorderRadius.only( topLeft: Radius.circular(8), @@ -123,7 +125,7 @@ class _ProductSku extends State { SizedBox( width: 10, ), - Expanded(child: Column( + Expanded(child:Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( @@ -159,7 +161,7 @@ class _ProductSku extends State { ), ), Text( - widget.miNiDetail.price, + selectedPrice, style: TextStyle( color: Color(0xFFFF7A1A), fontSize: 14.sp, @@ -169,9 +171,7 @@ class _ProductSku extends State { ], ), ], - )) - , - Spacer(), + )), InkWell( onTap: () { // Navigator.of(context).pop(); @@ -352,12 +352,12 @@ class _ProductSku extends State { Widget sweetnessItem(String name, bool isCheck) { return Container( child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( width: 70.w, - height: 29.h, + height:30.h, alignment: Alignment.center, decoration: BoxDecoration( color: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 56fd25d3..d8051136 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -198,7 +198,7 @@ class _ShopGoods extends State { ), ), if (widget.isShopCart || (widget.productListBean?.attrStyle??0) == 0) - InkWell( + GestureDetector( onTap: () { widget.add(widget.shoppingCartSkuItemListBean); }, diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index ae7cf7e8..0f4e50f4 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -230,11 +230,7 @@ class _StoreOrderListPage extends State { } }); } - return InkWell( - onTap: () { - widget.queryMiNiDetail(productListBeans[position].id,1); - }, - child: ShopGoods( + return ShopGoods( (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { widget.queryMiNiDetail(productListBeans[position].id,1); }, @@ -247,7 +243,6 @@ class _StoreOrderListPage extends State { isShopCart: false, queryMiNiDetail: widget.queryMiNiDetail, shoppingCartSkuItemListBean: shoppingCartSkuItemListBean, - ), ); } } diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index 8c9f81f6..e03f81d5 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -43,8 +43,8 @@ class MImage extends StatelessWidget { // } ///压缩图片 - if (src != "" && src.startsWith("http")) { - imageUrl = "$src?imageView2/1/w/${(constraints.constrainWidth() * scaleIndex).toInt()}/h/${(constraints.constrainHeight() * scaleIndex).toInt()}/format/jpg/q/75"; + if ((src??"").startsWith("http")) { + imageUrl = "$src?imageView2/1/format/jpg/q/50"; } // print("imageUrl:$imageUrl"); diff --git a/lib/view_widget/text_image_dialog.dart b/lib/view_widget/text_image_dialog.dart index 119fbddf..074f64ce 100644 --- a/lib/view_widget/text_image_dialog.dart +++ b/lib/view_widget/text_image_dialog.dart @@ -38,7 +38,7 @@ class _TextImageWidget extends State { child: Center( child: Container( width: double.infinity, - margin: EdgeInsets.symmetric(horizontal:16.w), + margin: EdgeInsets.symmetric(horizontal:26.w), padding: EdgeInsets.symmetric(vertical: 20.h, horizontal: 24.w), decoration: BoxDecoration( color: Colors.white, From a631a134eddc677c46ace774e79699f9063ca6cc Mon Sep 17 00:00:00 2001 From: Loki <654612@qq.com> Date: Mon, 24 Jan 2022 13:49:36 +0800 Subject: [PATCH 3/5] image pre cached |view controller inited --- ios/Podfile.lock | 27 +++++----- ios/Runner.xcodeproj/project.pbxproj | 5 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- lib/community/community_page.dart | 29 +++++------ .../community_view/community_dynamic.dart | 51 +------------------ lib/community/photo_view_gallery_screen.dart | 3 +- 6 files changed, 32 insertions(+), 85 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 814fbd6c..bba069cf 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -143,9 +143,6 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.0): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) - - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.0): - - mob_sharesdk/ShareSDK - - MOBFoundation (>= 3.2.9) - mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.0): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) @@ -173,7 +170,7 @@ PODS: - SDWebImage (5.12.1): - SDWebImage/Core (= 5.12.1) - SDWebImage/Core (5.12.1) - - shared_preferences (0.0.1): + - shared_preferences_ios (0.0.1): - Flutter - sharesdk_plugin (1.1.2): - Flutter @@ -207,12 +204,12 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/Twitter - mob_sharesdk/ShareSDKPlatforms/VKontakte - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo - - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite - mob_sharesdk/ShareSDKPlatforms/WhatsApp - mob_sharesdk/ShareSDKPlatforms/Yixin - mob_sharesdk/ShareSDKPlatforms/YouDaoNote - mob_sharesdk/ShareSDKRestoreScene - mob_sharesdk/ShareSDKUI + - WechatOpenSDK_Fuck (~> 1.9.2) - sqflite (0.0.2): - Flutter - FMDB (>= 2.7.5) @@ -248,7 +245,7 @@ DEPENDENCIES: - path_provider (from `.symlinks/plugins/path_provider/ios`) - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - scan (from `.symlinks/plugins/scan/ios`) - - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`) - sharesdk_plugin (from `.symlinks/plugins/sharesdk_plugin/ios`) - sqflite (from `.symlinks/plugins/sqflite/ios`) - SSZipArchive (~> 2.4.2) @@ -298,8 +295,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/permission_handler/ios" scan: :path: ".symlinks/plugins/scan/ios" - shared_preferences: - :path: ".symlinks/plugins/shared_preferences/ios" + shared_preferences_ios: + :path: ".symlinks/plugins/shared_preferences_ios/ios" sharesdk_plugin: :path: ".symlinks/plugins/sharesdk_plugin/ios" sqflite: @@ -321,13 +318,13 @@ SPEC CHECKSUMS: AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce BaiduMapKit: 907c6d9b74f66c3ff4741fc4b568ae0b339917f8 BMKLocationKit: 097814ef672b1e57e86e6c1968d7892fb78002bf - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a flutter_baidu_mapapi_base: 90fddba11ec4435406a7211d6ee905b4311c31db flutter_baidu_mapapi_map: 771bf00671832b1fcddb17733518cd631529df16 flutter_baidu_mapapi_search: 4cffaa74e739a4114595c4f82f790e1783bb612d flutter_baidu_mapapi_utils: a5bd582b91ecd35be1bc45558b38f49d5684f70a flutter_bmflocation: 12f1ba91bae4b16d78d4f475023e0254ed351f1c - fluwx: c192ef1ea3617badb813fa1a761ffc5c9c12208a + fluwx: 02670633ce7509206f62b366e9734e7dda81e100 FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a image_pickers: 5e6ec7083f9363d014c0fb061f1b9cd97bb5e451 mob_sharesdk: c771f001e00739d24301a9fa250247601efe7a3c @@ -337,17 +334,17 @@ SPEC CHECKSUMS: permission_handler: ccb20a9fad0ee9b1314a52b70b76b473c5f8dab0 scan: aea35bb4aa59ccc8839c576a18cd57c7d492cc86 SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b - shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - sharesdk_plugin: 5a59e49d2d5e55c8e8f67cc9ddf05172c2494a6b + shared_preferences_ios: aef470a42dc4675a1cdd50e3158b42e3d1232b32 + sharesdk_plugin: 31d5b9be9522985da8e3a90ff73f6e12e62f9049 sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SSZipArchive: e7b4f3d9e780c2acc1764cd88fbf2de28f26e5b2 - thumbnails: bb4f4e9bb4b51c8ae4e6ad9a2fa81373f9b634ad + thumbnails: df4b2db0d4030d134e7665da9c3060b0d78726fe TPNS-iOS: 57a146496858ba2fb5d43e5f240feb19243b69cb tpns_flutter_plugin: a366649c8ad71f19dfb864d3c994ed0480b69daa url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef - video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e + video_player: ecd305f42e9044793efd34846e1ce64c31ea6fcb wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f - webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b + webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232 WechatOpenSDK_Fuck: aa8f4b0af902837e887a1d40c62f06c060c1dc98 ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 1c282ba8..158dfa11 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -674,7 +674,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1300; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -994,7 +994,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", @@ -1232,7 +1231,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", @@ -1361,7 +1359,6 @@ "-l\"flutter_baidu_mapapi_map\"", "-l\"flutter_baidu_mapapi_base\"", "-l\"permission_handler\"", - "-l\"shared_preferences\"", "-l\"sqflite\"", "-l\"sqlite3\"", "-l\"video_player\"", diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index fb2dffc4..c87d15a3 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ with SingleTickerProviderStateMixin { TabController tabcontroller; + CommunityChildPage guanzhu,tuijian ; + List lables = [ "关注", "推荐", @@ -37,20 +39,9 @@ class _CommunityPage extends State tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1); } - _toRelease() async { - var result = await Navigator.of(context).pushNamed('/router/release_dynamic'); - - // int tmpIndex = tabcontroller.index; - // setState(() { - // tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1; - // }); - // setState(() { - // tabcontroller.index = tmpIndex; - // }); - } - @override Widget build(BuildContext context) { + debugPrint("createState createState createState ......"); return Scaffold( appBar: MyAppBar( leading: false, @@ -81,7 +72,7 @@ class _CommunityPage extends State ), ), onTap: () { - _toRelease(); + Navigator.of(context).pushNamed('/router/release_dynamic'); }, action: GestureDetector( behavior: HitTestBehavior.opaque, @@ -107,8 +98,16 @@ class _CommunityPage extends State }else if(e == "课程"){ return CommunityCourse(); } - else { - return CommunityChildPage(e); + else if(e == "关注"){ + if (guanzhu == null ){ + guanzhu = CommunityChildPage("关注");; + } + return guanzhu; + }else if(e == "推荐"){ + if (tuijian == null){ + tuijian = CommunityChildPage("推荐"); + } + return tuijian; } }).toList(), controller: tabcontroller, diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index c87e5207..9dc1c780 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -54,7 +54,6 @@ class _CommunityDynamic extends State { double height = 0; ApiService apiService; - VideoPlayerController videoPlayerController; ChewieController chewieAudioController; Chewie chewies; @@ -70,47 +69,10 @@ class _CommunityDynamic extends State { ), }, ); - initVideo(); } String filePath; - initVideo() async { - if (widget?.article?.content == null) return; - var cnt = jsonDecode(widget.article.content); - if (cnt["type"] == "video" && cnt["video"] != null) { - if (widget.isList) { - videoPlayerController = VideoPlayerController.network( - cnt["video"], - )..initialize().then((value) {}); - } else { - videoPlayerController = VideoPlayerController.network( - cnt["video"], - )..initialize().then((value) { - chewieAudioController = ChewieController( - videoPlayerController: videoPlayerController, - aspectRatio: videoPlayerController.value.aspectRatio, - //宽高比 - autoPlay: false, - //自动播放 - looping: false, - //循环播放 - allowFullScreen: true, - // 拖动条样式颜色 - materialProgressColors: chewie.ChewieProgressColors( - playedColor: Colors.white, - handleColor: Colors.white, - backgroundColor: Colors.grey, - bufferedColor: Colors.transparent, - ), - autoInitialize: true, - ); - chewieAudioController.addListener(_fullScreenListener); - if (mounted) setState(() {}); - }); - } - } - } ///关注/取关会员 _vipFollow(followId, isFollow) async { @@ -425,10 +387,7 @@ class _CommunityDynamic extends State { cnt["video"].isNotEmpty) { itemWidget = videoWidget( MediaQuery.of(context).size.width - 32, - videoPlayerController != null - ? (MediaQuery.of(context).size.width - 32) / - videoPlayerController.value.aspectRatio - : MediaQuery.of(context).size.width / 2, + MediaQuery.of(context).size.width / 2, cnt["video"].replaceAll(".mp4", "_poster.jpg"), ); } @@ -455,10 +414,6 @@ class _CommunityDynamic extends State { chewieAudioController = null; } - if (videoPlayerController != null) { - videoPlayerController.pause(); - videoPlayerController.dispose(); - } } Widget videoWidget(double width, double height, src) { @@ -491,9 +446,7 @@ class _CommunityDynamic extends State { height: double.infinity, child: MImage( src, - aspectRatio: videoPlayerController != null - ? videoPlayerController.value.aspectRatio - : (width / 7 * 5), + aspectRatio: width / 7 * 5, fit: BoxFit.cover, errorSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png", diff --git a/lib/community/photo_view_gallery_screen.dart b/lib/community/photo_view_gallery_screen.dart index 08c0e0f7..86daaf63 100644 --- a/lib/community/photo_view_gallery_screen.dart +++ b/lib/community/photo_view_gallery_screen.dart @@ -1,3 +1,4 @@ +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:photo_view/photo_view.dart'; import 'package:photo_view/photo_view_gallery.dart'; @@ -41,7 +42,7 @@ class _PhotoViewGalleryScreenState extends State { scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { return PhotoViewGalleryPageOptions( - imageProvider: NetworkImage(widget.images[index]), + imageProvider: CachedNetworkImageProvider(widget.images[index]), ); }, From 277859f8ffa280452ebd0647eda554d9ff7f784d Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 24 Jan 2022 13:52:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_details.dart | 2 ++ .../community_view/community_dynamic.dart | 3 --- lib/retrofit/min_api.dart | 8 +++--- lib/retrofit/min_api.g.dart | 2 +- lib/retrofit/retrofit_api.dart | 8 +++--- lib/retrofit/retrofit_api.g.dart | 2 +- lib/store/store_order.dart | 26 +++++++++---------- 7 files changed, 25 insertions(+), 26 deletions(-) diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index 4b627168..cf339df4 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -14,6 +14,7 @@ import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/tips_dialog.dart'; import 'package:huixiang/web/web_view/comment_list.dart'; import 'package:huixiang/web/web_view/input_comment.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class CommunityDetails extends StatefulWidget { @@ -99,6 +100,7 @@ class _CommunityDetails extends State with WidgetsBindingObser setState(() { article = baseData.data; }); + } else { } } diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index c87e5207..012cac78 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -491,9 +491,6 @@ class _CommunityDynamic extends State { height: double.infinity, child: MImage( src, - aspectRatio: videoPlayerController != null - ? videoPlayerController.value.aspectRatio - : (width / 7 * 5), fit: BoxFit.cover, errorSrc: "assets/image/default_2_1.png", fadeSrc: "assets/image/default_2_1.png", diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 80e51624..557ac24e 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -21,15 +21,15 @@ import 'data/shoppingCart.dart'; part 'min_api.g.dart'; -const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 -// const base_url = "http://192.168.10.236:8765/app/";///费韬 -// const baseUrl = "http://192.168.10.236:8765/app/";///费韬 +const base_url = "http://192.168.10.236:8765/app/";///费韬 +const baseUrl = "http://192.168.10.236:8765/app/";///费韬 // const base_url = "http://192.168.10.142:8765/app/";///詹云久 diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 02d9988a..1c1cc751 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -9,7 +9,7 @@ part of 'min_api.dart'; class _MinApiService implements MinApiService { _MinApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.api.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.236:8765/app/'; } final Dio _dio; diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index c4b10859..2bb9d4b8 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -54,14 +54,14 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 -// const base_url = "http://192.168.10.236:8766/app/"; ///费韬 -// const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 +const base_url = "http://192.168.10.236:8766/app/"; ///费韬 +const baseUrl = "http://192.168.10.236:8766/app/"; ///费韬 // const base_url = "http://192.168.10.159:8766/app/"; ///费韬 // const baseUrl = "http://192.168.10.159:8766/app/"; ///费韬 diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 5735110a..71083690 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.236:8766/app/'; } final Dio _dio; diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index e4424e29..aacd3933 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -203,17 +203,17 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { return - // WillPopScope( - // onWillPop: () async { - // if (dialogShowing) { - // debugPrint("ssssasdadsasdadasd"); - // SmartDialog.dismiss(); - // return false; - // } else { - // return true; - // } - // }, - // child: + WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child: Container( color: Colors.white, child: Stack( @@ -490,8 +490,8 @@ class _StoreOrderPage extends State ), ], ), - ); - // ); + ), + ); } ///领取优惠券 From 95baeeb1340a1dc9381c4648c987e58ea3bf7bad Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 26 Jan 2022 17:10:47 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Podfile.lock | 3 + lib/community/community_details.dart | 3 - lib/community/community_page.dart | 28 +++--- .../community_view/class_details_video.dart | 30 ++++--- lib/community/headlines/article_list.dart | 10 --- lib/community/photo_view_gallery_screen.dart | 19 ++-- lib/main.dart | 5 ++ lib/store/store_order.dart | 78 +++++++++-------- lib/utils/ImgCachePath.dart | 35 ++++++++ lib/view_widget/custom_image.dart | 87 ++++++++++--------- pubspec.lock | 51 ++--------- pubspec.yaml | 2 +- 12 files changed, 185 insertions(+), 166 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index bba069cf..6e58a0cb 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -143,6 +143,9 @@ PODS: - mob_sharesdk/ShareSDKPlatforms/WatermelonVideo (4.4.0): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) + - mob_sharesdk/ShareSDKPlatforms/WeChat_Lite (4.4.0): + - mob_sharesdk/ShareSDK + - MOBFoundation (>= 3.2.9) - mob_sharesdk/ShareSDKPlatforms/WhatsApp (4.4.0): - mob_sharesdk/ShareSDK - MOBFoundation (>= 3.2.9) diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index cf339df4..391b8702 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -6,7 +6,6 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/member_comment_list.dart'; import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; @@ -14,7 +13,6 @@ import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/tips_dialog.dart'; import 'package:huixiang/web/web_view/comment_list.dart'; import 'package:huixiang/web/web_view/input_comment.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class CommunityDetails extends StatefulWidget { @@ -100,7 +98,6 @@ class _CommunityDetails extends State with WidgetsBindingObser setState(() { article = baseData.data; }); - } else { } } diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 0ec68090..6a695ff6 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:huixiang/community/community_child_list.dart'; import 'package:huixiang/community/community_child_page.dart'; import 'package:huixiang/home/huixiang_brand_page.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; @@ -39,9 +40,20 @@ class _CommunityPage extends State tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1); } + _toRelease() async { + var result = await Navigator.of(context).pushNamed('/router/release_dynamic'); + + // int tmpIndex = tabcontroller.index; + // setState(() { + // tabcontroller.index = (tabcontroller.index == lables.length -1)?0:tabcontroller.index+1; + // }); + // setState(() { + // tabcontroller.index = tmpIndex; + // }); + } + @override Widget build(BuildContext context) { - debugPrint("createState createState createState ......"); return Scaffold( appBar: MyAppBar( leading: false, @@ -72,7 +84,7 @@ class _CommunityPage extends State ), ), onTap: () { - Navigator.of(context).pushNamed('/router/release_dynamic'); + _toRelease(); }, action: GestureDetector( behavior: HitTestBehavior.opaque, @@ -98,16 +110,8 @@ class _CommunityPage extends State }else if(e == "课程"){ return CommunityCourse(); } - else if(e == "关注"){ - if (guanzhu == null ){ - guanzhu = CommunityChildPage("关注");; - } - return guanzhu; - }else if(e == "推荐"){ - if (tuijian == null){ - tuijian = CommunityChildPage("推荐"); - } - return tuijian; + else { + return CommunityChildList(e); } }).toList(), controller: tabcontroller, diff --git a/lib/community/community_view/class_details_video.dart b/lib/community/community_view/class_details_video.dart index a051e0f6..5c60c698 100644 --- a/lib/community/community_view/class_details_video.dart +++ b/lib/community/community_view/class_details_video.dart @@ -11,6 +11,7 @@ class ClassDetailsVideo extends StatefulWidget { final bool isShowImg; final Function exitFull; final String coverImg; + final String videoUrl; ClassDetailsVideo( { @@ -19,7 +20,8 @@ class ClassDetailsVideo extends StatefulWidget { this.isShowImg, this.exitFull, this.heightFun, - this.coverImg + this.coverImg, + this.videoUrl }) : super(key: key); @override @@ -41,6 +43,9 @@ class ClassDetailsVideoState extends State { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); + if(widget.videoUrl != null){ + initVideo(widget.videoUrl); + } } @override @@ -91,14 +96,11 @@ class ClassDetailsVideoState extends State { @override Widget build(BuildContext context) { return Container( - key: globalKey,child:videoWidget( - MediaQuery.of(context).size.width, - videoPlayerController != null - ? (MediaQuery.of(context).size.width) / - videoPlayerController.value.aspectRatio - : MediaQuery.of(context).size.width / 2, - widget.coverImg, - )); + key: globalKey,child:(videoPlayerController?.value?.isInitialized ?? false) ?videoWidget( + MediaQuery.of(context).size.width, + (MediaQuery.of(context).size.width/videoPlayerController.value.aspectRatio)-43, + widget.coverImg, + ):Container()); } @override @@ -129,15 +131,16 @@ class ClassDetailsVideoState extends State { ? Container( color: Colors.black, width: width, - // height: - height: width / 7 * 5, + // height: width / 7 * 5, + height: height, child: chewies = Chewie( controller: chewieAudioController, ), ) : Container( width: width, - height:width / 7 * 5, + // height:width / 7 * 5, + height: height, )), if (widget.isShowImg) GestureDetector( @@ -150,7 +153,8 @@ class ClassDetailsVideoState extends State { }, child: Container( width: width, - height: width / 7 * 5, + // height: width / 7 * 5, + height: height, color: Colors.black, child: Stack( children: [ diff --git a/lib/community/headlines/article_list.dart b/lib/community/headlines/article_list.dart index 9bf6a0e0..4bf58089 100644 --- a/lib/community/headlines/article_list.dart +++ b/lib/community/headlines/article_list.dart @@ -1,20 +1,10 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/article.dart'; -import 'package:huixiang/retrofit/data/banner.dart'; -import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; -import 'package:huixiang/view_widget/hot_item.dart'; -import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/my_footer.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; diff --git a/lib/community/photo_view_gallery_screen.dart b/lib/community/photo_view_gallery_screen.dart index 86daaf63..2076af6a 100644 --- a/lib/community/photo_view_gallery_screen.dart +++ b/lib/community/photo_view_gallery_screen.dart @@ -1,7 +1,9 @@ -import 'package:cached_network_image/cached_network_image.dart'; +import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:photo_view/photo_view.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; +import 'package:network_to_file_image/network_to_file_image.dart'; import 'package:photo_view/photo_view_gallery.dart'; +import 'package:path/path.dart' as p; class PhotoViewGalleryScreen extends StatefulWidget { List images=[]; @@ -26,7 +28,10 @@ class _PhotoViewGalleryScreenState extends State { super.initState(); currentIndex=widget.index; } - + File fileFromDocsDir(String filename) { + String pathName = p.join(ImgCachePath.instance.path, filename); + return File(pathName); + } @override Widget build(BuildContext context) { return Scaffold( @@ -42,8 +47,12 @@ class _PhotoViewGalleryScreenState extends State { scrollPhysics: const BouncingScrollPhysics(), builder: (BuildContext context, int index) { return PhotoViewGalleryPageOptions( - imageProvider: CachedNetworkImageProvider(widget.images[index]), - + imageProvider: NetworkToFileImage( + url: widget.images[index], + file: fileFromDocsDir(widget.images[index].toString() + .replaceAll("https://pos.upload.gznl.top/", "").replaceAll("/", "")), + debug: true, + ), ); }, itemCount: widget.images.length, diff --git a/lib/main.dart b/lib/main.dart index ff2580d3..f634b27e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -55,6 +55,7 @@ import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/settlement/settlement.dart'; import 'package:huixiang/test_page.dart'; import 'package:huixiang/union/location_map_page.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/union/union_details_page.dart'; @@ -70,6 +71,7 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'community/community_view/class_details.dart'; import 'community/headlines/headlines_column_details.dart'; +import 'community/new_community_details.dart'; import 'community/photo_view_gallery_screen.dart'; import 'home/guide_page.dart'; import 'home/home_view/activity_list.dart'; @@ -102,6 +104,7 @@ void main() async { } else { locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); } + ImgCachePath(); initSdk(); bool isFirst = sharedPreferences.getBool("isFirst"); @@ -302,6 +305,8 @@ Map routers = { '/router/release_dynamic': (context, {arguments}) => ReleaseDynamic(), '/router/community_details': (context, {arguments}) => CommunityDetails(arguments: arguments), + '/router/new_community_details': (context, {arguments}) => + NewCommunityDetails(arguments: arguments), '/router/user_info_page': (context, {arguments}) => UserInfoPage(), '/router/recharge_page': (context, {arguments}) => RechargePage(), '/router/mine_wallet': (context, {arguments}) => MineWalletPage(), diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index aacd3933..42c98f39 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -137,11 +137,12 @@ class _StoreOrderPage extends State } queryMemberInfo() async { - BaseData baseData = await minService.memberInfo() - .catchError((error){debugPrint(error);}); + BaseData baseData = await minService.memberInfo().catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { SharedPreferences.getInstance().then( - (value) => { + (value) => { value.setString('minMember', jsonEncode(baseData.data)), }, ); @@ -150,8 +151,10 @@ class _StoreOrderPage extends State ///获取父订单(火锅订单加菜前调用) getParentInfo() async { - BaseData baseData = await minService.getParentInfo("$tableId") - .catchError((error) {debugPrint(error);}); + BaseData baseData = + await minService.getParentInfo("$tableId").catchError((error) { + debugPrint(error); + }); if (baseData != null && baseData.isSuccess) { if (baseData.data != null) { parentId = baseData.data["id"]; @@ -182,7 +185,8 @@ class _StoreOrderPage extends State /// 查询店铺信息 queryStoreInfo() async { - BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { debugPrint(error); }); if (baseData != null && baseData.isSuccess) { @@ -202,8 +206,7 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return - WillPopScope( + return WillPopScope( onWillPop: () async { if (dialogShowing) { debugPrint("ssssasdadsasdadasd"); @@ -213,8 +216,7 @@ class _StoreOrderPage extends State return true; } }, - child: - Container( + child: Container( color: Colors.white, child: Stack( children: [ @@ -227,14 +229,15 @@ class _StoreOrderPage extends State controller: controller, dragStartBehavior: DragStartBehavior.start, physics: BouncingScrollPhysics(), - headerSliverBuilder: (BuildContext context, bool innerScrolled) { + headerSliverBuilder: + (BuildContext context, bool innerScrolled) { return [ SliverOverlapAbsorber( handle: NestedScrollView.sliverOverlapAbsorberHandleFor( context), sliver: SliverAppBar( - expandedHeight: - (storeInfo != null && storeInfo.couponVOList != null) + expandedHeight: (storeInfo != null && + storeInfo.couponVOList != null) ? 470.h : 365.h, floating: false, @@ -262,9 +265,8 @@ class _StoreOrderPage extends State ), ), flexibleSpace: FlexibleSpaceBar( - title: Title( - controller, - storeInfo != null ? storeInfo.storeName : ''), + title: Title(controller, + storeInfo != null ? storeInfo.storeName : ''), collapseMode: CollapseMode.pin, stretchModes: [ StretchMode.zoomBackground, @@ -555,6 +557,7 @@ class _StoreOrderPage extends State return; } } + await Navigator.of(context).pushNamed( '/router/settlement', arguments: { @@ -562,15 +565,15 @@ class _StoreOrderPage extends State "tableId": tableId, "parentCode": parentCode, "parentId": parentId, - "pName":pName, - "pid":pid, - "cName":cName, - "cid":cid, + "pName": pName, + "pid": pid, + "cName": cName, + "cid": cid, "shoppingCart": shopCarGoods, "numberOfPeople": numberOfPeople, }, ); - if(tableId >0){ + if (tableId > 0) { getParentInfo(); } queryShopCar().then((value) { @@ -651,18 +654,19 @@ class _StoreOrderPage extends State } ///选规格 - _queryMiNiDetail(String id,int count) async { + _queryMiNiDetail(String id, int count) async { EasyLoading.show(status: S.current.zhengzaijiazai); BaseData baseData = await minService.miNiDetail(id); if (baseData != null && baseData.isSuccess) { - showStoreSelector(baseData.data, id,count); + showStoreSelector(baseData.data, id, count); } } ///选规格弹窗 - showStoreSelector(MiNiDetail miNiDetail, String id,int count) async { - if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1 - && miNiDetail.attrList[0].attrValueList.length == 1) { + showStoreSelector(MiNiDetail miNiDetail, String id, int count) async { + if (miNiDetail.attrList != null && + miNiDetail.attrList.length == 1 && + miNiDetail.attrList[0].attrValueList.length == 1) { _addShopCar(miNiDetail, [], count); } else { EasyLoading.dismiss(); @@ -687,7 +691,7 @@ class _StoreOrderPage extends State ///添加购物车 Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { ProductSkuVOListBean productSku; - if (selectSkus!= null && selectSkus.length == 0) { + if (selectSkus != null && selectSkus.length == 0) { productSku = miNiDetail.productSkuVOList.first; } else { productSku = miNiDetail.productSkuVOList.firstWhere((element) { @@ -743,28 +747,28 @@ class _StoreOrderPage extends State ///查询购物车 Future queryShopCar() async { - pName="";//活动 - pid="";//活动 - cName="";//优惠券 - cid="";//优惠券 + pName = ""; //活动 + pid = ""; //活动 + cName = ""; //优惠券 + cid = ""; //优惠券 BaseData> baseDate = await minService.getShoppingCart(tableId); if (baseDate != null && baseDate.isSuccess && baseDate.data != null && baseDate.data.length > 0) { - if( baseDate.data[0].selectDiscount ==1){ + if (baseDate.data[0].selectDiscount == 1) { baseDate.data[0].couponList.forEach((element) { - if(element.isMaxCoupon){ + if (element.isMaxCoupon) { cName = element.promotionName; cid = element.id; } }); - }else if(baseDate.data[0].selectDiscount==2){ + } else if (baseDate.data[0].selectDiscount == 2) { baseDate.data[0].promotionInfoList.forEach((element) { - if(element.isMaxPromotion){ - pName=element.name; - pid=element.id; + if (element.isMaxPromotion) { + pName = element.name; + pid = element.id; } }); } diff --git a/lib/utils/ImgCachePath.dart b/lib/utils/ImgCachePath.dart index e69de29b..fa3c41a0 100644 --- a/lib/utils/ImgCachePath.dart +++ b/lib/utils/ImgCachePath.dart @@ -0,0 +1,35 @@ +import 'dart:io'; + +import 'package:path_provider/path_provider.dart'; + +class ImgCachePath{ + factory ImgCachePath() => _getInstance(); + + static ImgCachePath get instance => _getInstance(); + + static ImgCachePath _instance; + + String _path; + + String get path => _path; + + ImgCachePath._internal(){ + fileFromDocsDir(); + } + + fileFromDocsDir() async { + Directory tempDir = await getTemporaryDirectory(); + Directory directory = new Directory('${tempDir.path}/ImgCache'); + if (!directory.existsSync()) { + directory.createSync(); + } + _path = directory.path; + } + + static ImgCachePath _getInstance(){ + if(_instance == null){ + _instance = ImgCachePath._internal(); + } + return _instance; + } +} \ No newline at end of file diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index e03f81d5..4caaa7b9 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -1,8 +1,8 @@ import 'dart:io'; - -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter/material.dart'; +import 'package:huixiang/utils/ImgCachePath.dart'; +import 'package:network_to_file_image/network_to_file_image.dart'; +import 'package:path/path.dart' as p; class MImage extends StatelessWidget { final String src; @@ -29,6 +29,11 @@ class MImage extends StatelessWidget { this.radius = BorderRadius.zero, }); + File fileFromDocsDir(String filename) { + String pathName = p.join(ImgCachePath.instance.path, filename); + return File(pathName); + } + @override Widget build(BuildContext context) { Widget image = LayoutBuilder( @@ -41,10 +46,13 @@ class MImage extends StatelessWidget { // "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" // "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; // } - + int _w = ((constraints.constrainWidth()==double.infinity? + MediaQuery.of(context).size.width:constraints.constrainWidth()) * scaleIndex).toInt(); + int _h = ((constraints.constrainHeight()==double.infinity? + MediaQuery.of(context).size.height:constraints.constrainHeight()) * scaleIndex).toInt(); ///压缩图片 if ((src??"").startsWith("http")) { - imageUrl = "$src?imageView2/1/format/jpg/q/50"; + imageUrl = "$src?imageView2/1/w/${_w}/h/${_h}/format/jpg/q/75"; } // print("imageUrl:$imageUrl"); @@ -58,43 +66,38 @@ class MImage extends StatelessWidget { ); } Widget cachedNetworkImage; - if (src.startsWith("http")) { - cachedNetworkImage = CachedNetworkImage( - imageUrl: imageUrl, - cacheManager: DefaultCacheManager(), - fadeInDuration: Duration(milliseconds: 300), - fadeOutDuration: Duration(milliseconds: 300), - imageBuilder: (context, provide) { - return Image( - image: provide, - fit: fit, - ); - }, - errorWidget: (context, error, stackTrace) { - return Image.asset( - errorSrc, - fit: fit, - ); - }, - placeholder: (context, placeholder) { - return Image.asset( - fadeSrc, - fit: fit, - ); - }, - ); - } else if (src.startsWith("file")) { - cachedNetworkImage = Image.file( - File(src), - fit: fit, - errorBuilder: (context, error, stackTrace) { - return Image.asset( - errorSrc, - fit: fit, - ); - }, - ); - } + if (src.startsWith("http")) { + cachedNetworkImage = Image( + image: ResizeImage(NetworkToFileImage( + url: imageUrl, + file: fileFromDocsDir("resize"+src.replaceAll("https:", "") + .replaceAll("http:", "") + .replaceAll("pos.upload.gznl.top", "") + .replaceAll("/", "")), + debug: true, + ), + width: _w, + height: _h), + errorBuilder: (context, error, stackTrace) { + return Image.asset( + errorSrc, + fit: fit, + ); + }, + fit: fit, + ); + } else if (src.startsWith("file")) { + cachedNetworkImage = Image.file( + File(src), + fit: fit, + errorBuilder: (context, error, stackTrace) { + return Image.asset( + errorSrc, + fit: fit, + ); + }, + ); + } return cachedNetworkImage; }, ); diff --git a/pubspec.lock b/pubspec.lock index 301148f0..7b7b2595 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -50,13 +50,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.1.6" - cached_network_image: - dependency: "direct main" - description: - name: cached_network_image - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.0.0" characters: dependency: transitive description: @@ -209,13 +202,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.4" - flutter_cache_manager: - dependency: transitive - description: - name: flutter_cache_manager - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.1.3" flutter_easyloading: dependency: "direct main" description: @@ -269,7 +255,7 @@ packages: name: flutter_screenutil url: "https://pub.flutter-io.cn" source: hosted - version: "5.0.3" + version: "5.1.0" flutter_smart_dialog: dependency: "direct main" description: @@ -350,13 +336,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.15.0" - http: - dependency: transitive - description: - name: http - url: "https://pub.flutter-io.cn" - source: hosted - version: "0.12.2" http_parser: dependency: transitive description: @@ -434,6 +413,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.0" + network_to_file_image: + dependency: "direct main" + description: + name: network_to_file_image + url: "https://pub.flutter-io.cn" + source: hosted + version: "2.3.8" numerus: dependency: transitive description: @@ -677,20 +663,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.8.1" - sqflite: - dependency: transitive - description: - name: sqflite - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.3.2+4" - sqflite_common: - dependency: transitive - description: - name: sqflite_common - url: "https://pub.flutter-io.cn" - source: hosted - version: "1.0.3+3" stack_trace: dependency: transitive description: @@ -712,13 +684,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.1.0" - synchronized: - dependency: transitive - description: - name: synchronized - url: "https://pub.flutter-io.cn" - source: hosted - version: "2.2.0+2" term_glyph: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 98b64fa5..6f6affec 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -65,7 +65,7 @@ dependencies: scan: ^1.5.0 path_provider: ^1.2.0 - cached_network_image: ^2.0.0 + network_to_file_image: ^2.0.0 flutter_html: ^2.1.5 #2.1.0 chewie_audio: ^1.1.2