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 data; const MineHeader(this.data, {Key key}) : super(key: key); @override _MineHeaderState createState() => _MineHeaderState(); } class _MineHeaderState extends State { UserInfoModel user; @override void didChangeDependencies() { user = Provider.of(context).userInfo; super.didChangeDependencies(); } @override Widget build(BuildContext context) { if (user == null || user.token == null || user.token == '') { // 未登录 return MineStaticContainer(widget.data); } return BlocProvider( bloc: MineHeaderBloc(), child: MineHeaderContainer(widget.data), ); } }