import 'package:flutter/material.dart'; import 'package:huixiang/community/community_view/community_dynamic.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/my_footer.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; class CommunityChildPage extends StatefulWidget { @override State createState() { return _CommunityChildPage(); } } class _CommunityChildPage extends State { RefreshController refreshController = RefreshController(); @override void initState() { super.initState(); } _onRefresh() { Future.delayed(Duration(seconds: 1), () { refreshController.refreshCompleted(); refreshController.loadComplete(); }); } queryCommunity() { Future.delayed(Duration(seconds: 1), () { refreshController.refreshCompleted(); refreshController.loadComplete(); }); } @override Widget build(BuildContext context) { return SmartRefresher( controller: refreshController, enablePullDown: true, enablePullUp: true, physics: BouncingScrollPhysics(), header: MyHeader(), footer: CustomFooter( builder: (context, mode) { return MyFooter(mode); }, ), onRefresh: _onRefresh, onLoading: queryCommunity, child: ListView.builder( physics: NeverScrollableScrollPhysics(), itemBuilder: (context, position) { return InkWell( child: CommunityDynamic(), onTap: () { Navigator.of(context).pushNamed('/router/community_details'); }, ); }, itemCount: 13, ), ); } }