60e47f7c
liangchengyou
feat:课程选择功能
|
1
2
|
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
3
|
import 'package:wow_english/common/extension/string_extension.dart';
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
4
|
import 'package:wow_english/common/utils/color_parser.dart';
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
5
|
import 'package:wow_english/common/widgets/ow_image_widget.dart';
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
6
|
import 'package:wow_english/models/course_module_entity.dart';
|
60e47f7c
liangchengyou
feat:课程选择功能
|
7
|
|
e620143b
吴启风
feat:单元&课程解锁状态蒙层ui
|
8
|
///阶段(模块)item布局
|
2187c85f
吴启风
feat:课程结构调整
|
9
|
class ModuleItemWidget extends StatelessWidget {
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
10
11
12
|
const ModuleItemWidget(
{super.key, required this.isSelected, this.model, this.onClickEvent});
|
60e47f7c
liangchengyou
feat:课程选择功能
|
13
14
|
///是否被选中
final bool isSelected;
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
15
16
|
final CourseModuleEntity? model;
final Function()? onClickEvent;
|
60e47f7c
liangchengyou
feat:课程选择功能
|
17
18
19
|
@override
Widget build(BuildContext context) {
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
20
21
22
23
24
25
26
|
return GestureDetector(
onTap: () {
if (!isSelected) {
return;
}
onClickEvent?.call();
},
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
27
|
child: isSelected ? _selectWidget() : _unSelectWidget(),
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
28
|
);
|
60e47f7c
liangchengyou
feat:课程选择功能
|
29
30
31
32
|
}
Widget _unSelectWidget() {
return Container(
|
49787541
liangchengyou
feat:添加ios快速打包脚本
|
33
|
padding: const EdgeInsets.all(20),
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
34
|
decoration: BoxDecoration(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
35
|
image: DecorationImage(image: AssetImage('gendubeij'.assetPng))),
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
36
|
child: OwImageWidget(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
37
|
name: model?.picUrl ?? '',
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
38
|
),
|
60e47f7c
liangchengyou
feat:课程选择功能
|
39
40
41
42
43
44
45
|
);
}
Widget _selectWidget() {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
46
47
48
49
50
|
image: DecorationImage(
image: AssetImage(
'gendubeij'.assetPng,
),
fit: BoxFit.fill),
|
60e47f7c
liangchengyou
feat:课程选择功能
|
51
|
),
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
52
|
child: Column(
|
60e47f7c
liangchengyou
feat:课程选择功能
|
53
54
55
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
56
|
child: OwImageWidget(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
57
|
name: model?.picUrl ?? '',
|
60e47f7c
liangchengyou
feat:课程选择功能
|
58
59
60
61
|
),
),
10.verticalSpace,
Container(
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
62
|
decoration: BoxDecoration(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
63
64
65
|
color: parseColor(model.getSafeThemeColor()),
borderRadius: BorderRadius.circular(6.r),
border: Border.all(color: const Color(0xFF333333), width: 1.0)),
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
66
67
|
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Column(
|
60e47f7c
liangchengyou
feat:课程选择功能
|
68
|
children: [
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
69
|
Text(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
70
71
|
model?.getSafeName() ?? '',
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
6f617434
liangchengyou
feat:磨耳朵/视频跟读列表页接口调整
|
72
|
),
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
73
|
Text(
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
74
|
model?.des ?? '',
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
75
|
maxLines: 1,
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
76
|
style: TextStyle(color: Colors.white, fontSize: 12.sp),
|
8988aa69
liangchengyou
feat:首页+课程列表数据获取
|
77
|
)
|
60e47f7c
liangchengyou
feat:课程选择功能
|
78
79
80
81
82
83
84
|
],
),
)
],
),
);
}
|
42f15f6c
吴启风
feat:模块选择持久化&模块主题...
|
85
|
}
|