import 'package:flutter/cupertino.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:sk_base_mobile/util/screen_adaper_util.dart'; import 'package:sk_base_mobile/widgets/loading_indicator.dart'; class RefreshHeader extends RefreshIndicator { RefreshHeader({super.key}) : super( height: ScreenAdaper.height(100), refreshStyle: RefreshStyle.Follow); @override State createState() { return RefreshHeaderState(); } } class RefreshHeaderState extends RefreshIndicatorState with SingleTickerProviderStateMixin { @override Future endRefresh() async {} @override Widget buildContent(BuildContext context, RefreshStatus mode) { TextStyle style = TextStyle(fontSize: ScreenAdaper.height(18)); Widget body; if (mode == RefreshStatus.refreshing) { body = const LoadingIndicator(); } else if (mode == RefreshStatus.canRefresh) { body = const LoadingIndicator( animating: false, ); } else if (mode == RefreshStatus.completed) { body = const SizedBox(); } else if (mode == RefreshStatus.failed) { body = Text("没有更多数据了", style: style); } else { body = const LoadingIndicator(); } return SizedBox( height: ScreenAdaper.height(40), child: Center(child: body), ); } }