Blame view

lib/pages/home/widgets/home_tab_header_widget.dart 4.1 KB
95edef4f   liangchengyou   feat:更新适配代码
1
  import 'package:flutter/material.dart';
2b55d503   liangchengyou   feat:添加插件
2
  import 'package:flutter_bloc/flutter_bloc.dart';
95edef4f   liangchengyou   feat:更新适配代码
3
  import 'package:flutter_screenutil/flutter_screenutil.dart';
2b55d503   liangchengyou   feat:添加插件
4
  import 'package:wow_english/common/blocs/cachebloc/cache_bloc.dart';
95edef4f   liangchengyou   feat:更新适配代码
5
6
  import 'package:wow_english/common/extension/string_extension.dart';
  
60e47f7c   liangchengyou   feat:课程选择功能
7
8
9
10
11
12
13
14
15
  enum HeaderActionType {
    //视频跟读
    video,
    //阶段选择
    phase,
    //磨耳朵
    listen,
    //购买
    shop,
d35a4e87   liangchengyou   feat:磨耳朵功能UI
16
    //个人信息
056970d8   Key   feat: api
17
    user
60e47f7c   liangchengyou   feat:课程选择功能
18
19
  }
  
95edef4f   liangchengyou   feat:更新适配代码
20
  class HomeTabHeaderWidget extends StatelessWidget {
60e47f7c   liangchengyou   feat:课程选择功能
21
22
23
24
  
    const HomeTabHeaderWidget({super.key,  this.actionTap});
  
    final Function(HeaderActionType type)? actionTap;
95edef4f   liangchengyou   feat:更新适配代码
25
26
27
28
  
    @override
    Widget build(BuildContext context) {
      return Container(
7652f701   liangchengyou   feat:课程购买UI逻辑
29
        height: 45,
95edef4f   liangchengyou   feat:更新适配代码
30
31
32
33
34
        width: double.infinity,
        color: Colors.purple,
        padding: EdgeInsets.symmetric(horizontal: 9.5.w),
        child: Row(
          children: [
4bf67b91   liangchengyou   feat:设置密码
35
            ScreenUtil().bottomBarHeight.horizontalSpace,
d35a4e87   liangchengyou   feat:磨耳朵功能UI
36
37
38
            GestureDetector(
              onTap: () {
                if(actionTap != null) {
056970d8   Key   feat: api
39
                  actionTap!(HeaderActionType.user);
d35a4e87   liangchengyou   feat:磨耳朵功能UI
40
41
42
43
44
45
46
47
48
49
                }
              },
              child: Container(
                decoration: BoxDecoration(
                  border: Border.all(
                    width: 1.0,
                    color: const Color(0xFF140C10),
                  ),
                  borderRadius: BorderRadius.circular(21),
                ),
2b55d503   liangchengyou   feat:添加插件
50
                child: CircleAvatar(
d35a4e87   liangchengyou   feat:磨耳朵功能UI
51
52
                  radius: 21,
                  backgroundImage: NetworkImage(
2b55d503   liangchengyou   feat:添加插件
53
                      context.read<CacheBloc>().userEntity?.avatarUrl??'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2Faa1c2213-820a-4223-8757-5f8cee318a28%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1688713226&t=192b18a613683bcdc5bd76f65c9ff032',
d35a4e87   liangchengyou   feat:磨耳朵功能UI
54
55
                  ),
                ),
95edef4f   liangchengyou   feat:更新适配代码
56
57
              ),
            ),
d35a4e87   liangchengyou   feat:磨耳朵功能UI
58
59
60
            GestureDetector(
              onTap: () {
                if(actionTap != null) {
056970d8   Key   feat: api
61
                  actionTap!(HeaderActionType.user);
d35a4e87   liangchengyou   feat:磨耳朵功能UI
62
63
64
65
66
67
68
69
70
71
72
73
74
75
                }
              },
              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
                  ),
                ),
7652f701   liangchengyou   feat:课程购买UI逻辑
76
                child:  Text(
2b55d503   liangchengyou   feat:添加插件
77
                  context.read<CacheBloc>().userEntity?.name??'',
d35a4e87   liangchengyou   feat:磨耳朵功能UI
78
                  style: TextStyle(
7652f701   liangchengyou   feat:课程购买UI逻辑
79
80
                      color: const Color(0xFF333333),
                      fontSize: 16.sp
d35a4e87   liangchengyou   feat:磨耳朵功能UI
81
82
83
                  ),
                ),
              ),
95edef4f   liangchengyou   feat:更新适配代码
84
85
86
87
88
89
90
91
92
93
94
95
96
            ),
            20.horizontalSpace,
            const Expanded(
                child:Text(
                    'learn wow!yellow',
                    textAlign:TextAlign.left,
                  style: TextStyle(
                    color: Colors.white,
                    fontSize: 30.0
                  ),
                )
            ),
            IconButton(
60e47f7c   liangchengyou   feat:课程选择功能
97
98
99
100
101
                onPressed: (){
                  if(actionTap != null) {
                    actionTap!(HeaderActionType.video);
                  }
                },
95edef4f   liangchengyou   feat:更新适配代码
102
103
104
                icon: Image.asset('video'.assetPng)
            ),
            IconButton(
60e47f7c   liangchengyou   feat:课程选择功能
105
106
107
108
109
                onPressed: (){
                  if(actionTap != null) {
                    actionTap!(HeaderActionType.phase);
                  }
                },
95edef4f   liangchengyou   feat:更新适配代码
110
111
112
                icon: Image.asset('home'.assetPng)
            ),
            IconButton(
60e47f7c   liangchengyou   feat:课程选择功能
113
114
115
116
117
                onPressed: (){
                  if(actionTap != null) {
                    actionTap!(HeaderActionType.listen);
                  }
                },
95edef4f   liangchengyou   feat:更新适配代码
118
119
120
                icon: Image.asset('listen'.assetPng)
            ),
            IconButton(
60e47f7c   liangchengyou   feat:课程选择功能
121
122
123
124
125
                onPressed: (){
                  if(actionTap != null) {
                    actionTap!(HeaderActionType.shop);
                  }
                },
95edef4f   liangchengyou   feat:更新适配代码
126
                icon: Image.asset('shop'.assetPng)
4bf67b91   liangchengyou   feat:设置密码
127
128
            ),
            ScreenUtil().bottomBarHeight.horizontalSpace,
95edef4f   liangchengyou   feat:更新适配代码
129
130
131
132
          ],
        ),
      );
    }
056970d8   Key   feat: api
133
  }