基础组件库
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 

53 rindas
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.gridView.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. }