diff --git a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart index fbebe46..709b423 100644 --- a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart +++ b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart @@ -4,6 +4,7 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:zhiying_base_widget/dialog/loading/loading.dart'; import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart'; import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_list/model/hot_ranking_list_data_model.dart'; import 'package:zhiying_comm/util/base_bloc.dart'; @@ -29,7 +30,7 @@ class HotRankingListBloc extends BlocBase { _dataController = null; } - void loadData(String typeId, int page,Function complete) { + void loadData(String typeId, int page, Function complete) { if (isLoading) { complete(); return; @@ -39,17 +40,18 @@ class HotRankingListBloc extends BlocBase { NetUtil.request( '/api/v1/rec/taobao?type_id=' + typeId + '&page=' + page.toString(), method: NetMethod.GET, onSuccess: (data) { - - complete(); + complete(); isLoading = false; _loadData(data); + Loading.dismiss(); }, onError: (e) { - complete(); + Loading.dismiss(); + complete(); isLoading = false; }); } - void loadMoreData(String typeId,Function complete) { + void loadMoreData(String typeId, Function complete) { if (isLoading) { complete(); return; diff --git a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart index f686bfc..3db5fdd 100644 --- a/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart +++ b/lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart @@ -2,6 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:zhiying_base_widget/dialog/loading/loading.dart'; import 'package:zhiying_base_widget/dialog/loading/loading_dialog.dart'; import 'package:zhiying_base_widget/pages/hot_ranking_page/hot_ranking_page_bloc.dart'; import 'package:zhiying_base_widget/widgets/hot_ranking/hot_ranking_goods/hot_ranking_goods.dart'; @@ -46,6 +47,10 @@ class _HotRankingState extends State if (_pageBloc != null) { _pageBloc.event.listen((event) { if (event.containsKey('type') && event['type'] == "loadData") { + if(!isFirstTime){ + Loading.show(context); + } + isFirstTime=false; _bloc.currentPage = 1; _bloc.loadData(event['type_id'], _bloc.currentPage, () {}); _scrollcontroller.animateTo(0,