* integrate CoursePlansRepo.translateActivity, translateTopic, translateCoursePlan * move translation functions to requisite files * integrate translation endpoint * refactor: reorganize course-related repos, add request and response model classes * remove l2s from translation requests * update translation request and response models, use translation endpoint to get course info, cache courses with L1s in cache key * update topics repo to use translation endpoint * use activity translation endpoint * refactor: incremental loading of individual course info, account for discrepancy between translated IDs and original IDs * incremental loading of course batches * Update lib/pangea/course_plans/courses/course_plan_room_extension.dart Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * cleanup * cleanup * fix: some name changes * formatting --------- Co-authored-by: WilsonLe <leanhminh2907@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: wcjord <32568597+wcjord@users.noreply.github.com>
96 lines
3.1 KiB
Dart
96 lines
3.1 KiB
Dart
// ignore_for_file: depend_on_referenced_packages
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/pangea/common/widgets/url_image_widget.dart';
|
|
import 'package:fluffychat/pangea/course_creation/course_info_chip_widget.dart';
|
|
import 'package:fluffychat/pangea/course_plans/courses/course_plan_model.dart';
|
|
import 'package:fluffychat/pangea/course_plans/map_clipper.dart';
|
|
import 'package:fluffychat/widgets/hover_builder.dart';
|
|
|
|
class CoursePlanTile extends StatelessWidget {
|
|
final String courseId;
|
|
final CoursePlanModel course;
|
|
final VoidCallback onTap;
|
|
|
|
final double? titleFontSize;
|
|
final double? chipFontSize;
|
|
final double? chipIconSize;
|
|
|
|
const CoursePlanTile({
|
|
super.key,
|
|
required this.courseId,
|
|
required this.course,
|
|
required this.onTap,
|
|
this.titleFontSize,
|
|
this.chipFontSize,
|
|
this.chipIconSize,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
return HoverBuilder(
|
|
builder: (context, hovered) {
|
|
return MouseRegion(
|
|
cursor: SystemMouseCursors.click,
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
child: Container(
|
|
decoration: BoxDecoration(
|
|
color:
|
|
hovered ? theme.colorScheme.onSurface.withAlpha(10) : null,
|
|
),
|
|
child: Row(
|
|
spacing: 4.0,
|
|
children: [
|
|
ClipPath(
|
|
clipper: MapClipper(),
|
|
child: ImageByUrl(
|
|
imageUrl: course.imageUrl,
|
|
borderRadius: BorderRadius.circular(0.0),
|
|
width: 40.0,
|
|
replacement: Container(
|
|
width: 40.0,
|
|
height: 40.0,
|
|
decoration: BoxDecoration(
|
|
color: theme.colorScheme.secondary,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Flexible(
|
|
child: Column(
|
|
spacing: 4.0,
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
course.title,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: titleFontSize,
|
|
),
|
|
),
|
|
CourseInfoChips(
|
|
courseId,
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 4.0,
|
|
vertical: 2.0,
|
|
),
|
|
fontSize: chipFontSize,
|
|
iconSize: chipIconSize,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|