source-code/
student-hub
Public
text40 lines1.1 KB
import 'package:flutter/material.dart';
import '../models/student_task.dart';
class TaskCard extends StatelessWidget {
final StudentTask task;
final VoidCallback onDelete;
final VoidCallback onTap;
const TaskCard({
super.key,
required this.task,
required this.onDelete,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
child: ListTile(
title: Text(task.title, style: const TextStyle(fontWeight: FontWeight.bold)),
subtitle: Text("${task.course}\nDeadline: ${task.deadline.toString().substring(0, 16)}"),
isThreeLine: true,
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (task.filePath != null)
const Icon(Icons.picture_as_pdf, color: Colors.red),
IconButton(
icon: const Icon(Icons.delete, color: Colors.grey),
onPressed: onDelete,
),
],
),
onTap: onTap,
),
);
}
}