home_tab_header_widget.dart
5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';
import 'package:wow_english/pages/user/bloc/user_bloc.dart';
import '../../../common/core/app_config_helper.dart';
import '../../../models/course_entity.dart';
import '../courese_module_model.dart';
enum HeaderActionType {
//视频跟读
video,
//阶段选择
phase,
//磨耳朵
listen,
//购买
shop,
//个人信息
user,
//返回到(模块选择)首页
home,
}
class HomeTabHeaderWidget extends StatelessWidget {
const HomeTabHeaderWidget({super.key, this.entity, this.actionTap});
final CourseEntity? entity;
final Function(HeaderActionType type)? actionTap;
@override
Widget build(BuildContext context) {
return BlocBuilder<UserBloc, UserState>(
builder: (context, state) {
return Container(
height: 45,
width: double.infinity,
color:
CourseModuleModel(entity?.courseModuleCode ?? 'Phase-1').color,
padding: EdgeInsets.symmetric(horizontal: 9.5.w),
child: Row(
children: [
ScreenUtil().bottomBarHeight.horizontalSpace,
GestureDetector(
onTap: () {
if (actionTap != null) {
actionTap!(HeaderActionType.home);
}
},
child: Container(
alignment: Alignment.center,
child: Image.asset(
'back_around'.assetPng,
height: 40.h,
width: 40.w,
),
),
),
// GestureDetector(
// onTap: () => actionTap?.call(HeaderActionType.user),
// child: Container(
// decoration: BoxDecoration(
// border: Border.all(
// width: 1.0,
// color: const Color(0xFF140C10),
// ),
// borderRadius: BorderRadius.circular(21),
// ),
// child: CircleAvatar(
// radius: 21,
// backgroundImage: ImageUtil.getImageProviderOnDefault(UserUtil.getUser()?.avatarUrl),
// ),
// ),
// ),
// GestureDetector(
// onTap: () {
// if (actionTap != null) {
// actionTap!(HeaderActionType.user);
// }
// },
// 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),
// ),
// child: Text(
// UserUtil.getUser()?.name ?? '未登录',
// style: TextStyle(color: const Color(0xFF333333), fontSize: 16.sp),
// ),
// ),
// ),
20.horizontalSpace,
Expanded(
child: Text(
CourseModuleModel(entity?.courseModuleCode ?? 'Phase-1')
.courseModuleTitle,
textAlign: TextAlign.left,
style: const TextStyle(color: Colors.white, fontSize: 30.0),
)),
// IconButton(
// onPressed: () {
// if (actionTap != null) {
// actionTap!(HeaderActionType.video);
// }
// },
// icon: Image.asset('video'.assetPng)),
IconButton(
onPressed: () {
if (actionTap != null) {
actionTap!(HeaderActionType.phase);
}
},
icon: Image.asset('home'.assetPng)),
IconButton(
onPressed: () {
if (actionTap != null) {
actionTap!(HeaderActionType.listen);
}
},
icon: Image.asset('listen'.assetPng)),
Visibility(
visible: !AppConfigHelper.shouldHidePay(),
child: IconButton(
onPressed: () {
if (actionTap != null) {
actionTap!(HeaderActionType.shop);
}
},
icon: Image.asset('shop'.assetPng)),
),
ScreenUtil().bottomBarHeight.horizontalSpace,
],
));
},
);
}
}