Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User profile with editable fields #17

Merged
merged 38 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
49e8ec8
fetch from latest pr
SAISURYAtalla Jan 31, 2024
d60913f
user profile with admin screens integration
SAISURYAtalla Jan 31, 2024
7189397
schema update
SAISURYAtalla Feb 1, 2024
052ffe9
Merge branch 'userModels' of https://github.com/ArinNigam/Smart-Insti…
SAISURYAtalla Feb 1, 2024
802c08c
dummy entries updated
SAISURYAtalla Feb 1, 2024
b7ca0c9
remove the redudant files and updates the imports
SAISURYAtalla Feb 1, 2024
b7c2e81
added routes.dart
SAISURYAtalla Feb 1, 2024
31d00c7
added the getstudentbyID function
SAISURYAtalla Feb 1, 2024
996e3b2
added separate widgets for editable entities
SAISURYAtalla Feb 3, 2024
7115555
roles commented
SAISURYAtalla Feb 3, 2024
df45c70
edit functionality
SAISURYAtalla Feb 3, 2024
63f5402
pie chart lib added, edit profile, user profile edited
SAISURYAtalla Feb 4, 2024
f9e8bba
ui change
SAISURYAtalla Feb 4, 2024
230730a
display code working
SAISURYAtalla Feb 4, 2024
8d0efb4
edit profile page added
SAISURYAtalla Feb 4, 2024
54b24e6
removed unused import
SAISURYAtalla Feb 4, 2024
301a228
Merge branch 'main' of https://github.com/SAISURYAtalla/Smart-Insti-A…
SAISURYAtalla Feb 4, 2024
0fc1b3b
added scrolling for skills and achievements in case of many entries
SAISURYAtalla Feb 4, 2024
2ca9b97
Merge branch 'main' into userprofile
SAISURYAtalla Feb 4, 2024
34aa8c0
changes aligned with origin
SAISURYAtalla Feb 4, 2024
cb49de1
final changes-name and roles
SAISURYAtalla Feb 4, 2024
e7319b7
removed reduntant code and files
SAISURYAtalla Feb 10, 2024
cd10c5c
Merge branch 'main' into userprofile
SAISURYAtalla Feb 11, 2024
cc4089a
Merge branch 'OpenLake:main' into userprofile
SAISURYAtalla Feb 11, 2024
b92e524
Merge branch 'OpenLake:main' into userprofile
SAISURYAtalla Feb 11, 2024
67fd037
Merge branch 'userprofile' of https://github.com/SAISURYAtalla/Smart-…
SAISURYAtalla Feb 11, 2024
7472a8c
build_apk updated
SAISURYAtalla Feb 13, 2024
cca6fec
routes modified
SAISURYAtalla Feb 13, 2024
ce9a8bf
.env file added
SAISURYAtalla Feb 13, 2024
9e068ed
Merge branch 'main' of https://github.com/SAISURYAtalla/Smart-Insti-A…
SAISURYAtalla Feb 13, 2024
7fbb726
Merge branch 'main' of https://github.com/SAISURYAtalla/Smart-Insti-A…
SAISURYAtalla Feb 14, 2024
33a50da
backend configured
SAISURYAtalla Feb 14, 2024
99d66b9
routes configured
SAISURYAtalla Feb 14, 2024
b7175de
home.dart to user_home.dart
SAISURYAtalla Feb 14, 2024
bc128c8
user_profile.dart to student_profile.dart
SAISURYAtalla Feb 14, 2024
010dba8
providers and edit profile updated
SAISURYAtalla Feb 14, 2024
522dc0d
removed redundant code
SAISURYAtalla Feb 14, 2024
29d86c7
initial location set to '/'
SAISURYAtalla Feb 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions frontend/lib/constants/dummy.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// import '../screens/user_profile.dart';
import '../models/student2.dart';

// class DummyStudents {
// static Student getStudentById(String id) {
// return students.firstWhere(
// (student) => student.id == id,
// orElse: () => Student(
// id: '1',
// name: 'John Doe',
// studentMail: '[email protected]',
// rollNumber: '12345678',
// about: 'Hi, I am a CSE Undergrad of IIT BHOPAL.',
// profilePicURI:
// 'https://cdn4.sharechat.com/img_907710_35cec5f5_1681916904360_sc.jpg?tenant=sc&referrer=pwa-sharechat-service&f=360_sc.jpg',
// graduationYear: '2026',
// branch: 'Computer Science',
// roles: ['Openlake Core Member', 'Class Representative'],
// skills: ['Flutter', 'Dart'],
// achievements: [
// Achievement(
// title: 'Hackathon Winner',
// description: 'First place in XYZ Hackathon',
// ),
// Achievement(
// title: 'Project Showcase',
// description: 'Presented a project at ABC Expo',
// ),
// ],
// ),
// );
// }

// static List<Student> students = [
// // Existing students...
// // Add more students with skills and achievements as needed
// ];
// }
class DummyStudents {
static List<Student> students = [
Student(
id: '1',
name: 'John Doe',
studentMail: '[email protected]',
rollNumber: '12345678',
about: 'Hi , i am a CSE Undergrad of IIT BHOPAL.',
profilePicURI:
'https://cdn4.sharechat.com/img_907710_35cec5f5_1681916904360_sc.jpg?tenant=sc&referrer=pwa-sharechat-service&f=360_sc.jpg',
graduationYear: '2026',
branch: 'Computer Science',
roles: ['Openlake Core Member', 'Class Representative'],
skills: ['Flutter', 'Dart'],
achievements: [
Achievement(
title: 'Hackathon Winner',
description: 'First place in XYZ Hackathon',
),
Achievement(
title: 'Project Showcase',
description: 'Presented a project at ABC Expo',
),
],
),
Student(
id: '2',
name: 'Talla',
studentMail: '[email protected]',
rollNumber: '12345789',
about: 'Hi , i am a CSE Undergrad of IIT BHOjpur.',
profilePicURI:
'https://cdn4.sharechat.com/img_907710_35cec5f5_1681916904360_sc.jpg?tenant=sc&referrer=pwa-sharechat-service&f=360_sc.jpg',
graduationYear: '2025',
branch: 'Computer Science',
roles: ['Openlake Core Member', 'Class Representative'],
skills: ['Flutter', 'Dart'],
achievements: [
Achievement(
title: 'Hackathon Winner',
description: 'First place in XYZ Hackathon',
),
Achievement(
title: 'Project Showcase',
description: 'Presented a project at ABC Expo',
),
],
),
];
}
47 changes: 47 additions & 0 deletions frontend/lib/models/student2.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class Student {
SAISURYAtalla marked this conversation as resolved.
Show resolved Hide resolved
Student({
required this.id,
required this.name,
required this.studentMail,
required this.rollNumber,
this.about,
this.profilePicURI,
this.graduationYear,
required this.branch,
this.roles,
this.skills,
this.achievements,
});

final String id;
final String name;
final String studentMail;
final String rollNumber;
String? about;
final String? profilePicURI;
final String? graduationYear;
final String branch;
final List<String>? roles;
List<String>? skills;
List<Achievement>? achievements;
}

class Skills {
final String text;
final double proficiency;

Skills({
required this.text,
required this.proficiency,
});
}

class Achievement {
final String title;
final String description;

Achievement({
required this.title,
required this.description,
});
}
24 changes: 16 additions & 8 deletions frontend/lib/provider/student_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import 'package:smart_insti_app/constants/dummy_entries.dart';
import '../models/student.dart';
import 'dart:io';

final studentProvider = StateNotifierProvider<StudentProvider, StudentState>((ref) => StudentProvider());
final studentProvider = StateNotifierProvider<StudentProvider, StudentState>(
(ref) => StudentProvider());

class StudentState {
final List<Student> students;
Expand Down Expand Up @@ -43,10 +44,14 @@ class StudentState {
return StudentState(
students: students ?? this.students,
filteredStudents: filteredStudents ?? this.filteredStudents,
studentNameController: studentNameController ?? this.studentNameController,
studentEmailController: studentEmailController ?? this.studentEmailController,
studentRollNoController: studentRollNoController ?? this.studentRollNoController,
searchStudentController: searchStudentController ?? this.searchStudentController,
studentNameController:
studentNameController ?? this.studentNameController,
studentEmailController:
studentEmailController ?? this.studentEmailController,
studentRollNoController:
studentRollNoController ?? this.studentRollNoController,
searchStudentController:
searchStudentController ?? this.searchStudentController,
branch: branch ?? this.branch,
role: role ?? this.role,
);
Expand Down Expand Up @@ -100,8 +105,10 @@ class StudentProvider extends StateNotifier<StudentState> {
String query = state.searchStudentController.text;
_logger.i("Searching for student: $query");
final newState = state.copyWith(
filteredStudents:
state.students.where((student) => student.name.toLowerCase().contains(query.toLowerCase())).toList(),
filteredStudents: state.students
.where((student) =>
student.name.toLowerCase().contains(query.toLowerCase()))
.toList(),
);
state = newState;
}
Expand Down Expand Up @@ -139,7 +146,8 @@ class StudentProvider extends StateNotifier<StudentState> {

void removeStudent(Student student) {
final newStudents = state.students.where((s) => s != student).toList();
final newFilteredStudents = state.filteredStudents.where((s) => s != student).toList();
final newFilteredStudents =
state.filteredStudents.where((s) => s != student).toList();
final newState = state.copyWith(
students: newStudents,
filteredStudents: newFilteredStudents,
Expand Down
136 changes: 103 additions & 33 deletions frontend/lib/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,50 +10,120 @@ import '../screens/admin/add_menu.dart';
import '../screens/admin/view_courses.dart';
import '../screens/admin/view_faculty.dart';
import '../screens/admin/view_menu.dart';
import '../screens/user_profile.dart';
import '../screens/home.dart';

final GoRouter routes = GoRouter(
routes: [
GoRoute(
path: '/',
pageBuilder: (context, state) => const MaterialPage(child: AdminHome()),
pageBuilder: (context, state) => const MaterialPage(child: Home()),
routes: [
GoRoute(
path: 'add_students',
pageBuilder: (context, state) => MaterialPage(child: AddStudents()),
path: 'user_profile',
pageBuilder: (context, state) =>
const MaterialPage(child: UserProfile()),
),
GoRoute(
path: 'add_faculty',
pageBuilder: (context, state) => MaterialPage(child: AddFaculty()),
path: 'admin_home',
pageBuilder: (context, state) =>
const MaterialPage(child: AdminHome()),
routes: [
GoRoute(
path: 'add_students',
pageBuilder: (context, state) =>
MaterialPage(child: AddStudents()),
),
GoRoute(
path: 'add_faculty',
pageBuilder: (context, state) =>
MaterialPage(child: AddFaculty()),
),
GoRoute(
path: 'add_courses',
pageBuilder: (context, state) =>
MaterialPage(child: AddCourses()),
),
GoRoute(
path: 'view_students',
pageBuilder: (context, state) =>
MaterialPage(child: ViewStudents()),
),
GoRoute(
path: 'view_faculty',
pageBuilder: (context, state) =>
MaterialPage(child: ViewFaculty()),
),
GoRoute(
path: 'view_courses',
pageBuilder: (context, state) =>
MaterialPage(child: ViewCourses()),
),
GoRoute(
path: 'add_menu',
pageBuilder: (context, state) =>
MaterialPage(child: AddMessMenu()),
),
GoRoute(
path: 'view_menu',
pageBuilder: (context, state) =>
MaterialPage(child: ViewMessMenu()),
),
GoRoute(
path: 'manage_rooms',
pageBuilder: (context, state) =>
MaterialPage(child: ManageRooms()),
)
],
),
GoRoute(
path: 'add_courses',
pageBuilder: (context, state) => MaterialPage(child: AddCourses()),
),
GoRoute(
path: 'view_students',
pageBuilder: (context, state) => MaterialPage(child: ViewStudents()),
),
GoRoute(
path: 'view_faculty',
pageBuilder: (context, state) => MaterialPage(child: ViewFaculty()),
),
GoRoute(
path: 'view_courses',
pageBuilder: (context, state) => MaterialPage(child: ViewCourses()),
),
GoRoute(
path: 'add_menu',
pageBuilder: (context, state) => MaterialPage(child: AddMessMenu()),
),
GoRoute(
path: 'view_menu',
pageBuilder: (context, state) => MaterialPage(child: ViewMessMenu()),
),
GoRoute(
path: 'manage_rooms',
pageBuilder: (context, state) => MaterialPage(child: ManageRooms()),
)
],
)
],
);

// final GoRouter routes = GoRouter(
henilp105 marked this conversation as resolved.
Show resolved Hide resolved
// routes: [
// GoRoute(
// path: '/',
// pageBuilder: (context, state) => const MaterialPage(child: AdminHome()),
// routes: [
// GoRoute(
// path: 'add_students',
// pageBuilder: (context, state) => MaterialPage(child: AddStudents()),
// ),
// GoRoute(
// path: 'add_faculty',
// pageBuilder: (context, state) => MaterialPage(child: AddFaculty()),
// ),
// GoRoute(
// path: 'add_courses',
// pageBuilder: (context, state) => MaterialPage(child: AddCourses()),
// ),
// GoRoute(
// path: 'view_students',
// pageBuilder: (context, state) => MaterialPage(child: ViewStudents()),
// ),
// GoRoute(
// path: 'view_faculty',
// pageBuilder: (context, state) => MaterialPage(child: ViewFaculty()),
// ),
// GoRoute(
// path: 'view_courses',
// pageBuilder: (context, state) => MaterialPage(child: ViewCourses()),
// ),
// GoRoute(
// path: 'add_menu',
// pageBuilder: (context, state) => MaterialPage(child: AddMessMenu()),
// ),
// GoRoute(
// path: 'view_menu',
// pageBuilder: (context, state) => MaterialPage(child: ViewMessMenu()),
// ),
// GoRoute(
// path: 'manage_rooms',
// pageBuilder: (context, state) => MaterialPage(child: ManageRooms()),
// )
// ],
// )
// ],
// );
26 changes: 26 additions & 0 deletions frontend/lib/routes/student_provide.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import '../models/student2.dart';

final studentProvider = Provider<Student>((ref) => Student(
id: '1',
name: 'John Doe',
studentMail: '[email protected]',
rollNumber: '12345678',
about: 'Hi , i am a CSE Undergrad of IIT BHOPAL.',
profilePicURI:
'https://cdn4.sharechat.com/img_907710_35cec5f5_1681916904360_sc.jpg?tenant=sc&referrer=pwa-sharechat-service&f=360_sc.jpg',
graduationYear: '2026',
branch: 'Computer Science',
roles: ['Openlake Core Member', 'Class Representative'],
skills: ['Flutter', 'Dart'],
achievements: [
Achievement(
title: 'Hackathon Winner',
description: 'First place in XYZ Hackathon',
),
Achievement(
title: 'Project Showcase',
description: 'Presented a project at ABC Expo',
),
],
));
Loading
Loading