基础组件库
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

40 行
1.2 KiB

  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:provider/provider.dart';
  4. import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_bloc.dart';
  5. import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_container.dart';
  6. import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header_static_container.dart';
  7. import 'package:zhiying_comm/util/base_bloc.dart';
  8. import 'package:zhiying_comm/zhiying_comm.dart';
  9. class MineHeader extends StatefulWidget {
  10. final Map<String, dynamic> data;
  11. const MineHeader(this.data, {Key key}) : super(key: key);
  12. @override
  13. _MineHeaderState createState() => _MineHeaderState();
  14. }
  15. class _MineHeaderState extends State<MineHeader> {
  16. UserInfoModel user;
  17. @override
  18. void didChangeDependencies() {
  19. user = Provider.of<UserInfoNotifier>(context).userInfo;
  20. super.didChangeDependencies();
  21. }
  22. @override
  23. Widget build(BuildContext context) {
  24. if (user == null || user.token == null || user.token == '') {
  25. // 未登录
  26. return MineStaticContainer(widget.data);
  27. }
  28. return BlocProvider<MineHeaderBloc>(
  29. bloc: MineHeaderBloc(),
  30. child: MineHeaderContainer(widget.data),
  31. );
  32. }
  33. }