|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import 'dart:convert' as convert;
-
- import 'package:flutter/material.dart';
- import 'package:provider/provider.dart';
- import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data_container.dart';
- import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data_widget.dart';
- import 'package:zhiying_base_widget/widgets/mine/mine_data/model/mine_data_model.dart';
- import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_bloc.dart';
- import 'package:zhiying_base_widget/widgets/mine/mine_header/model/mine_profile_model.dart';
- import 'package:zhiying_comm/util/base_bloc.dart';
- import 'package:zhiying_comm/zhiying_comm.dart';
-
- class MineData extends StatefulWidget {
- final Map<String, dynamic> data;
-
- const MineData(this.data, {Key key}) : super(key: key);
-
- @override
- _MineDataState createState() => _MineDataState();
- }
-
- class _MineDataState extends State<MineData> {
- @override
- Widget build(BuildContext context) {
- UserInfoModel user = Provider.of<UserInfoNotifier>(context).userInfo;
- if (user == null || user.token == null || user.token == '') {
- // 未登录
- String d = widget.data['data'];
- Map json = convert.jsonDecode(d);
- MineDataModel style =
- MineDataModel.fromJson(Map<String, dynamic>.from(json));
-
- List<MineProfileDataModel> list = style.listStyle.map((item) {
- return MineProfileDataModel(name: item.name, value: '¥0');
- }).toList();
- MineProfileModel profile = MineProfileModel(
- username: '',
- avatar: '',
- inviteCode: '',
- userLvName: '',
- userLvIcon: '',
- total: '',
- gridViews: list,
- );
- return MineDataWidget(profile, widget.data);
- }
- return BlocProvider<MineHeaderBloc>(
- bloc: MineHeaderBloc(),
- child: MineDataContainer(widget.data),
- );
- }
- }
|