基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

54 lines
1.6 KiB

  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:zhiying_base_widget/utils/contants.dart';
  6. import 'package:zhiying_base_widget/widgets/wallet/wallet_appbar/model/WalletAppbarModel.dart';
  7. import 'package:zhiying_base_widget/widgets/wallet/wallet_data/model/wallet_header_model.dart';
  8. import 'package:zhiying_comm/util/base_bloc.dart';
  9. import 'package:zhiying_comm/zhiying_comm.dart';
  10. class WalletPageBloc extends BlocBase {
  11. StreamController<List<Map<String, dynamic>>> _tabController =
  12. StreamController<List<Map<String, dynamic>>>();
  13. Stream<List<Map<String, dynamic>>> get outData => _tabController.stream;
  14. Color backgroundColor = Colors.transparent;
  15. @override
  16. void dispose() {
  17. _tabController.close();
  18. _tabController = null;
  19. }
  20. loadData(String skipIdentifier) {
  21. NetUtil.request('/api/v1/mod/${skipIdentifier}', method: NetMethod.GET,
  22. onCache: (data) {
  23. _loadData(data);
  24. }, onSuccess: (data) {
  25. _loadData(data);
  26. });
  27. }
  28. void refresh() {}
  29. ///处理加载的数据
  30. void _loadData(data) {
  31. print(data["mod_lis"]);
  32. var list = List.from(data["mod_list"]).map((v) {
  33. return Map<String, dynamic>.from(v);
  34. }).toList();
  35. for (var item in list) {
  36. if (item['mod_name'] == "my_wallet_appbar") {
  37. WalletAppbarModel walletAppbarModel =
  38. WalletAppbarModel.fromJson(json.decode(item["data"]));
  39. backgroundColor = HexColor.fromHex(walletAppbarModel.appBarBgColor);
  40. break;
  41. }
  42. }
  43. _tabController.add(list);
  44. }
  45. }