修改圈子列表图片加载内存溢出问题
This commit is contained in:
parent
f955acb850
commit
3d8c3f9cc3
@ -20,10 +20,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
import '../../../util/SharedPreferencesHelper.dart';
|
||||
import '../../../util/eventBus.dart';
|
||||
const listBgWidget = Image(
|
||||
image: AssetImage('assets/images/circle/circle_bg.png'),
|
||||
fit: BoxFit.fill,
|
||||
);
|
||||
|
||||
class InfoListView extends StatefulWidget {
|
||||
// Get.lazyPut(() => ListLogic());
|
||||
|
||||
@ -88,7 +85,13 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
} catch (_) {}
|
||||
});
|
||||
circleId = widget.bean.id.toString();
|
||||
|
||||
// if (Get.currentRoute == AppRoutes.Home || Get.currentRoute == AppRoutes.MyCircle) {
|
||||
loadCallOutListData();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
callRefreshCicle = EventBusManager.on<CallRefreshCircle>().listen((event) {
|
||||
if(widget.bean.id.toString() == event.circleId){
|
||||
loadCallOutListData();
|
||||
@ -195,23 +198,23 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
|
||||
void pushMsgPage(Lists bean, String cicleId) async {
|
||||
|
||||
if (widget.bean.is_limit&&widget.bean.amount>0) {
|
||||
showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){
|
||||
widget.bean.is_limit = false;
|
||||
if (Get.isRegistered<CircleLogic>()) {
|
||||
var logic = Get.find<CircleLogic>();
|
||||
for (var element in logic.circle.lists) {
|
||||
if (element.id == widget.bean.id) {
|
||||
element.is_limit = false;
|
||||
element.isJoin = true;
|
||||
}
|
||||
}
|
||||
logic.update();
|
||||
}
|
||||
Get.back();
|
||||
},widget.bean.ios_item);
|
||||
return;
|
||||
}
|
||||
// if (widget.bean.is_limit&&widget.bean.amount>0) {
|
||||
// showJoinCiclePiker(cicleId,widget.bean.amount.toString(),widget.bean.oldAmount.toString(),2,(payResult){
|
||||
// widget.bean.is_limit = false;
|
||||
// if (Get.isRegistered<CircleLogic>()) {
|
||||
// var logic = Get.find<CircleLogic>();
|
||||
// for (var element in logic.circle.lists) {
|
||||
// if (element.id == widget.bean.id) {
|
||||
// element.is_limit = false;
|
||||
// element.isJoin = true;
|
||||
// }
|
||||
// }
|
||||
// logic.update();
|
||||
// }
|
||||
// Get.back();
|
||||
// },widget.bean.ios_item);
|
||||
// return;
|
||||
// }
|
||||
|
||||
var sp = await SharedPreferencesHelper.getInstance();
|
||||
String myUserId = sp.getMyUserId();
|
||||
@ -225,6 +228,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
url: "/up-service/callout/${bean.id}/chat",);
|
||||
if (data["code"] == 200) {
|
||||
pushChatPage(data['data']['account_id'].toString().split("_").last,data['data']['account_id'], bean.user!.nickname!);
|
||||
|
||||
await Future.delayed(Duration(seconds: 1));
|
||||
SharedPreferences sharedPreferences =await SharedPreferences.getInstance();
|
||||
// SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
@ -233,8 +237,6 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
String name = sharedPreferences.getString(SharedPreferencesHelper.NAME)??"";
|
||||
bean.chat!.users!.add(Users(avatar: avatar,id: userId,nickname: name));
|
||||
widget.logic.update();
|
||||
// });
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +253,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
}
|
||||
widgets.add(Positioned(
|
||||
left: 15.sp * i,
|
||||
child: circleWidget(element.avatar??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.id.toString()),
|
||||
child: circleWidget(element.avatar! ?? "https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",element.id.toString()),
|
||||
));
|
||||
i++;
|
||||
});
|
||||
@ -270,7 +272,10 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
borderRadius: BorderRadius.circular(10.sp),
|
||||
child: SizedBox(
|
||||
width: Get.width,
|
||||
child: listBgWidget
|
||||
child: Image.asset(
|
||||
getCircleImage('circle_bg'),
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
)),
|
||||
Container(
|
||||
height: Get.height,
|
||||
@ -289,6 +294,8 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
// :
|
||||
ListView.builder(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
addAutomaticKeepAlives:false,
|
||||
addRepaintBoundaries:false,
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: scrollController,
|
||||
itemCount: lists.length + 2,
|
||||
@ -411,10 +418,12 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
padding: EdgeInsets.all(1.sp),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(8.0),
|
||||
child: Image.network(
|
||||
widget.bean.image,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:widget.bean.image,
|
||||
width: 40.sp,
|
||||
height: 40.sp,
|
||||
memCacheHeight: 40,
|
||||
memCacheWidth: 40,
|
||||
fit:BoxFit.cover
|
||||
),
|
||||
),
|
||||
@ -707,8 +716,8 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
width: 42.sp,
|
||||
),
|
||||
ClipOval(
|
||||
child: Image.network(
|
||||
lists.user!.avatar_thumb!,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:lists.user!.avatar_thumb!,
|
||||
width: 40.sp,
|
||||
height: 40.sp,
|
||||
fit: BoxFit.cover,
|
||||
@ -1013,11 +1022,13 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
width: 42.sp,
|
||||
),
|
||||
ClipOval(
|
||||
child: Image.network(
|
||||
lists.user!.avatar!,
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:lists.user!.avatar_thumb!,
|
||||
width: 40.sp,
|
||||
height: 40.sp,
|
||||
fit: BoxFit.cover,
|
||||
memCacheHeight: 40,
|
||||
memCacheWidth: 40,
|
||||
),
|
||||
)
|
||||
],
|
||||
@ -1191,6 +1202,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
onTap: () async{
|
||||
pushMsgPage(lists, widget.bean.id.toString());
|
||||
|
||||
// });
|
||||
},
|
||||
child: Image.asset(
|
||||
getCircleImage('chat'),
|
||||
@ -1219,11 +1231,13 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
width: width.sp,
|
||||
),
|
||||
ClipOval(
|
||||
child: Image.network(
|
||||
url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",
|
||||
child: CachedNetworkImage(
|
||||
imageUrl:url??"https://qiniuyun.leyuan666.com/quanzi/avatar/default.png",
|
||||
width: (width - 1).sp,
|
||||
height: (width - 1).sp,
|
||||
fit: BoxFit.cover,
|
||||
memCacheHeight: width.toInt() - 1,
|
||||
memCacheWidth: width.toInt() - 1,
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user