Ver a proveniência

1.热榜 - 添加加载时的loading显示

tags/0.0.2+7^2
杨华轩 há 4 anos
ascendente
cometimento
b53a6d155a
2 ficheiros alterados com 12 adições e 5 eliminações
  1. +7
    -5
      lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart
  2. +5
    -0
      lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart

+ 7
- 5
lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_bloc.dart Ver ficheiro

@@ -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;


+ 5
- 0
lib/widgets/hot_ranking/hot_ranking_list/hot_ranking_list.dart Ver ficheiro

@@ -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<HotRankingList>
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,


Carregando…
Cancelar
Guardar