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

53 lines
1.8 KiB

  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 || user.token == null || user.token == '') {
  22. // 未登录
  23. String d = widget.data['data'];
  24. Map json = convert.jsonDecode(d);
  25. MineDataModel style =
  26. MineDataModel.fromJson(Map<String, dynamic>.from(json));
  27. List<MineProfileDataModel> list = style.listStyle.map((item) {
  28. return MineProfileDataModel(name: item.name, value: '¥0');
  29. }).toList();
  30. MineProfileModel profile = MineProfileModel(
  31. username: '',
  32. avatar: '',
  33. inviteCode: '',
  34. userLvName: '',
  35. userLvIcon: '',
  36. total: '',
  37. gridViews: list,
  38. );
  39. return MineDataWidget(profile, widget.data);
  40. }
  41. return BlocProvider<MineHeaderBloc>(
  42. bloc: MineHeaderBloc(),
  43. child: MineDataContainer(widget.data),
  44. );
  45. }
  46. }