import 'dart:async';

import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class BilDetailPageBloc extends BlocBase {
  List<Map<String, dynamic>> _tabs = List();

  StreamController<List<Map<String, dynamic>>> _tabController =
  StreamController<List<Map<String, dynamic>>>();

  Stream<List<Map<String, dynamic>>> get outData => _tabController.stream;



  @override
  void dispose() {
    _tabController.close();
    _tabController = null;
  }

  loadData(String skipIdentifier) {

    NetUtil.request('/api/v1/mod/${skipIdentifier}', method: NetMethod.GET,
        onCache: (data) {
          _loadData(data);
        }, onSuccess: (data) {
          _loadData(data);
        });
  }

  void refresh() {}

  ///处理加载的数据
  void _loadData(data) {
    print(data["mod_lis"]);
    var list = List.from(data["mod_list"]).map((v) {
      return Map<String, dynamic>.from(v);
    }).toList();
    _tabController.add(list);
  }

  void dateChange(DateChangeEvent dateChangeEvent){
      ///日期变更后
      
  }

}

class DateChangeEvent{
  String date;
  DateChangeEvent(this.date);
}