Blame view

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