import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/widget/activity_card.dart'; class ActivitiesPage extends StatefulWidget { ActivitiesPage({Key key}) : super(key: key); @override _ActivitiesPageState createState() => _ActivitiesPageState(); } class _ActivitiesPageState extends State { List images = []; List> _listView = []; List> _listVote = []; List> _listEnter = []; RefreshController _refreshController = RefreshController(initialRefresh: false); @override void initState() { super.initState(); _listView = _listVote; } void _onRefresh() async { await Future.delayed(Duration(milliseconds: 1500)); _refreshController.refreshCompleted(); } void _onLoading() async { await Future.delayed(Duration(milliseconds: 1500)); if (mounted) setState(() {}); _refreshController.loadComplete(); } void detailsRouter(String imagePath, title, bool isOver, isVote, isVoteOver, List memberList) { Get.to(ActivitiesPage()); } @override void dispose() { super.dispose(); _refreshController.dispose(); } @override Widget build(BuildContext context) { return BeeScaffold( title: '社区活动', body: RefreshConfiguration( hideFooterWhenNotFull: true, child: SmartRefresher( controller: _refreshController, header: WaterDropHeader(), footer: ClassicFooter(), onRefresh: _onRefresh, onLoading: _onLoading, enablePullUp: true, child: CustomScrollView( slivers: [ SliverList( delegate: SliverChildBuilderDelegate( (BuildContext context, int index) => ActivityCard( imagePath: _listView[index]['imagePath'], title: _listView[index]['title'], subtitleFirst: _listView[index]['subtitleFirst'], subtitleSecond: _listView[index]['subtitleSecond'], memberList: images, isOver: _listView[index]['isOver'], isVote: false, isVoteOver: _listView[index]['isVoteOver'], fun: detailsRouter, ), childCount: _listView.length, ), ), ], ), ), ), ); } }