module_item_widget.dart
2.68 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
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';
import 'package:wow_english/common/widgets/ow_image_widget.dart';
import 'package:wow_english/models/course_module_entity.dart';
import '../../section/courese_module_model.dart';
///阶段(模块)item布局
class ModuleItemWidget extends StatelessWidget {
const ModuleItemWidget({super.key, required this.isSelected, this.model, this.onClickEvent});
///是否被选中
final bool isSelected;
final CourseModuleEntity? model;
final Function()? onClickEvent;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
if (!isSelected) {
return;
}
onClickEvent?.call();
},
child: isSelected?_selectWidget():_unSelectWidget(),
);
}
Widget _unSelectWidget() {
return Container(
padding: const EdgeInsets.all(20),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('gendubeij'.assetPng)
)
),
child: OwImageWidget(
name: model?.picUrl??'',
),
);
}
Widget _selectWidget() {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'gendubeij'.assetPng,
),
fit: BoxFit.fill
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
child: OwImageWidget(
name: model?.picUrl??'',
),
),
10.verticalSpace,
Container(
decoration: BoxDecoration(
color: CourseModuleModel(model?.code??'Phase-1').color,
borderRadius: BorderRadius.circular(6.r),
border: Border.all(
color: const Color(0xFF333333),
width: 1.0
)
),
padding: EdgeInsets.symmetric(horizontal: 10.w),
child: Column(
children: [
Text(
model?.name??'',
style: TextStyle(
color: Colors.white,
fontSize: 12.sp
),
),
Text(
model?.des??'',
maxLines: 1,
style: TextStyle(
color: Colors.white,
fontSize: 12.sp
),
)
],
),
)
],
),
);
}
}