56 lines
1.7 KiB
Dart
56 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:csp2/common/data/course.dart';
|
|
class CourseCard extends StatelessWidget {
|
|
final Course course;
|
|
|
|
const CourseCard({super.key, required this.course});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: 150, // 각 항목의 너비
|
|
margin: const EdgeInsets.only(right: 12.0),
|
|
padding: const EdgeInsets.all(8.0), // 내부 패딩 추가
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).cardColor, // 카드 배경색
|
|
borderRadius: BorderRadius.circular(12.0), // 둥근 모서리
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.2), // 그림자 색상
|
|
spreadRadius: 1,
|
|
blurRadius: 4,
|
|
offset: const Offset(0, 2), // 그림자 위치
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.circular(8.0),
|
|
|
|
child: Image.network(
|
|
course.affiliateOrgIcon,
|
|
width: double.infinity, // 가로 사이즈에 비례하여 채우도록 변경
|
|
height: 100,
|
|
fit: BoxFit.contain,
|
|
),
|
|
),
|
|
const SizedBox(height: 8.0),
|
|
Text(
|
|
course.affiliateName,
|
|
style: const TextStyle(fontWeight: FontWeight.bold),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
Text(
|
|
course.affiliateDescription,
|
|
style: const TextStyle(color: Colors.grey),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |