Преглед изворни кода

1.修复我的订单上拉加载更多不显示暂无数据的问题

tags/0.0.5
“yanghuaxuan” пре 3 година
родитељ
комит
3fba0767d1
3 измењених фајлова са 13 додато и 6 уклоњено
  1. +7
    -1
      lib/pages/orders_page/bloc/order_content_bloc.dart
  2. +3
    -4
      lib/pages/orders_page/order_content_page.dart
  3. +3
    -1
      pubspec.yaml

+ 7
- 1
lib/pages/orders_page/bloc/order_content_bloc.dart Прегледај датотеку

@@ -1,5 +1,6 @@
import 'dart:async';

import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart';
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
@@ -14,7 +15,8 @@ class OrderContentBloc extends BlocBase {
Stream<List<OrderModel>> get outData => _ordersController.stream;
String _state;
OrderFilterModel _filter;

RefreshController refreshController =
RefreshController(initialRefresh: false);
@override
void dispose() {
_ordersController.close();
@@ -60,6 +62,10 @@ class OrderContentBloc extends BlocBase {
} else {
_filter.pageNo = ((int.tryParse(_filter.pageNo) ?? 1) + 1).toString();
}
refreshController.refreshCompleted();
refreshController.resetNoData();
}else{
refreshController.loadNoData();
}

_orders.addAll(list.map((item) {


+ 3
- 4
lib/pages/orders_page/order_content_page.dart Прегледај датотеку

@@ -59,8 +59,7 @@ class OrderContentContainer extends StatefulWidget {

class _OrderContentContainerState extends State<OrderContentContainer> {
OrderContentBloc _bloc;
RefreshController _refreshController =
RefreshController(initialRefresh: false);

StreamSubscription streamSubscription;

@override
@@ -92,7 +91,7 @@ class _OrderContentContainerState extends State<OrderContentContainer> {
if (snapshot.data == null) {
return Container();
}
_refreshController.refreshCompleted();
List<OrderModel> orders = snapshot.data;
if (orders.length == 0) {
return Container(
@@ -105,7 +104,7 @@ class _OrderContentContainerState extends State<OrderContentContainer> {
enablePullDown: true,
enablePullUp: true,
header: WaterDropHeader(),
controller: _refreshController,
controller: _bloc.refreshController,
onLoading: () {
_bloc.loadMore();
},


+ 3
- 1
pubspec.yaml Прегледај датотеку

@@ -44,7 +44,9 @@ dependencies:
url: http://192.168.0.138:3000/FnuoOS_Flutter_Components/permission_handler.git

more_picture_share:
path: ../more_picture_share
git:
url: 'http://192.168.0.138:3000/FnuoOS_ZhiYing/more_picture_share.git'
ref: '0.0.1'

intl: 0.16.1



Loading…
Откажи
Сачувај