Blame view

lib/pages/unit/widget/home_tab_header_widget.dart 3.39 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';
95edef4f   liangchengyou   feat:更新适配代码
4
  import 'package:wow_english/common/extension/string_extension.dart';
c948a9ea   liangchengyou   feat:个人信息更改模块功能
5
  import 'package:wow_english/pages/user/bloc/user_bloc.dart';
95edef4f   liangchengyou   feat:更新适配代码
6
  
28f20da9   吴启风   feat:针对apple审核对支付...
7
  import '../../../common/core/app_config_helper.dart';
2187c85f   吴启风   feat:课程结构调整
8
  import '../../section/courese_module_model.dart';
68dd7ba8   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
    //个人信息
454dc387   吴启风   feat:原阶段选择页(首页)增加...
20
    user,
60e47f7c   liangchengyou   feat:课程选择功能
21
22
  }
  
95edef4f   liangchengyou   feat:更新适配代码
23
  class HomeTabHeaderWidget extends StatelessWidget {
2187c85f   吴启风   feat:课程结构调整
24
25
26
    const HomeTabHeaderWidget({super.key, this.courseModuleCode, this.actionTap});
  
    final String? courseModuleCode;
60e47f7c   liangchengyou   feat:课程选择功能
27
  
60e47f7c   liangchengyou   feat:课程选择功能
28
    final Function(HeaderActionType type)? actionTap;
95edef4f   liangchengyou   feat:更新适配代码
29
30
31
  
    @override
    Widget build(BuildContext context) {
454dc387   吴启风   feat:原阶段选择页(首页)增加...
32
33
      return BlocBuilder<UserBloc, UserState>(
        builder: (context, state) {
c948a9ea   liangchengyou   feat:个人信息更改模块功能
34
35
36
          return Container(
              height: 45,
              width: double.infinity,
454dc387   吴启风   feat:原阶段选择页(首页)增加...
37
              color:
2187c85f   吴启风   feat:课程结构调整
38
                  CourseModuleModel(courseModuleCode ?? 'Phase-1').color,
c948a9ea   liangchengyou   feat:个人信息更改模块功能
39
40
41
42
43
              padding: EdgeInsets.symmetric(horizontal: 9.5.w),
              child: Row(
                children: [
                  ScreenUtil().bottomBarHeight.horizontalSpace,
                  GestureDetector(
c948a9ea   liangchengyou   feat:个人信息更改模块功能
44
                    onTap: () {
2187c85f   吴启风   feat:课程结构调整
45
                      Navigator.pop(context);
c948a9ea   liangchengyou   feat:个人信息更改模块功能
46
47
                    },
                    child: Container(
454dc387   吴启风   feat:原阶段选择页(首页)增加...
48
49
50
51
52
                      alignment: Alignment.center,
                      child: Image.asset(
                        'back_around'.assetPng,
                        height: 40.h,
                        width: 40.w,
c948a9ea   liangchengyou   feat:个人信息更改模块功能
53
54
55
                      ),
                    ),
                  ),
c948a9ea   liangchengyou   feat:个人信息更改模块功能
56
                  20.horizontalSpace,
68dd7ba8   liangchengyou   feat:首页主题颜色+已知问题修改
57
                  Expanded(
c948a9ea   liangchengyou   feat:个人信息更改模块功能
58
                      child: Text(
2187c85f   吴启风   feat:课程结构调整
59
                    CourseModuleModel(courseModuleCode ?? 'Phase-1')
454dc387   吴启风   feat:原阶段选择页(首页)增加...
60
61
62
63
                        .courseModuleTitle,
                    textAlign: TextAlign.left,
                    style: const TextStyle(color: Colors.white, fontSize: 30.0),
                  )),
0596f520   吴启风   feat:课程首页按钮尺寸调整
64
65
                  GestureDetector(
                      onTap: () {
c948a9ea   liangchengyou   feat:个人信息更改模块功能
66
67
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.phase);
0596f520   吴启风   feat:课程首页按钮尺寸调整
68
                        };
c948a9ea   liangchengyou   feat:个人信息更改模块功能
69
                      },
0596f520   吴启风   feat:课程首页按钮尺寸调整
70
71
72
73
74
75
76
77
78
79
80
81
82
83
                      child: Image(image: AssetImage('home'.assetPng),
                          width: 36.0.w, height: 36.0.h, fit: BoxFit.contain)
                  ),
                  8.horizontalSpace,
                  GestureDetector(
                    onTap: () {
                      if (actionTap != null) {
                        actionTap!(HeaderActionType.listen);
                      };
                    },
                    child: Image(image: AssetImage('listen'.assetPng),
                        width: 36.0.w, height: 36.0.h, fit: BoxFit.contain)
                  ),
                  8.horizontalSpace,
8d1f93b4   吴启风   feat:隐藏组件优化
84
85
                  Offstage(
                    offstage: AppConfigHelper.shouldHidePay(),
0596f520   吴启风   feat:课程首页按钮尺寸调整
86
87
                    child: GestureDetector(
                        onTap: () {
28f20da9   吴启风   feat:针对apple审核对支付...
88
89
                          if (actionTap != null) {
                            actionTap!(HeaderActionType.shop);
0596f520   吴启风   feat:课程首页按钮尺寸调整
90
                          };
28f20da9   吴启风   feat:针对apple审核对支付...
91
                        },
0596f520   吴启风   feat:课程首页按钮尺寸调整
92
93
94
                        child: Image(image: AssetImage('shop'.assetPng),
                            width: 36.0.w, height: 36.0.h, fit: BoxFit.contain)
                    ),
28f20da9   吴启风   feat:针对apple审核对支付...
95
                  ),
c948a9ea   liangchengyou   feat:个人信息更改模块功能
96
97
                  ScreenUtil().bottomBarHeight.horizontalSpace,
                ],
454dc387   吴启风   feat:原阶段选择页(首页)增加...
98
              ));
c948a9ea   liangchengyou   feat:个人信息更改模块功能
99
        },
95edef4f   liangchengyou   feat:更新适配代码
100
101
      );
    }
056970d8   Key   feat: api
102
  }