Blame view

lib/pages/unit/widget/home_tab_header_widget.dart 3.68 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';
42f15f6c   吴启风   feat:模块选择持久化&模块主题...
8
  import '../../../common/core/module_cache.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 {
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
24
25
    const HomeTabHeaderWidget(
        {super.key, this.courseModuleCode, this.actionTap, this.onBack});
2187c85f   吴启风   feat:课程结构调整
26
27
  
    final String? courseModuleCode;
60e47f7c   liangchengyou   feat:课程选择功能
28
  
60e47f7c   liangchengyou   feat:课程选择功能
29
    final Function(HeaderActionType type)? actionTap;
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
30
    final VoidCallback? onBack;
95edef4f   liangchengyou   feat:更新适配代码
31
32
    @override
    Widget build(BuildContext context) {
454dc387   吴启风   feat:原阶段选择页(首页)增加...
33
34
      return BlocBuilder<UserBloc, UserState>(
        builder: (context, state) {
c948a9ea   liangchengyou   feat:个人信息更改模块功能
35
36
37
          return Container(
              height: 45,
              width: double.infinity,
42f15f6c   吴启风   feat:模块选择持久化&模块主题...
38
              color: ModuleCache.instance.getCurrentThemeColor(),
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: () {
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
45
46
47
                      if (onBack == null) {
                        Navigator.pop(context);
                      } else {
457ac447   吴启风   feat:代码优化-空条件调用
48
                        onBack?.call();
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
49
                      }
c948a9ea   liangchengyou   feat:个人信息更改模块功能
50
51
                    },
                    child: Container(
454dc387   吴启风   feat:原阶段选择页(首页)增加...
52
53
54
55
56
                      alignment: Alignment.center,
                      child: Image.asset(
                        'back_around'.assetPng,
                        height: 40.h,
                        width: 40.w,
c948a9ea   liangchengyou   feat:个人信息更改模块功能
57
58
59
                      ),
                    ),
                  ),
c948a9ea   liangchengyou   feat:个人信息更改模块功能
60
                  20.horizontalSpace,
68dd7ba8   liangchengyou   feat:首页主题颜色+已知问题修改
61
                  Expanded(
c948a9ea   liangchengyou   feat:个人信息更改模块功能
62
                      child: Text(
42f15f6c   吴启风   feat:模块选择持久化&模块主题...
63
                        ModuleCache.instance.getCurrentThemeName(),
454dc387   吴启风   feat:原阶段选择页(首页)增加...
64
65
66
                    textAlign: TextAlign.left,
                    style: const TextStyle(color: Colors.white, fontSize: 30.0),
                  )),
0596f520   吴启风   feat:课程首页按钮尺寸调整
67
68
                  GestureDetector(
                      onTap: () {
c948a9ea   liangchengyou   feat:个人信息更改模块功能
69
70
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.phase);
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
71
                        }
c948a9ea   liangchengyou   feat:个人信息更改模块功能
72
                      },
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
73
74
75
76
77
                      child: Image(
                          image: AssetImage('home'.assetPng),
                          width: 36.0.w,
                          height: 36.0.h,
                          fit: BoxFit.contain)),
0596f520   吴启风   feat:课程首页按钮尺寸调整
78
79
                  8.horizontalSpace,
                  GestureDetector(
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
80
81
82
83
84
85
86
87
88
89
                      onTap: () {
                        if (actionTap != null) {
                          actionTap!(HeaderActionType.listen);
                        }
                      },
                      child: Image(
                          image: AssetImage('listen'.assetPng),
                          width: 36.0.w,
                          height: 36.0.h,
                          fit: BoxFit.contain)),
0596f520   吴启风   feat:课程首页按钮尺寸调整
90
                  8.horizontalSpace,
8d1f93b4   吴启风   feat:隐藏组件优化
91
92
                  Offstage(
                    offstage: AppConfigHelper.shouldHidePay(),
0596f520   吴启风   feat:课程首页按钮尺寸调整
93
94
                    child: GestureDetector(
                        onTap: () {
28f20da9   吴启风   feat:针对apple审核对支付...
95
96
                          if (actionTap != null) {
                            actionTap!(HeaderActionType.shop);
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
97
                          }
28f20da9   吴启风   feat:针对apple审核对支付...
98
                        },
e6a08b82   biao   修复兑换之后回到首页不刷新问题;修...
99
100
101
102
103
                        child: Image(
                            image: AssetImage('shop'.assetPng),
                            width: 36.0.w,
                            height: 36.0.h,
                            fit: BoxFit.contain)),
28f20da9   吴启风   feat:针对apple审核对支付...
104
                  ),
c948a9ea   liangchengyou   feat:个人信息更改模块功能
105
106
                  ScreenUtil().bottomBarHeight.horizontalSpace,
                ],
454dc387   吴启风   feat:原阶段选择页(首页)增加...
107
              ));
c948a9ea   liangchengyou   feat:个人信息更改模块功能
108
        },
95edef4f   liangchengyou   feat:更新适配代码
109
110
      );
    }
056970d8   Key   feat: api
111
  }