feat:重构模块
This commit is contained in:
@@ -59,8 +59,8 @@ class _MomentPageState extends State<MomentPage> {
|
||||
}
|
||||
|
||||
void _onScroll() {
|
||||
// 当滚动距离超过300时显示返回顶部按钮
|
||||
if (_scrollController.offset > 300) {
|
||||
// 当滚动距离超过时显示返回顶部按钮
|
||||
if (_scrollController.offset > 100) {
|
||||
if (!_showScrollToTop) {
|
||||
setState(() {
|
||||
_showScrollToTop = true;
|
||||
@@ -99,26 +99,38 @@ class _MomentPageState extends State<MomentPage> {
|
||||
}
|
||||
|
||||
// 有数据时显示列表
|
||||
return Stack(
|
||||
children: [
|
||||
buildEasyRefresh(
|
||||
freshController: _freshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoad: _onLoad,
|
||||
body: Stack(
|
||||
children: [
|
||||
if (provider.isLoading)
|
||||
buildLoadingIndicator()
|
||||
else
|
||||
_buildMomentList(provider),
|
||||
],
|
||||
),
|
||||
),
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
title: Text('朋友圈', style: Theme.of(context).textTheme.titleLarge),
|
||||
centerTitle: true,
|
||||
automaticallyImplyLeading: false,
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsetsGeometry.all(10),
|
||||
child: Stack(
|
||||
children: [
|
||||
buildEasyRefresh(
|
||||
freshController: _freshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoad: _onLoad,
|
||||
body: Stack(
|
||||
children: [
|
||||
if (provider.isLoading)
|
||||
buildLoadingIndicator()
|
||||
else
|
||||
_buildMomentList(provider),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// 返回顶部按钮
|
||||
if (_showScrollToTop)
|
||||
buildScrollToTop(context: context, scrollToTop: _scrollToTop),
|
||||
],
|
||||
// 返回顶部按钮
|
||||
if (_showScrollToTop)
|
||||
buildScrollToTop(context: context, scrollToTop: _scrollToTop),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user