diff --git a/lib/ui/home/application/all_application.dart b/lib/ui/home/application/all_application.dart index 6c8a151c..cc2ba32f 100644 --- a/lib/ui/home/application/all_application.dart +++ b/lib/ui/home/application/all_application.dart @@ -29,6 +29,7 @@ class _AllApplicationPageState extends State { _buildTile( AO object, { bool editMode = false, + bool online = false, }) { return MaterialButton( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.w)), @@ -38,7 +39,7 @@ class _AllApplicationPageState extends State { : () { if (LoginUtil.isNotLogin) return; if (!LoginUtil.haveRoom(object.title)) return; - if (object.page == null) { + if (object.page == null || !online) { BotToast.showText( text: '正在准备上线中,敬请期待', align: Alignment(0, 0.5)); } else { @@ -164,7 +165,7 @@ class _AllApplicationPageState extends State { ); } - Widget _buildView(List objects) { + Widget _buildView(List objects, bool online) { final appProvider = Provider.of(context); return GridView.builder( gridDelegate: @@ -172,7 +173,7 @@ class _AllApplicationPageState extends State { itemBuilder: (context, index) { return Stack( children: [ - _buildTile(objects[index], editMode: _editMode), + _buildTile(objects[index], editMode: _editMode, online: online), Positioned( right: 0, top: 0, @@ -220,8 +221,8 @@ class _AllApplicationPageState extends State { scrollDirection: Axis.vertical, controller: _pageController, children: [ - _buildView(smartManagerApp), - _buildView(recommendApp), + _buildView(smartManagerApp, true), + _buildView(recommendApp, false), ], ).expand(), ], diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index 3fada76c..28b825da 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -114,6 +114,8 @@ class _MarketPageState extends State _pageCount = baseListModel.total; } + bool _onLoadVisible = true; + @override void initState() { super.initState(); @@ -160,24 +162,28 @@ class _MarketPageState extends State topBouncing: false, scrollController: _sliverListController, controller: _refreshController, - onRefresh: () async { - _refresh(); - }, - onLoad: () async { - _pageNum++; - await loadMarketInfo(); - if (_goodsHomeModelList.length >= _pageCount) { - _refreshController.finishLoad(noMore: false); - } - setState(() {}); - }, + onRefresh: _refresh, + onLoad: !_onLoadVisible + ? null + : () async { + _pageNum++; + await loadMarketInfo(); + print(_goodsHomeModelList.length); + if (_goodsHomeModelList.length >= _pageCount) { + _refreshController.finishLoad(noMore: true); + _onLoadVisible = false; + print(_onLoadVisible); + } + setState(() {}); + }, slivers: _buildBody(context), ), ); } - _refresh() async { + Future _refresh() async { await updateMarketInfo(); + _onLoadVisible = true; //_swiperModels = await CommunityFunc.swiper(); _marketSwiperModels = await CommunityFunc.marketSwiper(); _statistics = await CommunityFunc.getMarketStatistics();