Blame view

lib/pages/home/widgets/home_tab_header_widget.dart 4.25 KB
95edef4f   liangchengyou   feat:更新适配代码
1
  import 'package:flutter/material.dart';
c948a9ea   liangchengyou   feat:个人信息更改模块功能
2
  import 'package:flutter_bloc/flutter_bloc.dart';
95edef4f   liangchengyou   feat:更新适配代码
3
  import 'package:flutter_screenutil/flutter_screenutil.dart';
aa4e28be   Key   removed: cache_bl...
4
  import 'package:wow_english/common/core/user_util.dart';
95edef4f   liangchengyou   feat:更新适配代码
5
  import 'package:wow_english/common/extension/string_extension.dart';
c948a9ea   liangchengyou   feat:个人信息更改模块功能
6
  import 'package:wow_english/pages/user/bloc/user_bloc.dart';
e5c9e98f   liangchengyou   feat:首页模块颜色
7
  import 'package:wow_english/utils/color_util.dart';
aa4e28be   Key   removed: cache_bl...
8
  import 'package:wow_english/utils/image_util.dart';
95edef4f   liangchengyou   feat:更新适配代码
9
  
60e47f7c   liangchengyou   feat:课程选择功能
10
11
12
13
14
15
16
17
18
  enum HeaderActionType {
    //视频跟读
    video,
    //阶段选择
    phase,
    //磨耳朵
    listen,
    //购买
    shop,
d35a4e87   liangchengyou   feat:磨耳朵功能UI
19
    //个人信息
056970d8   Key   feat: api
20
    user
60e47f7c   liangchengyou   feat:课程选择功能
21
22
  }
  
95edef4f   liangchengyou   feat:更新适配代码
23
  class HomeTabHeaderWidget extends StatelessWidget {
e5c9e98f   liangchengyou   feat:首页模块颜色
24
    const HomeTabHeaderWidget({super.key, this.actionTap, this.themColor});
60e47f7c   liangchengyou   feat:课程选择功能
25
  
e5c9e98f   liangchengyou   feat:首页模块颜色
26
    final String? themColor;
60e47f7c   liangchengyou   feat:课程选择功能
27
    final Function(HeaderActionType type)? actionTap;
95edef4f   liangchengyou   feat:更新适配代码
28
29
30
  
    @override
    Widget build(BuildContext context) {
c948a9ea   liangchengyou   feat:个人信息更改模块功能
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
      return BlocBuilder<UserBloc,UserState>(
        builder: (context,state) {
          return Container(
              height: 45,
              width: double.infinity,
              color: HexColor(themColor??''),
              padding: EdgeInsets.symmetric(horizontal: 9.5.w),
              child: Row(
                children: [
                  ScreenUtil().bottomBarHeight.horizontalSpace,
                  GestureDetector(
                    onTap: () => actionTap?.call(HeaderActionType.user),
                    child: Container(
                      decoration: BoxDecoration(
                        border: Border.all(
                          width: 1.0,
                          color: const Color(0xFF140C10),
                        ),
                        borderRadius: BorderRadius.circular(21),
                      ),
                      child: CircleAvatar(
                        radius: 21,
                        backgroundImage: ImageUtil.getImageProviderOnDefault(UserUtil.getUser()?.avatarUrl),
                      ),
                    ),
d35a4e87   liangchengyou   feat:磨耳朵功能UI
56
                  ),
c948a9ea   liangchengyou   feat:个人信息更改模块功能
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
                  GestureDetector(
                    onTap: () {
                      if (actionTap != null) {
                        actionTap!(HeaderActionType.user);
                      }
                    },
                    child: Container(
                      margin: const EdgeInsets.only(left: 7),
                      padding: const EdgeInsets.all(4.0),
                      decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.circular(2),
                        border: Border.all(width: 1.0, color: const Color(0xFF140C10), style: BorderStyle.solid),
                      ),
                      child: Text(
                        UserUtil.getUser()?.name ?? '未登录',
                        style: TextStyle(color: const Color(0xFF333333), fontSize: 16.sp),
                      ),
                    ),
                  ),
                  20.horizontalSpace,
                  const Expanded(
                      child: Text(
                        'learn wow',
                        textAlign: TextAlign.left,
                        style: TextStyle(color: Colors.white, fontSize: 30.0),
                      )),
                  IconButton(
                      onPressed: () {
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.video);
                        }
                      },
                      icon: Image.asset('video'.assetPng)),
                  IconButton(
                      onPressed: () {
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.phase);
                        }
                      },
                      icon: Image.asset('home'.assetPng)),
                  IconButton(
                      onPressed: () {
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.listen);
                        }
                      },
                      icon: Image.asset('listen'.assetPng)),
                  // IconButton(
                  //     onPressed: (){
                  //       if(actionTap != null) {
                  //         actionTap!(HeaderActionType.shop);
                  //       }
                  //     },
                  //     icon: Image.asset('shop'.assetPng)
                  // ),
                  ScreenUtil().bottomBarHeight.horizontalSpace,
                ],
              )
          );
        },
95edef4f   liangchengyou   feat:更新适配代码
118
119
      );
    }
056970d8   Key   feat: api
120
  }