Browse Source

Merge remote-tracking branch 'origin/new_revision_app' into new_revision_app

zyh
fmk 3 years ago
parent
commit
dc3b76f320
  1. 37
      lib/community/community_child_page.dart
  2. 3
      lib/main_page.dart
  3. 2
      lib/utils/flutter_utils.dart
  4. 14
      lib/view_widget/update_dialog.dart
  5. 2
      pubspec.yaml

37
lib/community/community_child_page.dart

@ -20,7 +20,8 @@ class CommunityChildPage extends StatefulWidget {
final Function onScroll;
final Function toRelease;
CommunityChildPage(Key key, this.typeStr,this.onScroll,this.toRelease): super(key: key);
CommunityChildPage(Key key, this.typeStr, this.onScroll, this.toRelease)
: super(key: key);
@override
State<StatefulWidget> createState() {
@ -28,7 +29,8 @@ class CommunityChildPage extends StatefulWidget {
}
}
class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKeepAliveClientMixin {
class CommunityChildPageState extends State<CommunityChildPage>
with AutomaticKeepAliveClientMixin {
RefreshController refreshController = RefreshController();
ApiService apiService;
int pageNum = 1;
@ -65,18 +67,15 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
userId = value.getString('userId');
apiService = ApiService(
Dio(),
apiService = ApiService(Dio(),
context: context,
token: value.getString("token"),
showLoading: false
);
showLoading: false);
}
if (isLoadMore) {
pageNum += 1;
isLoadMore = false;
}
else if(searchKey == null)pageNum = 1;
} else if (searchKey == null) pageNum = 1;
BaseData<PageInfo<ComunityComment>> baseData = await apiService.trendList({
"mid": "",
"onlyFollow": widget.typeStr == "关注" ? true : false,
@ -111,8 +110,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
element.likes = baseData.data.list[0]?.likes;
element.comments = baseData.data.list[0]?.comments;
this.isRefresh = false;
setState(() {
});
setState(() {});
}
});
} else {
@ -152,7 +150,10 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
return FutureBuilder(
future: queryCommunity(null),
builder: (context, position) {
return SmartRefresher(
return Stack(
alignment: Alignment.bottomRight,
children: [
SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
@ -168,18 +169,16 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
isLoadMore = true;
setState(() {});
},
child: Stack(
alignment: Alignment.bottomRight,
children: [
(articles == null || articles.length == 0)? NoDataView(
child: (articles == null || articles.length == 0)
? NoDataView(
src: "assets/image/guan_zhu.webp",
isShowBtn: false,
text: "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w),
margin:
EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
)
:
ListView.builder(
: ListView.builder(
controller: sc,
shrinkWrap: true,
itemBuilder: (context, position) {
@ -212,6 +211,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
},
itemCount: articles.length,
),
),
GestureDetector(
onTap: () {
widget.toRelease();
@ -226,7 +226,6 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
),
)
],
),
);
},
);

3
lib/main_page.dart

@ -129,6 +129,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
UnionPage(unionPageKey,0),
// (Theme.of(context).platform == TargetPlatform.android) ? OrderPage() :CommunityPage(),
CommunityPage(),
// OrderPage(),
MinePage(minePageKey),
];
@ -353,7 +354,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
BaseData<AppUpdate> baseData = await apiService.appVersion().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
// baseData.data.appLastVersion = "1.0.4";
// baseData.data.appLastVersion = "2.0.11";
// baseData.data.appLastVersionUp = "1.0.1";
if(AppUtils.versionCompare(packageInfo.version,baseData.data?.appLastVersion)
&& AppUtils.versionCompare(value.getString("appLastVersion")??"1.0.0",baseData.data?.appLastVersion)){

2
lib/utils/flutter_utils.dart

@ -26,7 +26,7 @@ class AppUtils {
return false;
if (int.tryParse(localVersionArr[1]) > int.tryParse(serverVersionArr[1]))
return false;
if (int.tryParse(localVersionArr[2]) > int.tryParse(serverVersionArr[2]))
if (int.tryParse(localVersionArr[2]) >= int.tryParse(serverVersionArr[2]))
return false;
} catch (ex) {}
return true;

14
lib/view_widget/update_dialog.dart

@ -30,12 +30,13 @@ class _UpdateDialog extends State<UpdateDialog> {
child: Center(
child: Container(
width: MediaQuery.of(context).size.width - 80.w,
height: 165.h,
// height: 216.h,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.r),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: double.infinity,
@ -45,7 +46,7 @@ class _UpdateDialog extends State<UpdateDialog> {
child: Column(
children: [
Text(
"检测到新版本 v${widget.appUpdate.appLastVersion}",
"发现新版本 v${widget.appUpdate.appLastVersion}",
style: TextStyle(
fontSize: 17.sp,
fontWeight: MyFontWeight.semi_bold,
@ -54,7 +55,8 @@ class _UpdateDialog extends State<UpdateDialog> {
),
SizedBox(height: 12.h,),
Text(
"是否需要更新到最新版本?",
widget.appUpdate.appLastVersionExplain ?? "",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 17.sp,
fontWeight: MyFontWeight.regular,
@ -69,7 +71,7 @@ class _UpdateDialog extends State<UpdateDialog> {
height: 1.h,
),
Container(
height: 69.h,
height:55.h,
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
@ -81,7 +83,7 @@ class _UpdateDialog extends State<UpdateDialog> {
},
child: Container(
width: double.infinity,
height: 90.h,
// height: 90.h,
alignment: Alignment.center,
child: Text(
"下次再说",
@ -107,7 +109,7 @@ class _UpdateDialog extends State<UpdateDialog> {
},
child: Container(
width: double.infinity,
height: 90.h,
// height: 90.h,
alignment: Alignment.center,
child: Text(
"立即更新",

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 2.0.12+9
version: 2.0.14+9
environment:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save