Browse Source

图片优化

ff_new
w-R 3 years ago
parent
commit
132033c083
  1. 3
      lib/integral_store/integral_store_details_page.dart
  2. 20
      lib/mine/mine_page.dart
  3. 201
      lib/mine/mine_vip/mine_vip_core.dart
  4. 3
      lib/mine/user_info_page.dart
  5. 2
      lib/view_widget/hot_item.dart
  6. 4
      lib/view_widget/icon_text.dart
  7. 4
      lib/view_widget/message_item.dart
  8. 1
      lib/view_widget/mine_vip_view.dart

3
lib/integral_store/integral_store_details_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -296,7 +297,7 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return goods == null return goods == null
? Container() ? Container()
: Image.network( : MImage(
goods.viceImgPaths.elementAt(position), goods.viceImgPaths.elementAt(position),
fit: BoxFit.cover, fit: BoxFit.cover,
) )

20
lib/mine/mine_page.dart

@ -32,7 +32,7 @@ class MinePage extends StatefulWidget {
} }
} }
class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin ,WidgetsBindingObserver{ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
UserInfo userInfo; UserInfo userInfo;
List<Rank> ranks = []; List<Rank> ranks = [];
@ -55,29 +55,13 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin ,Widg
super.dispose(); super.dispose();
if (_refreshController != null) if (_refreshController != null)
_refreshController.dispose(); _refreshController.dispose();
WidgetsBinding.instance.removeObserver(this); //
} }
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
print("-didChangeAppLifecycleState-" + state.toString());
switch (state) {
case AppLifecycleState.inactive: //
break;
case AppLifecycleState.resumed: //
querySocialInfo();
break;
case AppLifecycleState.paused: //
break;
case AppLifecycleState.detached: // APP结束时调用
break;
}
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
WidgetsBinding.instance.addObserver(this);
querySocialInfo(); querySocialInfo();
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {

201
lib/mine/mine_vip/mine_vip_core.dart

@ -152,28 +152,30 @@ class _MineVipCore extends State<MineVipCore> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Stack( return Container(
children: [ color: Color(0xFFF7F7F7),
Container( child: Stack(
// padding: EdgeInsets.only(top: 40.h), children: [
height:260.h, Container(
decoration: BoxDecoration( // padding: EdgeInsets.only(top: 40.h),
gradient: new LinearGradient( height:260.h,
begin: Alignment.bottomCenter, decoration: BoxDecoration(
end: Alignment.topCenter, gradient: new LinearGradient(
colors: [ begin: Alignment.bottomCenter,
Color(0xFF000000), end: Alignment.topCenter,
Color(0xFF585858), colors: [
]), Color(0xFF000000),
// border: Border.all(color: Colors.white,width: 0.5), Color(0xFF585858),
shape: BoxShape.rectangle, ]),
borderRadius: BorderRadius.only( // border: Border.all(color: Colors.white,width: 0.5),
bottomRight: Radius.circular(35), shape: BoxShape.rectangle,
bottomLeft: Radius.circular(35), borderRadius: BorderRadius.only(
bottomRight: Radius.circular(35),
bottomLeft: Radius.circular(35),
),
),
), ),
), Column(
),
Column(
children: [ children: [
SizedBox(height: 40), SizedBox(height: 40),
Container( Container(
@ -232,48 +234,49 @@ class _MineVipCore extends State<MineVipCore> {
child: Column( child: Column(
children: [ children: [
/// ///
Container( if(ranks.length > 0)
height: (MediaQuery.of(context).size.width) / Container(
1.78 * height: (MediaQuery.of(context).size.width) /
AppUtils.textScale(context), 1.78 *
child: Swiper( AppUtils.textScale(context),
viewportFraction: 0.95, child: Swiper(
loop: false, viewportFraction: 0.95,
physics: BouncingScrollPhysics(), loop: false,
controller: controller, physics: BouncingScrollPhysics(),
onIndexChanged: (index) { controller: controller,
setState(() { onIndexChanged: (index) {
checkIndex = index; setState(() {
}); checkIndex = index;
}, });
itemBuilder: (context, position) { },
return MineVipView( itemBuilder: (context, position) {
vipLevel: !(ranks != null && ranks.isNotEmpty) return MineVipView(
? widget.arguments["rankLevel"] vipLevel: !(ranks != null && ranks.isNotEmpty)
: position + 1, ? widget.arguments["rankLevel"]
curLevel: widget.arguments["rankLevel"], : position + 1,
tag: (widget.arguments["rankLevel"] == (position + 1) || curLevel: widget.arguments["rankLevel"],
!(ranks != null && ranks.isNotEmpty)) tag: (widget.arguments["rankLevel"] == (position + 1) ||
? "vip" !(ranks != null && ranks.isNotEmpty))
: "", ? "vip"
padding: 6.w, : "",
// rank: !(ranks != null && ranks.isNotEmpty) padding: 6.w,
// ? 0 // rank: !(ranks != null && ranks.isNotEmpty)
// : widget.arguments["expendAmount"] ?? 0, // ? 0
rankMax: !(ranks != null && ranks.isNotEmpty) // : widget.arguments["expendAmount"] ?? 0,
? 0 rankMax: !(ranks != null && ranks.isNotEmpty)
: ranks[position].rankOrigin, ? 0
createTime: widget.arguments["createTime"], : ranks[position].rankOrigin,
showRank: false, createTime: widget.arguments["createTime"],
price: !(ranks != null && ranks.isNotEmpty) showRank: false,
? "0" price: !(ranks != null && ranks.isNotEmpty)
: ranks[position].price, ? "0"
); : ranks[position].price,
}, );
itemCount: },
(ranks != null && ranks.isNotEmpty) ? ranks.length : 1, itemCount:
(ranks != null && ranks.isNotEmpty) ? ranks.length : 1,
),
), ),
),
/// ///
Container( Container(
@ -528,45 +531,47 @@ class _MineVipCore extends State<MineVipCore> {
)), )),
], ],
), ),
if (ranks.length > checkIndex && if (ranks.length > checkIndex &&
widget.arguments["rankLevel"] < ranks[checkIndex].level && widget.arguments["rankLevel"] < ranks[checkIndex].level &&
ranks[checkIndex].price != "0.00") ranks[checkIndex].price != "0.00")
Align( Align(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
setState(() { setState(() {
buyRank(); buyRank();
}); });
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
gradient: new LinearGradient( gradient: new LinearGradient(
begin: Alignment.centerLeft, begin: Alignment.centerLeft,
end: Alignment.centerRight, end: Alignment.centerRight,
colors: [ colors: [
Color(0xFFFFDCA1), Color(0xFFFFDCA1),
Color(0xFFFAE4C0), Color(0xFFFAE4C0),
]), ]),
), ),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(16), padding: EdgeInsets.all(16),
height: 54, height: 54,
alignment: Alignment.center, alignment: Alignment.center,
child: Text( child: Text(
"${S.of(context).lijikaitong}${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久", "${S.of(context).lijikaitong}${ranks.length > checkIndex ? ranks[checkIndex].price : ""}/永久",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 16.sp, fontSize: 16.sp,
color: Color(0xFF4A4748), color: Color(0xFF4A4748),
),
),
), ),
), ),
), )
),
) ],
),
);
],
);
} }

3
lib/mine/user_info_page.dart

@ -11,6 +11,7 @@ import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/flutter_utils.dart'; import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/view_widget/cupertino_date_picker.dart'; import 'package:huixiang/view_widget/cupertino_date_picker.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:image_pickers/image_pickers.dart'; import 'package:image_pickers/image_pickers.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@ -410,7 +411,7 @@ class _UserInfoPage extends State<UserInfoPage> {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
child: filePath == null || filePath == "" child: filePath == null || filePath == ""
? (modifyInfo["headimg"] != null && modifyInfo["headimg"] != "" ? (modifyInfo["headimg"] != null && modifyInfo["headimg"] != ""
? Image.network( ? MImage(
modifyInfo["headimg"], modifyInfo["headimg"],
width: 42, width: 42,
height: 42, height: 42,

2
lib/view_widget/hot_item.dart

@ -176,7 +176,7 @@ class _HotArticleItem extends State<HotArticleItem> {
child:Stack( child:Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
Image.network( MImage(
widget.article?.coverImg ?? "", widget.article?.coverImg ?? "",
fit: BoxFit.fill, fit: BoxFit.fill,
height: double.infinity, height: double.infinity,

4
lib/view_widget/icon_text.dart

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'custom_image.dart';
class IconText extends StatelessWidget { class IconText extends StatelessWidget {
final String leftImage; final String leftImage;
final String rightImage; final String rightImage;
@ -48,7 +50,7 @@ class IconText extends StatelessWidget {
widgets.add(Padding( widgets.add(Padding(
padding: EdgeInsets.only(left: 2), padding: EdgeInsets.only(left: 2),
child: leftImage.startsWith("http") child: leftImage.startsWith("http")
? Image.network( ? MImage(
leftImage, leftImage,
width: iconSize, width: iconSize,
height: iconSize, height: iconSize,

4
lib/view_widget/message_item.dart

@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'custom_image.dart';
class MessageItem extends StatefulWidget { class MessageItem extends StatefulWidget {
final int stStatus; final int stStatus;
@ -19,7 +21,7 @@ class _MessageItemState extends State<MessageItem> {
if (widget.stStatus != 0) checkView(), if (widget.stStatus != 0) checkView(),
Container( Container(
margin: EdgeInsets.only(left: widget.stStatus == 0 ? 16 : 0), margin: EdgeInsets.only(left: widget.stStatus == 0 ? 16 : 0),
child: Image.network( child: MImage(
"https://t7.baidu.com/it/u=1297102096,3476971300&fm=193&f=GIF", "https://t7.baidu.com/it/u=1297102096,3476971300&fm=193&f=GIF",
width: 44.w, width: 44.w,
fit: BoxFit.cover, fit: BoxFit.cover,

1
lib/view_widget/mine_vip_view.dart

@ -331,7 +331,6 @@ class MineVipView extends StatelessWidget {
.pushNamed('/router/mine_vip_core', arguments: { .pushNamed('/router/mine_vip_core', arguments: {
"rankLevel": curLevel, "rankLevel": curLevel,
"userInfo":userInfo.masterCardRankName, "userInfo":userInfo.masterCardRankName,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "", "createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(), "expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(),
}); });

Loading…
Cancel
Save