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/retrofit_api.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:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -296,7 +297,7 @@ class _IntegralStoreDetailsPage extends State<IntegralStoreDetailsPage> {
itemBuilder: (context, position) {
return goods == null
? Container()
: Image.network(
: MImage(
goods.viceImgPaths.elementAt(position),
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;
UserInfo userInfo;
List<Rank> ranks = [];
@ -55,29 +55,13 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin ,Widg
super.dispose();
if (_refreshController != null)
_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
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
querySocialInfo();
eventBus.on<EventType>().listen((event) {

201
lib/mine/mine_vip/mine_vip_core.dart

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

2
lib/view_widget/hot_item.dart

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

4
lib/view_widget/icon_text.dart

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'custom_image.dart';
class IconText extends StatelessWidget {
final String leftImage;
final String rightImage;
@ -48,7 +50,7 @@ class IconText extends StatelessWidget {
widgets.add(Padding(
padding: EdgeInsets.only(left: 2),
child: leftImage.startsWith("http")
? Image.network(
? MImage(
leftImage,
width: 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:flutter_screenutil/flutter_screenutil.dart';
import 'custom_image.dart';
class MessageItem extends StatefulWidget {
final int stStatus;
@ -19,7 +21,7 @@ class _MessageItemState extends State<MessageItem> {
if (widget.stStatus != 0) checkView(),
Container(
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",
width: 44.w,
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: {
"rankLevel": curLevel,
"userInfo":userInfo.masterCardRankName,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"expendAmount": double.tryParse(userInfo?.expendAmount??"0").toInt(),
});

Loading…
Cancel
Save