Skip to content

Commit

Permalink
Add shadow to the BaseCard
Browse files Browse the repository at this point in the history
  • Loading branch information
GravityDarkLab committed Jan 25, 2024
1 parent 9668ca4 commit 303bb4d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 17 deletions.
22 changes: 12 additions & 10 deletions lib/views/course_view/components/base_card.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:gocast_mobile/utils/theme.dart';

class BaseCard extends StatelessWidget {
final String imageName;

final VoidCallback onTap;

const BaseCard({
Expand All @@ -18,16 +18,17 @@ class BaseCard extends StatelessWidget {
return InkWell(
onTap: onTap,
child: Card(
elevation: 1,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0),
),
elevation: 5,
color: themeData.cardTheme.color,
shadowColor: themeData.shadowColor,
clipBehavior: Clip.antiAlias,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
...buildCardContent(), // Call to the overridable method
],
children: buildCardContent(),
),
),
);
Expand All @@ -45,7 +46,7 @@ class BaseCard extends StatelessWidget {
Widget? trailing,
}) {
return Padding(
padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.all(12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
Expand All @@ -56,16 +57,17 @@ class BaseCard extends StatelessWidget {
children: [
Text(
title,
style: const TextStyle(
fontSize: 16.0,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: appTheme.cardTheme.color,
),
maxLines: 2,
),
const SizedBox(height: 8.0),
Text(
subtitle,
style: const TextStyle(fontSize: 14.0, color: Colors.grey),
style: TextStyle(fontSize: 14.0, color: Colors.grey[600]),
),
],
),
Expand Down Expand Up @@ -104,7 +106,7 @@ class BaseCard extends StatelessWidget {
fit: BoxFit.cover,
errorBuilder: (context, error, stackTrace) {
return Image.asset(
'assets/images/default_image.png',
'assets/images/course1.png',
fit: BoxFit.cover,
);
},
Expand Down
11 changes: 5 additions & 6 deletions lib/views/course_view/components/course_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -359,22 +359,17 @@ class CourseCard extends StatelessWidget {
}

Color _colorPicker() {
//TODO what are all the TUM faculties?
/** Colors:
* Informatik - IN: blue
* Mathe - MA: purple
* Chemie - CH
* Physik - PH
* Maschinenwesen - MW
* nothing/ other: gray
*
* Elektrotechnick - EL
* Management -
* Engineering
* Elektrotechnik - EL
*
*/
if (tumID.length < 2) return Colors.grey;

switch (tumID.substring(0, 2)) {
case 'IN':
return Colors.blue;
Expand All @@ -384,6 +379,10 @@ class CourseCard extends StatelessWidget {
return Colors.green;
case 'PH':
return Colors.orange;
case 'MW':
return Colors.red;
case 'EL':
return Colors.black87;
default:
return Colors.grey;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class PinnedCoursesState extends ConsumerState<PinnedCourses> {
final isPinned =
userPinned.any((pinnedCourse) => pinnedCourse.id == course.id);
return PinnedCourseCard(
imageName: 'assets/images/course2.png',
imageName: 'assets/images/course1.png',
course: course,
onTap: () => _handleCourseTap(course, context),
isPinned: isPinned,
Expand Down

0 comments on commit 303bb4d

Please sign in to comment.