Browse Source

社群列表更改

remove_uniapp
w-R 3 years ago
parent
commit
59dacb4da7
  1. 9
      lib/community/community_child_page.dart
  2. 27
      lib/community/community_page.dart
  3. 2
      lib/retrofit/min_api.dart
  4. 2
      lib/retrofit/retrofit_api.dart

9
lib/community/community_child_page.dart

@ -17,8 +17,9 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class CommunityChildPage extends StatefulWidget {
final String typeStr;
final Function onScroll;
CommunityChildPage(Key key, this.typeStr): super(key: key);
CommunityChildPage(Key key, this.typeStr,this.onScroll): super(key: key);
@override
State<StatefulWidget> createState() {
@ -32,12 +33,16 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
int pageNum = 1;
String userId;
bool isLoadMore = false;
ScrollController sc = ScrollController();
List<Article> articles = [];
@override
void initState() {
super.initState();
sc.addListener(() {
widget.onScroll();
});
onRefresh();
}
@ -132,7 +137,7 @@ class CommunityChildPageState extends State<CommunityChildPage> with AutomaticKe
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w),
):ListView.builder(
physics: NeverScrollableScrollPhysics(),
controller: sc,
itemBuilder: (context, position) {
return InkWell(
child: CommunityDynamic(

27
lib/community/community_page.dart

@ -32,15 +32,36 @@ class _CommunityPage extends State<CommunityPage>
"关于回乡",
// "直播",
];
ScrollPhysics b = BouncingScrollPhysics();
int scrollCount = 0;
@override
void initState() {
super.initState();
if (tabcontroller == null)
tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1);
}
void onChildScroll(){
if(scrollCount == 0){
setState(() {
b = NeverScrollableScrollPhysics();
});
}
scrollCount+=1;
Future.delayed(Duration(seconds:1), () {
scrollCount-=1;
if(scrollCount == 0){
setState(() {
b = BouncingScrollPhysics();
});
}
});
}
_toRelease() async {
await Navigator.of(context).pushNamed('/router/release_dynamic');
if(tabcontroller.index == 0){
@ -101,7 +122,7 @@ class _CommunityPage extends State<CommunityPage>
body: Container(
padding: EdgeInsets.only(bottom: 76.h),
child: TabBarView(
physics: BouncingScrollPhysics(),
physics: b,
children: lables.map((e) {
if (e == "关于回乡") {
return BrandPage();
@ -112,12 +133,12 @@ class _CommunityPage extends State<CommunityPage>
}
else if(e == "分享健康"){
if (tuijian == null){
tuijian = CommunityChildPage(tuijianKey,"分享健康");
tuijian = CommunityChildPage(tuijianKey,"分享健康",onChildScroll);
}
return tuijian;
}else if(e == "关注"){
if (guanzhu == null){
guanzhu = CommunityChildPage(guanzhuKey,"关注");
guanzhu = CommunityChildPage(guanzhuKey,"关注",onChildScroll);
}
return guanzhu;
}

2
lib/retrofit/min_api.dart

@ -32,7 +32,7 @@ part 'min_api.g.dart';
// const base_url = "http://192.168.10.37:8766/app/";
const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///
const localBaseUrl = "http://192.168.10.236:8766/app/";///
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线

2
lib/retrofit/retrofit_api.dart

@ -68,7 +68,7 @@ part 'retrofit_api.g.dart';
// const base_url = "http://192.168.10.132:8766/app/";///
const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///
const localBaseUrl = "http://192.168.10.236:8766/app/";///
const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线
@RestApi(baseUrl: localBaseUrl)

Loading…
Cancel
Save