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_sk.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 data; const MineHeader(this.data, {Key key}) : super(key: key); @override _MineHeaderState createState() => _MineHeaderState(); } class _MineHeaderState extends State { UserInfoModel _user; bool _isSketelon = true; @override Widget build(BuildContext context) { if (_isSketelon) { Provider.of(context).getUserInfoModel().then((user) { setState(() { _user = user; _isSketelon = false; }); }); } if (_isSketelon) { return MineHeaderSkeleton(); } if (_user == null) { // 未登录 return MineStaticContainer(widget.data); } return BlocProvider( bloc: MineHeaderBloc(), child: MineHeaderContainer(widget.data), ); } }