Skip to content

Commit

Permalink
Merge pull request #22 from SAISURYAtalla/broadcast
Browse files Browse the repository at this point in the history
Broadcasts screen frontend
  • Loading branch information
Aditya062003 authored Feb 14, 2024
2 parents d42b9bf + 84d983a commit 195b6ed
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 58 deletions.
157 changes: 108 additions & 49 deletions frontend/lib/constants/dummy_entries.dart
Original file line number Diff line number Diff line change
Expand Up @@ -285,31 +285,6 @@ class DummyStudents {
];
}

// class DummySkills {
// static List<Skill> skills = [
// Skill(id: '1', name: 'Flutter', level: 80),
// Skill(id: '2', name: 'C++', level: 100),
// Skill(id: '3', name: 'javascript', level: 20),
// Skill(id: '4', name: 'Nodejs', level: 30),
// Skill(id: '5', name: 'Reactjs', level: 40),
// Skill(id: '6', name: 'MongoDB', level: 50),
// Skill(id: '7', name: 'Graphic Designing', level: 60),
// Skill(id: '8', name: 'chess', level: 70),
// Skill(id: '9', name: 'cricket', level: 80),
// Skill(id: '10', name: 'VScode', level: 100),
// Skill(id: '11', name: 'Dart', level: 100),
// Skill(id: '12', name: 'Typing', level: 90),
// Skill(id: '13', name: 'Drawing', level: 80),
// Skill(id: '14', name: 'Painting', level: 70),
// Skill(id: '15', name: 'Sketching', level: 60),
// Skill(id: '16', name: 'Programming', level: 50),
// Skill(id: '17', name: 'Python', level: 40),
// Skill(id: '18', name: 'C', level: 30),
// Skill(id: '19', name: 'Speaking', level: 20),
// Skill(id: '20', name: 'Sleeping', level: 10)
// ];
// }

class Dummyachievements {
static List<Achievement> achievements = [
Achievement(
Expand Down Expand Up @@ -547,135 +522,211 @@ class DummyFaculties {
id: '2',
name: 'Prof. Johnson',
email: '[email protected]',
courses: [DummyCourses.courses[1], DummyCourses.courses[6], DummyCourses.courses[11]],
courses: [
DummyCourses.courses[1],
DummyCourses.courses[6],
DummyCourses.courses[11]
],
cabinNumber: 'C-102',
department: 'Mechanical Engineering',
),
Faculty(
id: '3',
name: 'Dr. Brown',
email: '[email protected]',
courses: [DummyCourses.courses[2], DummyCourses.courses[7], DummyCourses.courses[12]],
courses: [
DummyCourses.courses[2],
DummyCourses.courses[7],
DummyCourses.courses[12]
],
cabinNumber: 'C-103',
department: 'Electrical Engineering',
),
Faculty(
id: '4',
name: 'Prof. Davis',
email: '[email protected]',
courses: [DummyCourses.courses[3], DummyCourses.courses[8], DummyCourses.courses[13]],
courses: [
DummyCourses.courses[3],
DummyCourses.courses[8],
DummyCourses.courses[13]
],
cabinNumber: 'C-104',
department: 'Civil Engineering'),
Faculty(
id: '5',
name: 'Dr. Wilson',
email: '[email protected]',
courses: [DummyCourses.courses[4], DummyCourses.courses[9], DummyCourses.courses[14]],
courses: [
DummyCourses.courses[4],
DummyCourses.courses[9],
DummyCourses.courses[14]
],
cabinNumber: 'C-105',
department: 'Chemical Engineering'),
Faculty(
id: '6',
name: 'Prof. Miller',
email: '[email protected]',
courses: [DummyCourses.courses[0], DummyCourses.courses[5], DummyCourses.courses[10]],
courses: [
DummyCourses.courses[0],
DummyCourses.courses[5],
DummyCourses.courses[10]
],
cabinNumber: 'C-106',
department: 'Biotechnology'),
Faculty(
id: '7',
name: 'Dr. Turner',
email: '[email protected]',
courses: [DummyCourses.courses[1], DummyCourses.courses[6], DummyCourses.courses[11]],
courses: [
DummyCourses.courses[1],
DummyCourses.courses[6],
DummyCourses.courses[11]
],
cabinNumber: 'C-107',
department: 'Aerospace Engineering'),
Faculty(
id: '8',
name: 'Prof. Clark',
email: '[email protected]',
courses: [DummyCourses.courses[2], DummyCourses.courses[7], DummyCourses.courses[12]],
courses: [
DummyCourses.courses[2],
DummyCourses.courses[7],
DummyCourses.courses[12]
],
cabinNumber: 'C-108',
department: 'Information Technology'),
Faculty(
id: '9',
name: 'Dr. Harris',
email: '[email protected]',
courses: [DummyCourses.courses[3], DummyCourses.courses[8], DummyCourses.courses[13]],
courses: [
DummyCourses.courses[3],
DummyCourses.courses[8],
DummyCourses.courses[13]
],
cabinNumber: 'C-109',
department: 'Mechatronics'),
Faculty(
id: '10',
name: 'Prof. Turner',
email: '[email protected]',
courses: [DummyCourses.courses[4], DummyCourses.courses[9], DummyCourses.courses[14]],
courses: [
DummyCourses.courses[4],
DummyCourses.courses[9],
DummyCourses.courses[14]
],
cabinNumber: 'C-110',
department: 'Robotics Engineering'),
Faculty(
id: '11',
name: 'Dr. White',
email: '[email protected]',
courses: [DummyCourses.courses[0], DummyCourses.courses[5], DummyCourses.courses[10]],
courses: [
DummyCourses.courses[0],
DummyCourses.courses[5],
DummyCourses.courses[10]
],
cabinNumber: 'D-101',
department: 'Industrial Engineering'),
Faculty(
id: '12',
name: 'Prof. Allen',
email: '[email protected]',
courses: [DummyCourses.courses[1], DummyCourses.courses[6], DummyCourses.courses[11]],
courses: [
DummyCourses.courses[1],
DummyCourses.courses[6],
DummyCourses.courses[11]
],
cabinNumber: 'D-102',
department: 'Computer Engineering'),
Faculty(
id: '13',
name: 'Dr. Young',
email: '[email protected]',
courses: [DummyCourses.courses[2], DummyCourses.courses[7], DummyCourses.courses[12]],
courses: [
DummyCourses.courses[2],
DummyCourses.courses[7],
DummyCourses.courses[12]
],
cabinNumber: 'D-103',
department: 'Software Engineering'),
Faculty(
id: '14',
name: 'Prof. Walker',
email: '[email protected]',
courses: [DummyCourses.courses[3], DummyCourses.courses[8], DummyCourses.courses[13]],
courses: [
DummyCourses.courses[3],
DummyCourses.courses[8],
DummyCourses.courses[13]
],
cabinNumber: 'D-104',
department: 'Environmental Engineering'),
Faculty(
id: '15',
name: 'Dr. Lee',
email: '[email protected]',
courses: [DummyCourses.courses[4], DummyCourses.courses[9], DummyCourses.courses[14]],
courses: [
DummyCourses.courses[4],
DummyCourses.courses[9],
DummyCourses.courses[14]
],
cabinNumber: 'D-105',
department: 'Petrolesum[ Engineer]ing'),
Faculty(
id: '16',
name: 'Prof. Hall',
email: '[email protected]',
courses: [DummyCourses.courses[0], DummyCourses.courses[5], DummyCourses.courses[10]],
courses: [
DummyCourses.courses[0],
DummyCourses.courses[5],
DummyCourses.courses[10]
],
cabinNumber: 'D-106',
department: 'Nuclear Engineering'),
Faculty(
id: '17',
name: 'Dr. Miller',
email: '[email protected]',
courses: [DummyCourses.courses[1], DummyCourses.courses[6], DummyCourses.courses[11]],
courses: [
DummyCourses.courses[1],
DummyCourses.courses[6],
DummyCourses.courses[11]
],
cabinNumber: 'D-107',
department: 'Biomedical Engineering'),
Faculty(
id: '18',
name: 'Prof. Baker',
email: '[email protected]',
courses: [DummyCourses.courses[2], DummyCourses.courses[7], DummyCourses.courses[12]],
courses: [
DummyCourses.courses[2],
DummyCourses.courses[7],
DummyCourses.courses[12]
],
cabinNumber: 'D-108',
department: 'Chemical Engineering'),
Faculty(
id: '19',
name: 'Dr. Turner',
email: '[email protected]',
courses: [DummyCourses.courses[3], DummyCourses.courses[8], DummyCourses.courses[13]],
courses: [
DummyCourses.courses[3],
DummyCourses.courses[8],
DummyCourses.courses[13]
],
cabinNumber: 'D-109',
department: 'Electronics Engineering'),
Faculty(
id: '20',
name: 'Prof. Smith',
email: '[email protected]',
courses: [DummyCourses.courses[4], DummyCourses.courses[9], DummyCourses.courses[14]],
courses: [
DummyCourses.courses[4],
DummyCourses.courses[9],
DummyCourses.courses[14]
],
cabinNumber: 'D-110',
department: 'Computer Science'),
];
Expand Down Expand Up @@ -947,7 +998,11 @@ class DummyRooms {
Room(id: '16', name: 'Outdoor Sports Arena', vacant: true),
Room(id: '17', name: 'Medical Clinic', vacant: false, occupantId: 'S004'),
Room(id: '18', name: 'Music Room', vacant: true),
Room(id: '19', name: 'Student Council Office', vacant: false, occupantId: 'T005'),
Room(
id: '19',
name: 'Student Council Office',
vacant: false,
occupantId: 'T005'),
Room(id: '20', name: 'Virtual Reality Lab', vacant: true),
];
}
Expand Down Expand Up @@ -1124,13 +1179,15 @@ class DummyAchievements {
id: '12',
name: 'Training and Development',
date: DateTime(2022, 4, 22),
description: 'Contributed significantly to employee training and development.',
description:
'Contributed significantly to employee training and development.',
),
Achievement(
id: '13',
name: 'Quality Assurance Recognition',
date: DateTime(2023, 2, 14),
description: 'Acknowledged for ensuring high-quality standards in projects.',
description:
'Acknowledged for ensuring high-quality standards in projects.',
),
Achievement(
id: '14',
Expand Down Expand Up @@ -1166,13 +1223,15 @@ class DummyAchievements {
id: '19',
name: 'Health and Wellness Initiative',
date: DateTime(2023, 9, 10),
description: 'Led initiatives to promote health and wellness in the workplace.',
description:
'Led initiatives to promote health and wellness in the workplace.',
),
Achievement(
id: '20',
name: 'Public Speaking Achievement',
date: DateTime(2022, 1, 30),
description: 'Received acclaim for public speaking skills at a conference.',
description:
'Received acclaim for public speaking skills at a conference.',
),
];
// You can use the dummyEntries list as needed in your application
Expand Down
19 changes: 19 additions & 0 deletions frontend/lib/models/broadcast_schema.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
class Broadcast {
final String title;
final String body;
final DateTime date;

Broadcast({
required this.title,
required this.body,
required this.date,
});

factory Broadcast.fromJson(Map<String, dynamic> json) {
return Broadcast(
title: json['title'],
body: json['body'],
date: DateTime.parse(json['date']), // Update parsing to 'date'
);
}
}
1 change: 0 additions & 1 deletion frontend/lib/provider/achievements_edit_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ class AchievementsEditWidget extends ConsumerWidget {
},
),
TextFormField(
// Add another text field for description
initialValue: achievements[index].description,
onChanged: (value) {
ref
Expand Down
14 changes: 14 additions & 0 deletions frontend/lib/provider/broadcast_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:smart_insti_app/models/broadcast_schema.dart';

final broadcastProvider = FutureProvider<List<Broadcast>>((ref) async {
await Future.delayed(const Duration(seconds: 2)); // Simulating delay
return List.generate(
10,
(index) => Broadcast(
title: 'Broadcast $index',
body: 'This is the body of broadcast $index.',
date: DateTime.now().subtract(Duration(days: index)),
),
);
});
10 changes: 10 additions & 0 deletions frontend/lib/provider/home_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ class UserProvider extends StateNotifier<HomeState> {
secondaryColor: Colors.orangeAccent.shade200,
icon: Icons.search,
),
MenuTile(
title: 'Broadcast',
onTap: () {
// Navigate to the broadcast page
context.push('/user_home/broadcast');
},
icon: Icons.announcement,
primaryColor: Colors.greenAccent.shade100,
secondaryColor: Colors.greenAccent.shade200,
),
];
String query = state.searchController.text;
state = state.copyWith(
Expand Down
1 change: 0 additions & 1 deletion frontend/lib/provider/student_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class StudentState {
return students.firstWhere((student) => student.id == studentId);
} catch (e) {
return Student(
// Default values or a placeholder student object
id: '1',
name: 'John Doe',
email: '[email protected]',
Expand Down
Loading

0 comments on commit 195b6ed

Please sign in to comment.