Teacher dashboard updates
This commit is contained in:
@@ -325,80 +325,83 @@ class _ContentManagementPageState extends State<ContentManagementPage> {
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 20,
|
||||
top: 52,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: cs.onSurface),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Gerenciamento de Conteúdo',
|
||||
style: TextStyle(
|
||||
color: cs.onSurface,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
Container(
|
||||
decoration: BoxDecoration(color: const Color(0xFF82C9BD)),
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 16,
|
||||
right: 16,
|
||||
bottom: 20,
|
||||
top: 52,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: Colors.white),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'Gerenciamento de Conteúdo',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 24,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: cs.surface.withOpacity(0.8),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: cs.outline.withOpacity(0.2),
|
||||
width: 1,
|
||||
),
|
||||
],
|
||||
),
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Procurar turmas...',
|
||||
hintStyle: TextStyle(color: cs.onSurfaceVariant),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: cs.onSurfaceVariant,
|
||||
),
|
||||
suffixIcon: _searchQuery.isNotEmpty
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: cs.onSurfaceVariant,
|
||||
),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
_filterClasses('');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withOpacity(0.9),
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.3),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
onChanged: _filterClasses,
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Procurar turmas...',
|
||||
hintStyle: TextStyle(color: Colors.grey[600]),
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
suffixIcon: _searchQuery.isNotEmpty
|
||||
? IconButton(
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.grey[600],
|
||||
),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
_filterClasses('');
|
||||
},
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
border: InputBorder.none,
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 12,
|
||||
),
|
||||
),
|
||||
onChanged: _filterClasses,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -570,22 +573,38 @@ class _ContentManagementPageState extends State<ContentManagementPage> {
|
||||
final fileName = material['fileName'] ?? 'Ficheiro sem nome';
|
||||
final url = material['url'] as String?;
|
||||
final createdAt = material['createdAt'] as Timestamp?;
|
||||
final mimeType = material['mimeType'] as String?;
|
||||
|
||||
final extension = path.extension(fileName).toLowerCase();
|
||||
// Determine icon based on MIME type, fallback to extension
|
||||
IconData iconData;
|
||||
Color iconColor;
|
||||
|
||||
if (extension == '.pdf') {
|
||||
iconData = Icons.picture_as_pdf;
|
||||
iconColor = Colors.red;
|
||||
} else if (extension == '.jpg' ||
|
||||
extension == '.jpeg' ||
|
||||
extension == '.png') {
|
||||
iconData = Icons.image;
|
||||
iconColor = Colors.blue;
|
||||
if (mimeType != null) {
|
||||
if (mimeType == 'application/pdf') {
|
||||
iconData = Icons.picture_as_pdf;
|
||||
iconColor = Colors.red;
|
||||
} else if (mimeType.startsWith('image/')) {
|
||||
iconData = Icons.image;
|
||||
iconColor = Colors.blue;
|
||||
} else {
|
||||
iconData = Icons.insert_drive_file;
|
||||
iconColor = const Color(0xFF82C9BD);
|
||||
}
|
||||
} else {
|
||||
iconData = Icons.insert_drive_file;
|
||||
iconColor = const Color(0xFF82C9BD);
|
||||
// Fallback to extension for old files without MIME type
|
||||
final extension = path.extension(fileName).toLowerCase();
|
||||
if (extension == '.pdf') {
|
||||
iconData = Icons.picture_as_pdf;
|
||||
iconColor = Colors.red;
|
||||
} else if (extension == '.jpg' ||
|
||||
extension == '.jpeg' ||
|
||||
extension == '.png') {
|
||||
iconData = Icons.image;
|
||||
iconColor = Colors.blue;
|
||||
} else {
|
||||
iconData = Icons.insert_drive_file;
|
||||
iconColor = const Color(0xFF82C9BD);
|
||||
}
|
||||
}
|
||||
|
||||
String formattedDate = 'Data desconhecida';
|
||||
@@ -633,15 +652,16 @@ class _ContentManagementPageState extends State<ContentManagementPage> {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
fileName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: cs.onSurface,
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Text(
|
||||
fileName,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 15,
|
||||
color: cs.onSurface,
|
||||
),
|
||||
),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Row(
|
||||
|
||||
Reference in New Issue
Block a user