Blame view

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