Skip to content

Commit 77b4701

Browse files
committed
1、修复进入搜索页、项目细分页内登录后再退出时登录状态未刷新问题
1 parent 7e810b9 commit 77b4701

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

lib/page/home/home/home_page.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,11 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
108108
if (state is HomeSearchStarted) {
109109
if (!state.isSearchWXArticle) {
110110
Navigator.pushNamed(context, SearchPage.ROUTER_NAME,
111-
arguments: _searchTextContriller.text);
111+
arguments: _searchTextContriller.text).then((_){
112+
if(!isLogin){
113+
homeBloc.dispatch(LoadHome());
114+
}
115+
});
112116
}
113117
}
114118
if (state is HomeBmobLoaded) {

lib/page/home/project/project_page.dart

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,15 @@ class _ProjectSubPageState extends State<ProjectSubPage>
338338
ProjectTypesModel data = datas[index];
339339
return GestureDetector(
340340
onTap: () {
341-
Navigator.pushNamed(
342-
context, ProjectDetailPage.ROUTER_NAME, arguments: {
343-
'id': data.id,
344-
'name': decodeString(data.title)
341+
Navigator.pushNamed(context, ProjectDetailPage.ROUTER_NAME,
342+
arguments: {
343+
'id': data.id,
344+
'name': decodeString(data.title)
345+
}).then((_) {
346+
HomeBloc homeBloc = BlocProvider.of<HomeBloc>(context);
347+
if (!homeBloc.isLogin) {
348+
homeBloc.dispatch(LoadHome());
349+
}
345350
});
346351
},
347352
child: Container(
@@ -377,6 +382,12 @@ class _ProjectSubPageState extends State<ProjectSubPage>
377382
context, ProjectDetailPage.ROUTER_NAME, arguments: {
378383
'id': data.id,
379384
'name': decodeString(data.title)
385+
}).then((_) {
386+
HomeBloc homeBloc =
387+
BlocProvider.of<HomeBloc>(context);
388+
if (!homeBloc.isLogin) {
389+
homeBloc.dispatch(LoadHome());
390+
}
380391
});
381392
},
382393
child: Container(
@@ -643,7 +654,12 @@ class _ProjectItemState extends State<ProjectItem>
643654
arguments: {
644655
'id': widget.data.chapterId,
645656
'name': decodeString(widget.data.chapterName)
646-
});
657+
}).then((_) {
658+
HomeBloc homeBloc = BlocProvider.of<HomeBloc>(context);
659+
if (!homeBloc.isLogin) {
660+
homeBloc.dispatch(LoadHome());
661+
}
662+
});
647663
},
648664
child: Padding(
649665
padding:

0 commit comments

Comments
 (0)