Aidra Driver 1.3.5+68
Aidra Driver - Your path to green energy
Loading...
Searching...
No Matches
course_card.dart
Go to the documentation of this file.
1import 'package:fluentui_system_icons/fluentui_system_icons.dart';
2import 'package:flutter/material.dart';
3import 'package:flutter_screenutil/flutter_screenutil.dart';
4
5import '../../domain/entities/course_entity.dart';
6
7class CourseCard extends StatelessWidget {
9 final VoidCallback onTap;
10
11 const CourseCard({
12 super.key,
13 required this.course,
14 required this.onTap,
15 });
16
17 @override
18 Widget build(BuildContext context) {
19 Color iconColor = _parseColor(course.iconColor ?? '#4CAF50', context);
20
21 return InkWell(
22 onTap: onTap,
23 borderRadius: BorderRadius.circular(16.r),
24 child: Container(
25 padding: EdgeInsets.all(16.r),
26 decoration: BoxDecoration(
27 borderRadius: BorderRadius.circular(16.r),
28 color: Theme.of(context).colorScheme.surface,
29 ),
31 mainAxisSize: MainAxisSize.min,
32 crossAxisAlignment: CrossAxisAlignment.start,
33 children: [
34 Container(
35 width: 45.r,
36 height: 45.r,
37 decoration: BoxDecoration(
38 color: iconColor.withValues(alpha: 0.11),
39 borderRadius: BorderRadius.circular(16.r),
40 ),
41 child: Icon(
42 FluentIcons.folder_16_regular,
43 color: iconColor,
44 size: 30.sp,
45 ),
46 ),
47 SizedBox(height: 20.r),
48
50 Text(
51 course.title ?? '',
52 maxLines: 2,
53 overflow: TextOverflow.ellipsis,
54 style: Theme.of(context).textTheme.titleSmall?.copyWith(
55 fontWeight: FontWeight.bold,
56 fontSize: 14.sp,
57 ),
58 ),
59 SizedBox(height: 10.r),
60
62 Align(
63 alignment: Alignment.centerRight,
64 child: Text(
65 '${(course.progress! * 100).toInt()}%',
66 style: Theme.of(context)
67 .textTheme
68 .bodySmall
69 ?.copyWith(color: iconColor),
70 ),
71 ),
72 SizedBox(height: 5.r),
73
75 LinearProgressIndicator(
76 value: course.progress,
77 backgroundColor: iconColor.withValues(alpha: 0.11),
78 color: iconColor,
79 valueColor: AlwaysStoppedAnimation<Color>(iconColor),
80 ),
81 SizedBox(height: 15.r),
82
84 Row(
85 children: [
86 Icon(
87 FluentIcons.clock_16_regular,
88 size: 15.sp,
89 color: iconColor,
90 ),
91 SizedBox(width: 5.r),
92 Text(
93 '${course.durationMinutes} min',
94 style: Theme.of(context).textTheme.bodySmall,
95 ),
96 ],
97 ),
98 ],
99 ),
100 ),
101 );
102 }
103
104 Color _parseColor(String hexColor, BuildContext context) {
105 try {
106 hexColor = hexColor.replaceAll('#', '');
107 if (hexColor.length == 6) hexColor = 'FF$hexColor';
108 return Color(int.parse(hexColor, radix: 16));
109 } catch (_) {
110 return Theme.of(context).colorScheme.primary;
111 }
112 }
113}
AuthGuard _()
final VoidCallback onTap
final Widget child
override Widget build(BuildContext context)
Color _parseColor(String hexColor, BuildContext context)
final EdgeInsets padding
final CourseEntity course
const CourseCard({ super.key, required this.course, required this.onTap, })
class Partner String
style Text( '${ 'scheduling.reference'.tr()}:${collection.internalCode}', style:Theme.of(context).textTheme.bodySmall,)
style SizedBox(height:2.h)
style Column(crossAxisAlignment:CrossAxisAlignment.end, children:[Container(padding:EdgeInsets.symmetric(horizontal:8.w, vertical:4.h), decoration:BoxDecoration(color:ColorPalette.tiffanyBlue.withValues(alpha:0.1), borderRadius:BorderRadius.circular(12),), child:Text(collection.type ?? '', style:Theme.of(context).textTheme.bodySmall?.copyWith(color:ColorPalette.tiffanyBlue, fontWeight:FontWeight.bold,),),),],)