From 8f8c80fa2629cb05982f011137f556a58315e71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=93=88=E5=93=88?= Date: Thu, 5 Aug 2021 00:19:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/address/address_map_page.dart | 3 +- lib/home/huixiang_brand_page.dart | 7 +-- lib/home/main_home_page.dart | 8 ++- lib/home/points_mall_page.dart | 13 ++-- lib/main.dart | 8 +-- lib/message/main_message_page.dart | 1 - lib/message/mine_message.dart | 2 - lib/mine/coupons_page.dart | 1 - lib/mine/mine_page.dart | 4 +- lib/mine/roll_center_page.dart | 1 - lib/mine/vip_detail_page.dart | 2 - lib/order/store_selector_page.dart | 2 +- lib/order/write_off_page.dart | 1 - lib/setting/treaty_page.dart | 1 - lib/union/store_details_page.dart | 1 - lib/utils/status_utils.dart | 1 + lib/view_widget/custom_image.dart | 84 ++++++++++---------------- lib/view_widget/item_input_widget.dart | 1 - lib/view_widget/login_tips.dart | 1 - pubspec.lock | 8 +-- 20 files changed, 59 insertions(+), 91 deletions(-) diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart index 42fe2805..3076b362 100644 --- a/lib/address/address_map_page.dart +++ b/lib/address/address_map_page.dart @@ -9,7 +9,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -151,7 +150,7 @@ class _AddressMapPage extends State { startLocation() async { // await AmapCore.init('feaae7986201b571cace1b83728be5bb'); if (await Permission.locationWhenInUse.serviceStatus.isEnabled) { - bool isShown = await Permission.contacts.shouldShowRequestRationale; + // bool isShown = await Permission.contacts.shouldShowRequestRationale; // if (isShown) { // SmartDialog.showToast("shouldShowRequest"); // } diff --git a/lib/home/huixiang_brand_page.dart b/lib/home/huixiang_brand_page.dart index 6d69c639..4b00c1a6 100644 --- a/lib/home/huixiang_brand_page.dart +++ b/lib/home/huixiang_brand_page.dart @@ -14,15 +14,12 @@ import 'package:huixiang/retrofit/data/brand_data.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/MyPainter.dart'; import 'package:huixiang/utils/event_type.dart'; -import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/store_title_tab.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:sharesdk_plugin/sharesdk_interface.dart'; class BrandPage extends StatefulWidget { @override @@ -217,8 +214,8 @@ class _BrandPage extends State child: MImage( brandData == null ? "" : brandData.originAvatar, fit: BoxFit.cover, - width: 60.w, - height: 60.h, + width: 60, + height: 60, errorSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png", ), diff --git a/lib/home/main_home_page.dart b/lib/home/main_home_page.dart index 22e933fa..72a532bb 100644 --- a/lib/home/main_home_page.dart +++ b/lib/home/main_home_page.dart @@ -71,7 +71,9 @@ class _MainHomePage extends State ), ), ), - titleChild: TabBar( + titleChild: PreferredSize( + preferredSize: Size(double.infinity, 38.h), + child: TabBar( controller: tabcontroller, automaticIndicatorColorAdjustment: true, isScrollable: true, @@ -97,7 +99,9 @@ class _MainHomePage extends State MyTab( text: S.of(context).jifenshangcheng, ), - ]), + ], + ), + ), ), body: Container( padding: EdgeInsets.only(bottom: 76.h), diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart index 33b4832a..98ed695e 100644 --- a/lib/home/points_mall_page.dart +++ b/lib/home/points_mall_page.dart @@ -19,7 +19,6 @@ import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/item_title.dart'; -import 'package:huixiang/view_widget/login_tips.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -270,8 +269,8 @@ class _PointsMallPage extends State //垂直子Widget之间间距 mainAxisSpacing: 16.w, //子Widget宽高比例 0.59 - childAspectRatio: 166.w / - (281.h / 2 + (281.h / 2) * AppUtils.textScale(context)), + childAspectRatio: 166 / + (281 / 2 + (281 / 2) * AppUtils.textScale(context)), ), itemBuilder: (contetx, index) { return GestureDetector( @@ -383,7 +382,7 @@ class _PointsMallPage extends State height: 5.h, ), Container( - height: 30.h * AppUtils.textScale(context), + height: 35.h * AppUtils.textScale(context), child: Text( goods.description, maxLines: 2, @@ -468,9 +467,9 @@ class _PointsMallPage extends State children: [ MImage( userinfo != null ? userinfo.headimg : "", - width: 50.w, - height: 50.h, - radius: BorderRadius.all(Radius.circular(100)), + width: 50, + height: 50, + isCircle: true, fit: BoxFit.cover, errorSrc: "assets/image/default_user.png", fadeSrc: "assets/image/default_user.png", diff --git a/lib/main.dart b/lib/main.dart index 91144ec4..4a4442ae 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -72,8 +72,7 @@ void main() async { SystemChrome.setPreferredOrientations([ DeviceOrientation.portraitUp, ]); - // ignore: invalid_use_of_visible_for_testing_member - SharedPreferences.setMockInitialValues({}); + SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); Locale locale; if (sharedPreferences.containsKey("language") && @@ -84,8 +83,9 @@ void main() async { } initSdk(); - - runApp(MyApp(locale, sharedPreferences.getBool("isFirst"))); + bool isFirst = sharedPreferences.getBool("isFirst"); + print("isFirst:$isFirst"); + runApp(MyApp(locale, isFirst)); } XgFlutterPlugin xgFlutterPlugin = XgFlutterPlugin(); diff --git a/lib/message/main_message_page.dart b/lib/message/main_message_page.dart index 435b1924..5ad0a3f5 100644 --- a/lib/message/main_message_page.dart +++ b/lib/message/main_message_page.dart @@ -4,7 +4,6 @@ import 'package:huixiang/message/mine_message.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/round_button.dart'; class MainMessagePage extends StatefulWidget { @override diff --git a/lib/message/mine_message.dart b/lib/message/mine_message.dart index 7e05ac7d..aace545f 100644 --- a/lib/message/mine_message.dart +++ b/lib/message/mine_message.dart @@ -1,5 +1,3 @@ -import 'dart:collection'; - import 'package:flutter/material.dart'; import 'package:huixiang/view_widget/message_item.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; diff --git a/lib/mine/coupons_page.dart b/lib/mine/coupons_page.dart index f49eb7eb..5f494c32 100644 --- a/lib/mine/coupons_page.dart +++ b/lib/mine/coupons_page.dart @@ -1,7 +1,6 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index c5b5a703..acaa4207 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -568,8 +568,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { MImage( userinfo == null ? "" : userinfo.headimg, isCircle: true, - width: 50.w, - height: 50.h, + width: 50, + height: 50, fit: BoxFit.cover, errorSrc: "assets/image/default_user.png", fadeSrc: "assets/image/default_user.png", diff --git a/lib/mine/roll_center_page.dart b/lib/mine/roll_center_page.dart index 32b393d5..a14e8acc 100644 --- a/lib/mine/roll_center_page.dart +++ b/lib/mine/roll_center_page.dart @@ -1,7 +1,6 @@ import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; diff --git a/lib/mine/vip_detail_page.dart b/lib/mine/vip_detail_page.dart index 6fb4aea3..e2f63fe3 100644 --- a/lib/mine/vip_detail_page.dart +++ b/lib/mine/vip_detail_page.dart @@ -5,11 +5,9 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/page.dart'; -import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/painter_bg.dart'; -import 'package:huixiang/utils/status_utils.dart'; import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_footer.dart'; diff --git a/lib/order/store_selector_page.dart b/lib/order/store_selector_page.dart index b01aa114..3395da26 100644 --- a/lib/order/store_selector_page.dart +++ b/lib/order/store_selector_page.dart @@ -95,7 +95,7 @@ class _StoreSelectorPage extends State { startLocation() async { if (await Permission.locationWhenInUse.serviceStatus.isEnabled) { - bool isShown = await Permission.contacts.shouldShowRequestRationale; + // bool isShown = await Permission.contacts.shouldShowRequestRationale; // if (isShown) { // SmartDialog.showToast("shouldShowRequestRationale"); // } diff --git a/lib/order/write_off_page.dart b/lib/order/write_off_page.dart index ae1434b3..23660e99 100644 --- a/lib/order/write_off_page.dart +++ b/lib/order/write_off_page.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/separator.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:qr_flutter/qr_flutter.dart'; diff --git a/lib/setting/treaty_page.dart b/lib/setting/treaty_page.dart index b7624098..7ceb63c4 100644 --- a/lib/setting/treaty_page.dart +++ b/lib/setting/treaty_page.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; // import 'package:webview_flutter/webview_flutter.dart'; // import 'package:webview_flutter/src/webview_cupertino.dart'; diff --git a/lib/union/store_details_page.dart b/lib/union/store_details_page.dart index 6d80ed27..bfca22ce 100644 --- a/lib/union/store_details_page.dart +++ b/lib/union/store_details_page.dart @@ -1,6 +1,5 @@ import 'dart:io'; -import 'package:chewie_audio/chewie_audio.dart'; import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; diff --git a/lib/utils/status_utils.dart b/lib/utils/status_utils.dart index 76574f54..4f7959c1 100644 --- a/lib/utils/status_utils.dart +++ b/lib/utils/status_utils.dart @@ -314,5 +314,6 @@ class StatusUtils { } } } + return [Container()]; } } diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index 17ea33c6..e03f9d4c 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -27,68 +27,48 @@ class MImage extends StatelessWidget { @override Widget build(BuildContext context) { + Widget image = LayoutBuilder(builder: (context, constraints) { + String imageUrl = "$src?imageMogr2/thumbnail/${constraints.constrainWidth() * 2}x${constraints.constrainHeight() * 2}/format/webp/blur/1x0/quality/75"; + print("imageUrl: $imageUrl"); + return 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) { + print("object $placeholder"); + return Image.asset( + fadeSrc, + fit: fit, + ); + }, + ); + }); + var clipRRect ; if (isCircle) { clipRRect = ClipOval( clipBehavior: Clip.antiAlias, - child: CachedNetworkImage( - imageUrl: "$src?imageMogr2/format/webp/blur/1x0/quality/75", - 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) { - print("object $placeholder"); - return Image.asset( - fadeSrc, - fit: fit, - ); - }, - ), + child: image ); } else { clipRRect = ClipRRect( borderRadius: radius, - child: CachedNetworkImage( - imageUrl: "$src?imageMogr2/format/webp/blur/1x0/quality/75", - 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) { - print("object $placeholder"); - return Image.asset( - fadeSrc, - fit: fit, - ); - }, - ), + child: image, ); } - - if (aspectRatio != null && aspectRatio > 0) { return Container( child: AspectRatio( diff --git a/lib/view_widget/item_input_widget.dart b/lib/view_widget/item_input_widget.dart index 6673b6b4..336cdfb6 100644 --- a/lib/view_widget/item_input_widget.dart +++ b/lib/view_widget/item_input_widget.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:huixiang/utils/font_weight.dart'; -import 'package:huixiang/view_widget/border_text.dart'; class ItemInputWidget extends StatelessWidget { final String hintText; diff --git a/lib/view_widget/login_tips.dart b/lib/view_widget/login_tips.dart index b30f416d..50574fe7 100644 --- a/lib/view_widget/login_tips.dart +++ b/lib/view_widget/login_tips.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/round_button.dart'; diff --git a/pubspec.lock b/pubspec.lock index f02aa419..00e92515 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -56,7 +56,7 @@ packages: name: async url: "https://pub.flutter-io.cn" source: hosted - version: "2.6.1" + version: "2.5.0" barcode: dependency: transitive description: @@ -879,7 +879,7 @@ packages: name: test_api url: "https://pub.flutter-io.cn" source: hosted - version: "0.3.0" + version: "0.2.19" timing: dependency: transitive description: @@ -1042,7 +1042,7 @@ packages: name: win32 url: "https://pub.flutter-io.cn" source: hosted - version: "2.2.5" + version: "2.0.5" xdg_directories: dependency: transitive description: @@ -1065,5 +1065,5 @@ packages: source: hosted version: "3.1.0" sdks: - dart: ">=2.13.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" flutter: ">=2.0.0" From b61a5cba9657661152a7ad3e6ae560a97c70fb17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=88=E5=93=88=E5=93=88?= Date: Thu, 5 Aug 2021 02:00:25 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Runner.xcodeproj/project.pbxproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 2e34181c..673eb0f5 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -846,7 +846,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 28; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -881,7 +881,7 @@ "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", ); - MARKETING_VERSION = 1.0.26; + MARKETING_VERSION = 1.0.28; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)", @@ -1046,7 +1046,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 28; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1081,7 +1081,7 @@ "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", ); - MARKETING_VERSION = 1.0.26; + MARKETING_VERSION = 1.0.28; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "$(inherited)", @@ -1139,7 +1139,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; - CURRENT_PROJECT_VERSION = 26; + CURRENT_PROJECT_VERSION = 28; DEVELOPMENT_TEAM = YF3Q8DVP52; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( @@ -1174,7 +1174,7 @@ "$(PROJECT_DIR)/UniMPSDK/Libs", "$(PROJECT_DIR)/wx/Libs", ); - MARKETING_VERSION = 1.0.26; + MARKETING_VERSION = 1.0.28; ONLY_ACTIVE_ARCH = NO; OTHER_LDFLAGS = ( "$(inherited)",