From 3511a93f66b55a844d5e1fa91e0ca1337bc50cbe Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 4 Aug 2021 09:43:33 +0800 Subject: [PATCH 1/4] mine --- lib/mine/mine_page.dart | 65 +++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 39 deletions(-) diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 4e565ac0..783f47e0 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -44,7 +44,8 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { SmartDialog.show( widget: LoginTips( click: () { - SharedPreferences.getInstance().then((value) => value..setString("token", "")); + SharedPreferences.getInstance() + .then((value) => value..setString("token", "")); Navigator.of(context) .pushNamed('/router/login_page', arguments: {"login": "login"}); }, @@ -73,19 +74,19 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { refreshUserInfo(); } }); - } refreshUserInfo() { - if(mounted) + if (mounted) SharedPreferences.getInstance().then( - (value) => - { + (value) => { apiService = ApiService(Dio(), context: context, token: value.getString('token'), showLoading: false), - if (value.containsKey('user') && value.getString('user') != null && value.getString('user') != "") + if (value.containsKey('user') && + value.getString('user') != null && + value.getString('user') != "") { userinfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), }, @@ -99,9 +100,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { List ranks = []; queryUserInfo() async { - SmartDialog.showLoading(msg: S - .of(context) - .zhengzaijiazai); + SmartDialog.showLoading(msg: S.of(context).zhengzaijiazai); BaseData rankData = await apiService.rankList(); if (rankData != null && rankData.isSuccess) { ranks.clear(); @@ -122,8 +121,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { 1); } SharedPreferences.getInstance().then( - (value) => - { + (value) => { value.setString('user', jsonEncode(baseDate.data)), }, ); @@ -160,7 +158,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { Column( children: [ Container( - margin: EdgeInsets.only(bottom: 8.h,right: 16.w), + margin: EdgeInsets.only(bottom: 8.h, right: 16.w), alignment: Alignment.centerRight, child: Row( mainAxisAlignment: MainAxisAlignment.end, @@ -187,7 +185,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { onTap: _toUserInfo, child: mineView(), ), - SizedBox(height: 22.h,), + SizedBox( + height: 22.h, + ), GestureDetector( onTap: () { SharedPreferences.getInstance().then((value) { @@ -200,7 +200,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { '/router/mine_vip_level_page', arguments: { "rankLevel": rankLevel, - "createTime": (userinfo != null) ? "${userinfo.createTime}" : "", + "createTime": (userinfo != null) + ? "${userinfo.createTime}" + : "", "points": (userinfo != null) ? int.tryParse(userinfo.points) : 0, @@ -214,11 +216,11 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ? int.tryParse(userinfo.points) : 0, rankMax: (userinfo != null && - userinfo.memberRankVo != null) + userinfo.memberRankVo != null) ? userinfo.memberRankVo.rankOrigin : 0, createTime: - (userinfo != null) ? userinfo.createTime : "", + (userinfo != null) ? userinfo.createTime : "", ), ), orderOrCard(), @@ -266,9 +268,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { mainAxisSize: MainAxisSize.min, children: [ Text( - S - .of(context) - .ninyouyigedingdanyaolingqu, + S.of(context).ninyouyigedingdanyaolingqu, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 12.sp, @@ -341,9 +341,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .wodeqianbao, + S.of(context).wodeqianbao, "assets/image/icon_mine_wallet.png", ), ), @@ -360,9 +358,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .duihuanlishi, + S.of(context).duihuanlishi, "assets/image/icon_mine_records_of_consumption.png", ), ), @@ -378,9 +374,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S - .of(context) - .lingquanzhongxin, + S.of(context).lingquanzhongxin, "assets/image/icon_mine_invoice_assistant.png", ), ), @@ -396,8 +390,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { }); }, child: mineItem( - S.of(context) - .guanlidizhi, + S.of(context).guanlidizhi, "assets/image/icon_location_address.png", ), ), @@ -406,9 +399,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { Navigator.of(context).pushNamed('/router/setting_page'); }, child: mineItem( - S - .of(context) - .shezhi, + S.of(context).shezhi, "assets/image/icon_mine_setting.png", ), ), @@ -503,9 +494,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { width: 12.w, ), Text( - S - .of(context) - .kaquan, + S.of(context).kaquan, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, @@ -548,9 +537,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { width: 12.w, ), Text( - S - .of(context) - .dingdan, + S.of(context).dingdan, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, From 72eb19a580cc43d796501a905ce6e32062965444 Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 4 Aug 2021 11:02:38 +0800 Subject: [PATCH 2/4] =?UTF-8?q?ui=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/view_widget/coupon_widget.dart | 32 +++++++++++++++++------------- lib/view_widget/custom_image.dart | 2 +- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/view_widget/coupon_widget.dart b/lib/view_widget/coupon_widget.dart index 83a495aa..c4ac2a11 100644 --- a/lib/view_widget/coupon_widget.dart +++ b/lib/view_widget/coupon_widget.dart @@ -3,6 +3,7 @@ import 'dart:math'; import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/coupon.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/separator.dart'; @@ -70,20 +71,23 @@ class CouponWidget extends StatelessWidget { children: [ Container( margin: EdgeInsets.only(left: 20), - child: Image.network( - (coupon == null || - coupon.couponImg == null || - coupon.couponImg == "") - ? "" - : coupon.couponImg, - width: 60, - height: 60, - fit: BoxFit.cover, - errorBuilder: (context, error, e) { - return Image.asset( - "assets/image/default_1.png"); - }, - ), + child: MImage( + (coupon == null || + coupon.couponImg == null || + coupon.couponImg == "") + ? "" + : coupon.couponImg, + ) + // Image.network( + + // width: 60, + // height: 60, + // fit: BoxFit.cover, + // errorBuilder: (context, error, e) { + // return Image.asset( + // "assets/image/default_1.png"); + // }, + // ), ), Expanded( flex: 1, diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index 0c4319c3..d3e3bf80 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -28,7 +28,7 @@ class MImage extends StatelessWidget { var clipRRect = ClipRRect( borderRadius: radius, child: CachedNetworkImage( - imageUrl: src, + imageUrl: "$src?imageMogr2/thumbnail/640x640/format/webp/blur/1x0/quality/75", cacheManager: DefaultCacheManager(), fadeInDuration: Duration(milliseconds: 300), fadeOutDuration: Duration(milliseconds: 300), From 6da1ad39afc451e8e8b00fbe0e515da2881b98fe Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 4 Aug 2021 11:35:59 +0800 Subject: [PATCH 3/4] image --- lib/union/store_details_page.dart | 12 +++++++++--- lib/view_widget/custom_image.dart | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/union/store_details_page.dart b/lib/union/store_details_page.dart index d338e49e..8b6cbf22 100644 --- a/lib/union/store_details_page.dart +++ b/lib/union/store_details_page.dart @@ -228,9 +228,15 @@ class _StoreDetailsPage extends State { assetUriMatcher(): assetImageRender(), networkSourceMatcher(extension: "svg"): svgNetworkImageRender(), - networkSourceMatcher(): networkImageRender(loadingWidget: () { - return Container(); - }), + networkSourceMatcher(): networkImageRender( + loadingWidget: () { + return Container(); + }, + mapUrl: (url) { + print("objectUrl: $url"); + return "$url?imageMogr2/format/webp/blur/1x0/quality/75"; + } + ), }, customRender: { "video" : (context, parsedChild, attributes, element) { diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index d3e3bf80..7420e79c 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -28,7 +28,7 @@ class MImage extends StatelessWidget { var clipRRect = ClipRRect( borderRadius: radius, child: CachedNetworkImage( - imageUrl: "$src?imageMogr2/thumbnail/640x640/format/webp/blur/1x0/quality/75", + imageUrl: "$src?imageMogr2/format/webp/blur/1x0/quality/75", cacheManager: DefaultCacheManager(), fadeInDuration: Duration(milliseconds: 300), fadeOutDuration: Duration(milliseconds: 300), From 7c63fbc499b937eaf0b2b3463ed82dc73723fc91 Mon Sep 17 00:00:00 2001 From: fmk Date: Wed, 4 Aug 2021 11:38:20 +0800 Subject: [PATCH 4/4] image --- lib/generated/intl/messages_en.dart | 1 - lib/generated/intl/messages_zh_CN.dart | 1 - lib/generated/intl/messages_zh_Hans_CN.dart | 1 - lib/generated/intl/messages_zh_Hant_CN.dart | 1 - lib/generated/intl/messages_zh_TW.dart | 1 - 5 files changed, 5 deletions(-) diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 820cb2a8..4be34870 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -131,7 +131,6 @@ class MessageLookup extends MessageLookupByLibrary { "dakaidingwei" : MessageLookupByLibrary.simpleMessage("打开定位"), "dangqianbanben" : MessageLookupByLibrary.simpleMessage("当前版本"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), - "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "dengdaishangjiaqueren" : MessageLookupByLibrary.simpleMessage("等待商家确认"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index a11523a0..c9ddf4ec 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -131,7 +131,6 @@ class MessageLookup extends MessageLookupByLibrary { "dakaidingwei" : MessageLookupByLibrary.simpleMessage("打开定位"), "dangqianbanben" : MessageLookupByLibrary.simpleMessage("当前版本"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), - "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "dengdaishangjiaqueren" : MessageLookupByLibrary.simpleMessage("等待商家确认"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index 1532dc6b..78575274 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -131,7 +131,6 @@ class MessageLookup extends MessageLookupByLibrary { "dakaidingwei" : MessageLookupByLibrary.simpleMessage("打开定位"), "dangqianbanben" : MessageLookupByLibrary.simpleMessage("当前版本"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("当前等级"), - "dangqianjifen" : MessageLookupByLibrary.simpleMessage("当前积分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("当前商品兑换核销码已核销完成"), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等级"), "dengdaishangjiaqueren" : MessageLookupByLibrary.simpleMessage("等待商家确认"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index 103b8be5..c923636d 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -131,7 +131,6 @@ class MessageLookup extends MessageLookupByLibrary { "dakaidingwei" : MessageLookupByLibrary.simpleMessage("打開定位"), "dangqianbanben" : MessageLookupByLibrary.simpleMessage("當前版本"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), - "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), "dengdaishangjiaqueren" : MessageLookupByLibrary.simpleMessage("等待商家確認"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 769bf29f..7d602671 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -131,7 +131,6 @@ class MessageLookup extends MessageLookupByLibrary { "dakaidingwei" : MessageLookupByLibrary.simpleMessage("打開定位"), "dangqianbanben" : MessageLookupByLibrary.simpleMessage("當前版本"), "dangqiandengji" : MessageLookupByLibrary.simpleMessage("當前等級"), - "dangqianjifen" : MessageLookupByLibrary.simpleMessage("當前積分:"), "dangqianshangpinduihuanhexiaoma" : MessageLookupByLibrary.simpleMessage("當前商品兌換核銷碼已核銷完成 "), "daoxiayidengji" : MessageLookupByLibrary.simpleMessage("到下一等級"), "dengdaishangjiaqueren" : MessageLookupByLibrary.simpleMessage("等待商家確認"),