Pequenas adições em teacher dashboard
This commit is contained in:
@@ -56,11 +56,30 @@ class TeacherClassesListWidget extends StatelessWidget {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'As Minhas Disciplinas',
|
||||
style: Theme.of(context).textTheme.titleLarge?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.bold,
|
||||
InkWell(
|
||||
onTap: () => _showClassesList(context, classes),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'As Minhas Disciplinas',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.expand_more,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
size: 22,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
@@ -94,6 +113,119 @@ class TeacherClassesListWidget extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _showClassesList(
|
||||
BuildContext context,
|
||||
List<QueryDocumentSnapshot> classes,
|
||||
) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (context) => DraggableScrollableSheet(
|
||||
initialChildSize: 0.6,
|
||||
minChildSize: 0.3,
|
||||
maxChildSize: 0.9,
|
||||
expand: false,
|
||||
builder: (context, scrollController) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Text(
|
||||
'As Minhas Disciplinas',
|
||||
style: TextStyle(
|
||||
color: cs.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
itemCount: classes.length,
|
||||
itemBuilder: (context, index) {
|
||||
final data = classes[index].data() as Map<String, dynamic>;
|
||||
final classId = classes[index].id;
|
||||
final className = data['name'] as String? ?? 'Sem nome';
|
||||
final classCode = data['code'] as String? ?? '----';
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(color: cs.outline.withOpacity(0.2)),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: cs.primary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.school,
|
||||
color: cs.primary,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
className,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: cs.onSurface,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
'Código: $classCode',
|
||||
style: TextStyle(
|
||||
color: cs.onSurfaceVariant,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: cs.primary,
|
||||
size: 16,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => ClassStudentsPage(
|
||||
classId: classId,
|
||||
className: className,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildClassCard(DocumentSnapshot doc, BuildContext context) {
|
||||
final data = doc.data() as Map<String, dynamic>;
|
||||
final classId = doc.id;
|
||||
|
||||
@@ -22,8 +22,8 @@ class _TeacherQuickActionsWidgetState extends State<TeacherQuickActionsWidget> {
|
||||
|
||||
/// Mesmas dimensões dos cards em "As Minhas Disciplinas".
|
||||
static const double _scrollCardWidth = 200;
|
||||
static const double _scrollRowHeight = 150;
|
||||
static const double _cardMinHeight = 150;
|
||||
static const double _scrollRowHeight = 156;
|
||||
static const double _cardMinHeight = 156;
|
||||
static const EdgeInsets _cardPadding = EdgeInsets.all(16);
|
||||
static const double _titleFontSize = 16;
|
||||
static const double _subtitleFontSize = 13;
|
||||
@@ -42,12 +42,30 @@ class _TeacherQuickActionsWidgetState extends State<TeacherQuickActionsWidget> {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Ações Rápidas',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
InkWell(
|
||||
onTap: () => _showQuickActionsList(context),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Ações Rápidas',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Icon(
|
||||
Icons.expand_more,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant,
|
||||
size: 22,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
@@ -167,6 +185,147 @@ class _TeacherQuickActionsWidgetState extends State<TeacherQuickActionsWidget> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showQuickActionsList(BuildContext context) {
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
final items = [
|
||||
_TeacherActionItem(
|
||||
title: 'Upload Conteúdo',
|
||||
subtitle: 'PDFs, textos, imagens',
|
||||
icon: Icons.upload_file,
|
||||
useGradient: true,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const TeacherMaterialsPage()),
|
||||
);
|
||||
},
|
||||
),
|
||||
_TeacherActionItem(
|
||||
title: 'Criar Disciplina',
|
||||
subtitle: 'Gerar código de acesso',
|
||||
icon: Icons.school,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
_showCreateClassDialog(context);
|
||||
},
|
||||
),
|
||||
_TeacherActionItem(
|
||||
title: 'Criar Quiz',
|
||||
subtitle: 'Avaliações interativas',
|
||||
icon: Icons.quiz,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
context.go('/teacher/quiz/create');
|
||||
},
|
||||
),
|
||||
_TeacherActionItem(
|
||||
title: 'Analytics',
|
||||
subtitle: 'Desempenho da disciplina',
|
||||
icon: Icons.analytics,
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
context.go('/teacher/analytics');
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
showModalBottomSheet(
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||||
),
|
||||
builder: (context) => DraggableScrollableSheet(
|
||||
initialChildSize: 0.6,
|
||||
minChildSize: 0.3,
|
||||
maxChildSize: 0.9,
|
||||
expand: false,
|
||||
builder: (context, scrollController) {
|
||||
return Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 8),
|
||||
width: 40,
|
||||
height: 4,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Text(
|
||||
'Ações Rápidas',
|
||||
style: TextStyle(
|
||||
color: cs.onSurface,
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
controller: scrollController,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
itemCount: items.length,
|
||||
itemBuilder: (context, index) {
|
||||
final item = items[index];
|
||||
return Card(
|
||||
margin: const EdgeInsets.only(bottom: 12),
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
side: BorderSide(color: cs.outline.withOpacity(0.2)),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: item.useGradient
|
||||
? cs.primary.withOpacity(0.1)
|
||||
: cs.secondary.withOpacity(0.1),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Icon(
|
||||
item.icon,
|
||||
color: item.useGradient ? cs.primary : cs.secondary,
|
||||
size: 24,
|
||||
),
|
||||
),
|
||||
title: Text(
|
||||
item.title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: cs.onSurface,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
item.subtitle,
|
||||
style: TextStyle(
|
||||
color: cs.onSurfaceVariant,
|
||||
fontSize: 13,
|
||||
),
|
||||
),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
color: cs.primary,
|
||||
size: 16,
|
||||
),
|
||||
onTap: item.onTap,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _showCreateClassDialog(BuildContext context) {
|
||||
final TextEditingController nameController = TextEditingController();
|
||||
String? selectedSchoolClassId;
|
||||
@@ -442,3 +601,19 @@ class _TeacherQuickActionsWidgetState extends State<TeacherQuickActionsWidget> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _TeacherActionItem {
|
||||
final String title;
|
||||
final String subtitle;
|
||||
final IconData icon;
|
||||
final bool useGradient;
|
||||
final VoidCallback onTap;
|
||||
|
||||
_TeacherActionItem({
|
||||
required this.title,
|
||||
required this.subtitle,
|
||||
required this.icon,
|
||||
this.useGradient = false,
|
||||
required this.onTap,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user