|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import 'dart:async';
- import 'dart:convert';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:zhiying_base_widget/utils/contants.dart';
- import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/model/wallet_appbar_model.dart';
- import 'package:zhiying_base_widget/widgets/wallet/wallet_data/model/wallet_header_model.dart';
- import 'package:zhiying_comm/util/base_bloc.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
-
- class WalletPageBloc extends BlocBase {
-
- StreamController<List<Map<String, dynamic>>> _tabController =
- StreamController<List<Map<String, dynamic>>>.broadcast();
-
- Stream<List<Map<String, dynamic>>> get outData => _tabController.stream;
-
- Color backgroundColor = Colors.transparent;
-
- @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();
- for (var item in list) {
- if (item['mod_name'] == "my_wallet_appbar") {
- WalletAppbarModel walletAppbarModel =
- WalletAppbarModel.fromJson(json.decode(item["data"]));
- backgroundColor = HexColor.fromHex(walletAppbarModel.appBarBgColor);
- break;
- }
- }
- _tabController.add(list);
- }
- }
|