相册缩略图 无法刷新和点击回顶部eventbus 方法
This commit is contained in:
parent
7bcf0dbefe
commit
2f7876fae9
@ -155,6 +155,8 @@ class Call_outLogic extends GetxController {
|
||||
final logic = Get.put(CircleLogic());
|
||||
logic.setCircle(numbers[0].id);
|
||||
logic.refresh();
|
||||
|
||||
EventBusManager.fire(CallRefreshCircle(numbers[0].id));
|
||||
// logic.update();
|
||||
// Navigator.pop(Get.context!, numbers);
|
||||
Get.back();
|
||||
|
||||
@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../util/eventBus.dart';
|
||||
import '../select_circle/logic.dart';
|
||||
import 'logic.dart';
|
||||
|
||||
@ -20,7 +21,6 @@ class CirclePage extends StatefulWidget {
|
||||
class _CirclePageState extends State<CirclePage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
@ -33,7 +33,6 @@ class _CirclePageState extends State<CirclePage>
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
scrollController.dispose();
|
||||
super.dispose();
|
||||
|
||||
}
|
||||
@ -69,8 +68,8 @@ class _CirclePageState extends State<CirclePage>
|
||||
child: Swiper(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var bean = logic.circle.lists[index];
|
||||
final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
|
||||
return InfoListView(key:infoListViewKey,index:index,bean: bean, logic:logic,scrollController:scrollController);
|
||||
// final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
|
||||
return InfoListView(index, bean, logic);
|
||||
},
|
||||
onIndexChanged: (index) {
|
||||
controller.state.index = index;
|
||||
@ -178,11 +177,7 @@ class _CirclePageState extends State<CirclePage>
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: (){
|
||||
scrollController.animateTo(
|
||||
0.0, // Scroll to the top
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
EventBusManager.fire(ScrollToTop());
|
||||
},
|
||||
child: Text(
|
||||
'发现',
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:circle_app/app/circle/logic.dart';
|
||||
import 'package:circle_app/app/circle/state.dart';
|
||||
@ -16,35 +18,28 @@ import 'package:get/get.dart';
|
||||
import 'package:get/get_core/src/get_main.dart';
|
||||
|
||||
import '../../../util/SharedPreferencesHelper.dart';
|
||||
import '../../../util/eventBus.dart';
|
||||
|
||||
class InfoListView extends StatefulWidget {
|
||||
// Get.lazyPut(() => ListLogic());
|
||||
|
||||
|
||||
|
||||
|
||||
final int index;
|
||||
late final Circle bean;
|
||||
var logic;
|
||||
final ScrollController scrollController;
|
||||
Circle bean;
|
||||
int index;
|
||||
//MyListViewback back;
|
||||
|
||||
InfoListView(this.index, this.bean, this.logic,{super.key});
|
||||
|
||||
InfoListView({
|
||||
Key? key,
|
||||
required this.index,
|
||||
required this.bean,
|
||||
required this.logic,
|
||||
required this.scrollController,
|
||||
}) : super(key: key);
|
||||
|
||||
|
||||
@override
|
||||
State<InfoListView> createState() => InfoListViewState();
|
||||
}
|
||||
|
||||
typedef void MyListViewback(State<InfoListView> result);
|
||||
class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
|
||||
ListLogic? listsLg;
|
||||
@ -60,26 +55,54 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
@override
|
||||
void dispose() {
|
||||
// TODO: implement dispose
|
||||
if(null!=callRefreshCicle){
|
||||
EventBusManager.cancelSubscription(callRefreshCicle!);
|
||||
}
|
||||
if(null!=scroToTop){
|
||||
EventBusManager.cancelSubscription(scroToTop!);
|
||||
|
||||
}
|
||||
scrollController.dispose();
|
||||
super.dispose();
|
||||
// widget.scrollController.dispose();
|
||||
|
||||
|
||||
}
|
||||
|
||||
StreamSubscription? callRefreshCicle =null;
|
||||
StreamSubscription? scroToTop =null;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
widget.scrollController.addListener(() {
|
||||
scrollController.addListener(() {
|
||||
try {
|
||||
if (widget.scrollController.position.pixels ==
|
||||
widget.scrollController.position.maxScrollExtent) {
|
||||
if (scrollController.position.pixels ==
|
||||
scrollController.position.maxScrollExtent) {
|
||||
loadMore();
|
||||
}
|
||||
} catch (_) {}
|
||||
});
|
||||
circleId = widget.bean.id.toString();
|
||||
loadCallOutListData();
|
||||
callRefreshCicle = EventBusManager.on<CallRefreshCircle>().listen((event) {
|
||||
if(widget.bean.id.toString() == event.circleId){
|
||||
loadCallOutListData();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
scroToTop = EventBusManager.on<ScrollToTop>().listen((event) {
|
||||
scrollController.animateTo(
|
||||
0.0,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
});
|
||||
|
||||
// widget.back(widget.createState());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -241,7 +264,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
ListView.builder(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
scrollDirection: Axis.vertical,
|
||||
controller: widget.scrollController,
|
||||
controller: scrollController,
|
||||
itemCount: lists.length + 2,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
@ -292,7 +315,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
width: 8.sp,
|
||||
),
|
||||
Text(
|
||||
'${convertToTenThousand(widget.bean.joinTotal)}圈友',
|
||||
'${convertToTenThousand(widget.bean.joinTotal)}圈友加入',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 12.sp),
|
||||
@ -374,7 +397,7 @@ class InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClien
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: (){
|
||||
widget.scrollController.animateTo(
|
||||
scrollController.animateTo(
|
||||
0.0, // Scroll to the top
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
|
||||
@ -73,7 +73,7 @@ class FriendslistPage extends StatelessWidget {
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: item.avatar,
|
||||
imageUrl: item.avatarThumb,
|
||||
width: 53.sp,
|
||||
height: 53.sp,
|
||||
),
|
||||
|
||||
@ -77,7 +77,7 @@ class LikelistPage extends StatelessWidget {
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: item.user.avatar,
|
||||
imageUrl: item.user.avatarThumb,
|
||||
width: 53.sp,
|
||||
height: 53.sp,
|
||||
),
|
||||
|
||||
@ -20,9 +20,10 @@ class Complete_materialLogic extends GetxController {
|
||||
@override
|
||||
void onReady() {
|
||||
// TODO: implement onReady
|
||||
// FlutterNativeSplash.remove();
|
||||
super.onReady();
|
||||
|
||||
FlutterNativeSplash.remove();
|
||||
|
||||
}
|
||||
final Complete_materialState state = Complete_materialState();
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
@ -44,6 +45,7 @@ class Complete_materialLogic extends GetxController {
|
||||
|
||||
@override
|
||||
void onInit() async {
|
||||
FlutterNativeSplash.remove();
|
||||
if(type!=''){
|
||||
var data = await DioManager.instance.get(url: Api.getUserInfo);
|
||||
var bean = BaseResponse<ResponseBean>.fromJson(
|
||||
|
||||
@ -50,7 +50,7 @@ class MinefragmentLogic extends GetxController {
|
||||
like_me_count = bean.data.likeMeCount ?? 0;
|
||||
recent_visit_count = bean.data.recentVisitCount ?? 0;
|
||||
joinedCircle = "${"加入了${bean.data.joininterestcount}"}个圈子";
|
||||
|
||||
enterHomeInfoMsg = bean.data.mainGuideText;
|
||||
|
||||
|
||||
SharedPreferences sharedPreferences =
|
||||
@ -163,6 +163,7 @@ class MineResponseBean {
|
||||
int? vipExpireDays;
|
||||
String phone;
|
||||
int? joininterestcount;
|
||||
String mainGuideText;
|
||||
|
||||
MineResponseBean(
|
||||
{required this.user,
|
||||
@ -172,7 +173,8 @@ class MineResponseBean {
|
||||
this.vipExpireDate,
|
||||
this.vipExpireDays,
|
||||
required this.phone,
|
||||
required this.joininterestcount});
|
||||
required this.joininterestcount,
|
||||
required this.mainGuideText});
|
||||
|
||||
factory MineResponseBean.fromJson(Map<String, dynamic> json) {
|
||||
return MineResponseBean(
|
||||
@ -184,6 +186,7 @@ class MineResponseBean {
|
||||
vipExpireDate: json['vip_expire_date'],
|
||||
vipExpireDays: json['vip_expire_days'],
|
||||
joininterestcount: json['join_interest_count'],
|
||||
mainGuideText:json['main_guide_text'],
|
||||
|
||||
|
||||
);
|
||||
|
||||
@ -116,7 +116,7 @@ class MsgPage extends StatelessWidget {
|
||||
},
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
print("123123123");
|
||||
|
||||
logic.listScrollController.animateTo(
|
||||
0.0,
|
||||
duration: Duration(milliseconds: 300),
|
||||
|
||||
@ -10,6 +10,8 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import '../../util/eventBus.dart';
|
||||
|
||||
|
||||
class My_circlePage extends StatefulWidget {
|
||||
My_circlePage({Key? key}) : super(key: key);
|
||||
@ -29,7 +31,6 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
|
||||
|
||||
var getContext;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -59,14 +60,12 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
child: logic.circle.lists.isEmpty ? loaddingWidget(true) : Swiper(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var bean = logic.circle.lists[index];
|
||||
final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
|
||||
MyinfoListViewKey = infoListViewKey;
|
||||
// final GlobalKey<InfoListViewState> infoListViewKey = GlobalKey<InfoListViewState>();
|
||||
// MyinfoListViewKey = infoListViewKey;
|
||||
return InfoListView(
|
||||
key: infoListViewKey, // Assign the key here
|
||||
index: index,
|
||||
bean: bean,
|
||||
logic: controller,
|
||||
scrollController: scrollController,
|
||||
index,
|
||||
bean,
|
||||
controller
|
||||
);
|
||||
},
|
||||
index: controller.state.index,
|
||||
@ -100,11 +99,7 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
return MyAppBar(
|
||||
centerTitle: '我的圈子',
|
||||
onCenterTitlePressed: (){
|
||||
scrollController.animateTo(
|
||||
0.0, // Scroll to the top
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
EventBusManager.fire(ScrollToTop());
|
||||
},
|
||||
actionWdiget: const Text(
|
||||
"发布喊话",
|
||||
@ -117,7 +112,7 @@ class _My_circlePageState extends State<My_circlePage>
|
||||
logic.getCircleIndex().title!,
|
||||
false));
|
||||
var data = await Get.toNamed(AppRoutes.Call_out, arguments: {'numbers': numbers});
|
||||
MyinfoListViewKey.currentState?.loadCallOutListData();
|
||||
// MyinfoListViewKey.currentState?.loadCallOutListData();
|
||||
// logic.refresh();
|
||||
// logic.update();
|
||||
},
|
||||
|
||||
@ -13,7 +13,6 @@ class Signal_circle_listPage extends StatelessWidget {
|
||||
|
||||
final logic = Get.find<Signal_circle_listLogic>();
|
||||
final state = Get.find<Signal_circle_listLogic>().state;
|
||||
final ScrollController scrollController = ScrollController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@ -42,7 +41,7 @@ class Signal_circle_listPage extends StatelessWidget {
|
||||
Expanded(
|
||||
child: controller.circle == null
|
||||
? loaddingWidget(true)
|
||||
: InfoListView(key:GlobalKey<InfoListViewState>(),index:0,bean: controller.circle!,logic: controller,scrollController:scrollController))
|
||||
: InfoListView(0, controller.circle!, controller))
|
||||
]),
|
||||
));
|
||||
}));
|
||||
|
||||
@ -44,8 +44,9 @@ class SplashLogic extends GetxController {
|
||||
SharedPreferencesHelper.getInstance().then((sharedPreferences) {
|
||||
sharedPreferences.setString(SharedPreferencesHelper.AUTHORIZATION,
|
||||
bean.data!.Authorization.toString());
|
||||
});
|
||||
Get.offNamed(AppRoutes.Complete_materialPage);
|
||||
});
|
||||
|
||||
return;
|
||||
} else if(bean.code == 5000||bean.code == 5001||bean.code == 5002||bean.code == 5003){
|
||||
pushLoginPage();
|
||||
|
||||
@ -107,7 +107,7 @@ class UserinfoLogic extends GetxController {
|
||||
isOnline = userInfoBean!.isOnline;
|
||||
isBlackBeen = bean.data.isBlock;
|
||||
isDestroy = bean.data.isDestroy;
|
||||
if(isBlackBeen){
|
||||
if (isBlackBeen) {
|
||||
showOKToast("您已被对方拉黑");
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ class UserinfoLogic extends GetxController {
|
||||
}
|
||||
|
||||
setLike() async {
|
||||
if(isBlack||isDestroy){
|
||||
if (isBlack || isDestroy) {
|
||||
showOKToast("喜欢失败,存在拉黑关系或者该账户已注销");
|
||||
return;
|
||||
}
|
||||
@ -261,7 +261,8 @@ class UserinfoLogic extends GetxController {
|
||||
AlbumListItem(
|
||||
id: myAlbumBean.data.id,
|
||||
type: myAlbumBean.data.type,
|
||||
url: result));
|
||||
url: result,
|
||||
urlThumb: result));
|
||||
update();
|
||||
}
|
||||
});
|
||||
@ -405,11 +406,13 @@ class AlbumListItem {
|
||||
int id;
|
||||
int type;
|
||||
String url;
|
||||
String urlThumb;
|
||||
|
||||
AlbumListItem({
|
||||
required this.id,
|
||||
required this.type,
|
||||
required this.url,
|
||||
required this.urlThumb,
|
||||
});
|
||||
|
||||
factory AlbumListItem.fromJson(Map<String, dynamic> json) {
|
||||
@ -417,6 +420,7 @@ class AlbumListItem {
|
||||
id: json['id'],
|
||||
type: json['type'],
|
||||
url: json['url'],
|
||||
urlThumb: json['thumb'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,7 +543,7 @@ class MyTabbedScreenState extends State<UserinfoPage>
|
||||
margin: EdgeInsets.all(5.sp),
|
||||
child: Center(
|
||||
child: _buildImageItem(
|
||||
controller.state.imaglist[index].url,
|
||||
controller.state.imaglist[index].urlThumb,
|
||||
controller,
|
||||
index,
|
||||
),
|
||||
|
||||
@ -74,7 +74,7 @@ class VisitorlistPage extends StatelessWidget {
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.cover,
|
||||
imageUrl: item.user.avatar,
|
||||
imageUrl: item.user.avatarThumb,
|
||||
width: 53.sp,
|
||||
height: 53.sp,
|
||||
),
|
||||
|
||||
@ -48,3 +48,13 @@ class CommentBlackEvent {
|
||||
}
|
||||
class CommentBlackMoreEvent {
|
||||
}
|
||||
|
||||
class CallRefreshCircle {
|
||||
String circleId = "";
|
||||
|
||||
CallRefreshCircle(String id);
|
||||
}
|
||||
|
||||
class ScrollToTop {
|
||||
|
||||
}
|
||||
@ -172,7 +172,7 @@ String filterSensitiveWords(String input, List<String> sensitiveWords) {
|
||||
}
|
||||
|
||||
String getAgeCOntent(int gender, int age, int role, int orientation) {
|
||||
return "${getGenderContent(gender)}.${age}.${getRoleContent(role)}.${getOrientationContent(orientation)}";
|
||||
return "${getGenderContent(gender)}·${age}·${getRoleContent(role)}·${getOrientationContent(orientation)}";
|
||||
}
|
||||
|
||||
String getGenderContent(int number) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user