基础组件库
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.

mine_data.dart 1.8 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import 'dart:convert' as convert;
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data_container.dart';
  5. import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data_widget.dart';
  6. import 'package:zhiying_base_widget/widgets/mine/mine_data/model/mine_data_model.dart';
  7. import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_bloc.dart';
  8. import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart';
  9. import 'package:zhiying_comm/util/base_bloc.dart';
  10. import 'package:zhiying_comm/zhiying_comm.dart';
  11. class MineData extends StatefulWidget {
  12. final Map<String, dynamic> data;
  13. const MineData(this.data, {Key key}) : super(key: key);
  14. @override
  15. _MineDataState createState() => _MineDataState();
  16. }
  17. class _MineDataState extends State<MineData> {
  18. @override
  19. Widget build(BuildContext context) {
  20. UserInfoModel user = Provider.of<UserInfoNotifier>(context).userInfo;
  21. if (user == null) {
  22. String value = '123';
  23. int result = int.tryParse(value);
  24. // 未登录
  25. String d = widget.data['data'];
  26. Map json = convert.jsonDecode(d);
  27. MineDataModel style =
  28. MineDataModel.fromJson(Map<String, dynamic>.from(json));
  29. List<MineProfileDataModel> list = style.gridView.map((item) {
  30. return MineProfileDataModel(name: item.name, value: '¥0');
  31. }).toList();
  32. MineProfileModel profile = MineProfileModel(
  33. username: '',
  34. avatar: '',
  35. inviteCode: '',
  36. userLvName: '',
  37. userLvIcon: '',
  38. total: '',
  39. gridViews: list,
  40. );
  41. return MineDataWidget(profile, widget.data);
  42. }
  43. return BlocProvider<MineHeaderBloc>(
  44. bloc: MineHeaderBloc(),
  45. child: MineDataContainer(widget.data),
  46. );
  47. }
  48. }