From 5a43223f658a9636b290e003000e2b71f762e522 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 30 Mar 2022 11:07:43 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E7=BE=A4=E5=88=B7=E6=96=B0=E6=9B=B4?= =?UTF-8?q?=E6=94=B9;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/community/community_child_page.dart | 16 ++++++++-------- lib/community/community_page.dart | 13 +++++++++++-- .../community_view/community_dynamic.dart | 19 ++++++++++++------- lib/retrofit/retrofit_api.dart | 4 ++-- lib/retrofit/retrofit_api.g.dart | 2 +- pubspec.lock | 2 +- pubspec.yaml | 2 +- 7 files changed, 36 insertions(+), 22 deletions(-) diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index f2798e76..b4c84200 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -18,15 +18,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; class CommunityChildPage extends StatefulWidget { final String typeStr; - CommunityChildPage(this.typeStr); + CommunityChildPage(Key key, this.typeStr): super(key: key); @override State createState() { - return _CommunityChildPage(); + return CommunityChildPageState(); } } -class _CommunityChildPage extends State with AutomaticKeepAliveClientMixin { +class CommunityChildPageState extends State with AutomaticKeepAliveClientMixin { RefreshController refreshController = RefreshController(); ApiService apiService; int pageNum = 1; @@ -38,10 +38,10 @@ class _CommunityChildPage extends State with AutomaticKeepAl @override void initState() { super.initState(); - _onRefresh(); + onRefresh(); } - _onRefresh() async { + onRefresh() async { setState(() {}); } @@ -120,7 +120,7 @@ class _CommunityChildPage extends State with AutomaticKeepAl return MyFooter(mode); }, ), - onRefresh: _onRefresh, + onRefresh: onRefresh, onLoading: () { isLoadMore = true; setState(() {}); @@ -142,7 +142,7 @@ class _CommunityChildPage extends State with AutomaticKeepAl isList: true, exitFull: () { setState(() { - _onRefresh(); + onRefresh(); }); }, ), @@ -154,7 +154,7 @@ class _CommunityChildPage extends State with AutomaticKeepAl "userId": userId, }, ).then((value) { - _onRefresh(); + onRefresh(); setState(() {}); }); setState(() {}); diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 421c89d0..92124c1f 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -21,6 +21,8 @@ class _CommunityPage extends State TabController tabcontroller; CommunityChildPage guanzhu,tuijian ; + final GlobalKey tuijianKey = GlobalKey(); + final GlobalKey guanzhuKey = GlobalKey(); List lables = [ "关注", @@ -41,6 +43,13 @@ class _CommunityPage extends State _toRelease() async { await Navigator.of(context).pushNamed('/router/release_dynamic'); + if(tabcontroller.index == 0){ + CommunityChildPageState page = guanzhuKey.currentState; + page.onRefresh(); + }else if(tabcontroller.index == 1){ + CommunityChildPageState page = tuijianKey.currentState; + page.onRefresh(); + } } @override @@ -103,12 +112,12 @@ class _CommunityPage extends State } else if(e == "分享健康"){ if (tuijian == null){ - tuijian = CommunityChildPage("分享健康"); + tuijian = CommunityChildPage(tuijianKey,"分享健康"); } return tuijian; }else if(e == "关注"){ if (guanzhu == null){ - guanzhu = CommunityChildPage("关注"); + guanzhu = CommunityChildPage(guanzhuKey,"关注"); } return guanzhu; } diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index a168ab26..350c0365 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -143,6 +143,17 @@ class _CommunityDynamic extends State { } } + goPersonalPage()async{ + await Navigator.of(context) + .pushNamed('/router/personal_page', arguments: { + "memberId": + (widget.article.author == widget.userId) + ? "0" + : widget.article.author, + }); + widget.exitFull(); + } + @override Widget build(BuildContext context) { return Column( @@ -188,13 +199,7 @@ class _CommunityDynamic extends State { // index: 0, //传入当前点击的图片的index // ), // )); - Navigator.of(context) - .pushNamed('/router/personal_page', arguments: { - "memberId": - (widget.article.author == widget.userId) - ? "0" - : widget.article.author, - }); + goPersonalPage(); }, child: MImage( (widget?.article?.authorHeadImg ?? diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index fce7c298..82a63199 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -71,8 +71,8 @@ part 'retrofit_api.g.dart'; // const baseUrl = "http://192.168.10.37:8766/app/"; -const base_url = "http://192.168.10.96:8766/app/";///詹云久 -const baseUrl = "http://192.168.10.96:8766/app/";///詹云久 +const base_url = "http://192.168.10.139:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.139:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index b3b319f8..16a722d9 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.96:8766/app/'; + baseUrl ??= 'http://192.168.10.139:8766/app/'; } final Dio _dio; diff --git a/pubspec.lock b/pubspec.lock index aa938ef1..cef5af7e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -307,7 +307,7 @@ packages: name: fluwx url: "https://pub.flutter-io.cn" source: hosted - version: "3.8.1+1" + version: "3.8.2" font_awesome_flutter: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index ee0e8467..20c07d3a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,7 @@ dependencies: sdk: flutter flutter_localizations: sdk: flutter - fluwx: ^3.5.0 + fluwx: ^3.8.2 gradient_widgets: ^0.6.0