import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_bloc.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_container.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_static_container.dart';
import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart';

class MineHeader extends StatefulWidget {
  final Map<String, dynamic> data;

  const MineHeader(this.data, {Key key}) : super(key: key);

  @override
  _MineHeaderState createState() => _MineHeaderState();
}

class _MineHeaderState extends State<MineHeader> {
  @override
  Widget build(BuildContext context) {
    // if (_isSketelon) {
    //   return MineHeaderSkeleton();
    // }

    UserInfoModel user = Provider.of<UserInfoNotifier>(context).userInfo;
    if (user == null) {
      // 未登录
      return MineStaticContainer(widget.data);
    }
    return BlocProvider<MineHeaderBloc>(
      bloc: MineHeaderBloc(),
      child: MineHeaderContainer(widget.data),
    );
  }
}
