基础组件库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mine_header.dart 1.2 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536
  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. @override
  17. Widget build(BuildContext context) {
  18. // if (_isSketelon) {
  19. // return MineHeaderSkeleton();
  20. // }
  21. UserInfoModel user = Provider.of<UserInfoNotifier>(context).userInfo;
  22. if (user == null || user.token == null || user.token == '') {
  23. // 未登录
  24. return MineStaticContainer(widget.data);
  25. }
  26. return BlocProvider<MineHeaderBloc>(
  27. bloc: MineHeaderBloc(),
  28. child: MineHeaderContainer(widget.data),
  29. );
  30. }
  31. }