Blame view

lib/pages/lessons/widgets/lesson_item_widget.dart 2.65 KB
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';
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
4
  import 'package:wow_english/common/widgets/ow_image_widget.dart';
8988aa69   liangchengyou   feat:首页+课程列表数据获取
5
  import 'package:wow_english/models/course_module_entity.dart';
e5c9e98f   liangchengyou   feat:首页模块颜色
6
  import 'package:wow_english/utils/color_util.dart';
60e47f7c   liangchengyou   feat:课程选择功能
7
8
  
  class LessonItemWidget extends StatelessWidget {
8988aa69   liangchengyou   feat:首页+课程列表数据获取
9
    const LessonItemWidget({super.key, required this.isSelected, this.model, this.onClickEvent});
60e47f7c   liangchengyou   feat:课程选择功能
10
11
    ///是否被选中
    final bool isSelected;
8988aa69   liangchengyou   feat:首页+课程列表数据获取
12
13
    final CourseModuleEntity? model;
    final Function()? onClickEvent;
60e47f7c   liangchengyou   feat:课程选择功能
14
15
16
  
    @override
    Widget build(BuildContext context) {
8988aa69   liangchengyou   feat:首页+课程列表数据获取
17
18
19
20
21
22
23
24
25
      return GestureDetector(
        onTap: () {
          if (!isSelected) {
            return;
          }
          onClickEvent?.call();
        },
        child: isSelected?_selectWidget():_unSelectWidget(),
      );
60e47f7c   liangchengyou   feat:课程选择功能
26
27
28
29
    }
  
    Widget _unSelectWidget() {
      return Container(
49787541   liangchengyou   feat:添加ios快速打包脚本
30
        padding: const EdgeInsets.all(20),
8988aa69   liangchengyou   feat:首页+课程列表数据获取
31
        decoration: BoxDecoration(
60e47f7c   liangchengyou   feat:课程选择功能
32
            image: DecorationImage(
8988aa69   liangchengyou   feat:首页+课程列表数据获取
33
                image: AssetImage('gendubeij'.assetPng)
60e47f7c   liangchengyou   feat:课程选择功能
34
35
            )
        ),
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
36
37
        child: OwImageWidget(
          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(
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
46
47
48
49
50
51
            image: DecorationImage(
                image: AssetImage(
                    'gendubeij'.assetPng,
                ),
              fit: BoxFit.fill
            ),
60e47f7c   liangchengyou   feat:课程选择功能
52
53
54
55
56
        ),
        child:  Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
57
58
              child: OwImageWidget(
                name: model?.picUrl??'',
60e47f7c   liangchengyou   feat:课程选择功能
59
60
61
62
              ),
            ),
            10.verticalSpace,
            Container(
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
63
              decoration: BoxDecoration(
e5c9e98f   liangchengyou   feat:首页模块颜色
64
                color: HexColor(model?.courseModuleThemeColor??'#FFC0C3E7'),
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
65
66
67
68
69
70
                borderRadius: BorderRadius.circular(6.r),
                border: Border.all(
                  color: const Color(0xFF333333),
                  width: 1.0
                )
              ),
8988aa69   liangchengyou   feat:首页+课程列表数据获取
71
72
              padding: EdgeInsets.symmetric(horizontal: 10.w),
              child: Column(
60e47f7c   liangchengyou   feat:课程选择功能
73
                children: [
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
74
75
76
77
78
79
80
                  Text(
                    model?.name??'',
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 12.sp
                    ),
                  ),
8988aa69   liangchengyou   feat:首页+课程列表数据获取
81
82
83
                  Text(
                    model?.des??'',
                    maxLines: 1,
6f617434   liangchengyou   feat:磨耳朵/视频跟读列表页接口调整
84
85
86
87
                    style: TextStyle(
                        color: Colors.white,
                        fontSize: 12.sp
                    ),
8988aa69   liangchengyou   feat:首页+课程列表数据获取
88
                  )
60e47f7c   liangchengyou   feat:课程选择功能
89
90
91
92
93
94
95
96
                ],
              ),
            )
          ],
        ),
      );
    }
  }