Blame view

lib/pages/unit/widget/course_unit_item.dart 2.58 KB
e620143b   吴启风   feat:单元&课程解锁状态蒙层ui
1
  import 'package:flutter/cupertino.dart';
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
2
3
4
5
6
7
8
  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 '../../../models/course_unit_entity.dart';
  
e620143b   吴启风   feat:单元&课程解锁状态蒙层ui
9
  ///课程(单元)item布局
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
10
11
12
13
14
15
16
17
18
19
20
  class CourseUnitItem extends StatelessWidget {
    const CourseUnitItem(
        {super.key, required this.unitEntity, required this.unitLesson});
  
    final CourseUnitEntity unitEntity;
    final CourseUnitDetail unitLesson;
  
    @override
    Widget build(BuildContext context) {
      return Padding(
        padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 24.h),
e620143b   吴启风   feat:单元&课程解锁状态蒙层ui
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
        child: Stack(
          children: [
            _normalItem(),
            _lockWidget(),
          ],
        )
      );
    }
  
    Widget _normalItem() {
      return Container(
        width: 165.w,
        padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 24.h),
        decoration: BoxDecoration(
          image: DecorationImage(
              image: AssetImage('gendubeij'.assetPng), fit: BoxFit.fill),
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Expanded(
                child: Container(
                  decoration: BoxDecoration(
                      border: Border.all(
                        width: 2,
                        color: const Color(0xFF140C10),
                      ),
                      borderRadius: BorderRadius.circular(6)),
                  child: OwImageWidget(
                    name: unitLesson.coverUrl ?? '',
                    fit: BoxFit.fitHeight,
                  ),
                )),
            20.verticalSpace,
            SizedBox(
              height: 40.h,
              child: Text(
                unitLesson.name ?? '',
                maxLines: 2,
                overflow: TextOverflow.ellipsis,
                style:
                TextStyle(fontSize: 11.sp, color: const Color(0xFF140C10)),
              ),
            )
          ],
        ),
      );
    }
  
    ///锁定状态下蒙层视图
    Widget _lockWidget() {
      return Visibility(
        visible: unitLesson.lock ?? false,
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
74
75
        child: Container(
          width: 165.w,
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
76
          decoration: BoxDecoration(
e620143b   吴启风   feat:单元&课程解锁状态蒙层ui
77
78
79
80
81
              image: DecorationImage(
                  image: AssetImage(
                      'gendubeij_mengban'.assetPng
                  ),
                  fit: BoxFit.fill
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
82
              )
e620143b   吴启风   feat:单元&课程解锁状态蒙层ui
83
84
85
86
87
88
          ),
          alignment: Alignment.center,
          child: Image.asset(
            'iv_lock'.assetPng,
            height: 54.h,
            width: 61.5.w,
2a3621f8   吴启风   feat:课程层级调整(增加unit层)
89
90
91
92
93
          ),
        ),
      );
    }
  }