From e7319b7cf9b0cd324bb0a46aac7fbdd382fbba75 Mon Sep 17 00:00:00 2001 From: SAISURYAtalla Date: Sat, 10 Feb 2024 14:53:10 +0530 Subject: [PATCH] removed reduntant code and files --- frontend/lib/models/student2.dart | 18 ---- frontend/lib/provider/about_Edit_widget.dart | 71 -------------- .../provider/achievements_edit_widget.dart | 1 - frontend/lib/provider/skills_edit_widget.dart | 92 ------------------- frontend/lib/provider/student_provider.dart | 24 ----- frontend/lib/screens/edit_profile.dart | 73 +-------------- frontend/lib/screens/home.dart | 68 -------------- frontend/lib/screens/user_profile.dart | 8 -- 8 files changed, 1 insertion(+), 354 deletions(-) delete mode 100644 frontend/lib/models/student2.dart diff --git a/frontend/lib/models/student2.dart b/frontend/lib/models/student2.dart deleted file mode 100644 index a388e30..0000000 --- a/frontend/lib/models/student2.dart +++ /dev/null @@ -1,18 +0,0 @@ -class Student { - Student( - {required this.name, - required this.studentMail, - required this.rollNumber, - required this.branch, - required this.role, - this.id, - this.collegeId}); - - final String? id; - final String? collegeId; - final String name; - final String studentMail; - final String rollNumber; - final String branch; - final String role; -} diff --git a/frontend/lib/provider/about_Edit_widget.dart b/frontend/lib/provider/about_Edit_widget.dart index a5608da..f1fea87 100644 --- a/frontend/lib/provider/about_Edit_widget.dart +++ b/frontend/lib/provider/about_Edit_widget.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../provider/student_provider.dart'; final aboutProvider = Provider((ref) { return ref.watch(aboutControllerProvider); @@ -52,73 +51,3 @@ class AboutEditWidget extends ConsumerWidget { ); } } -// import 'package:flutter/material.dart'; -// import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../provider/student_provider.dart'; - -// class AboutEditorWidget extends ConsumerWidget { -// const AboutEditorWidget({Key? key}) : super(key: key); - -// @override -// Widget build(BuildContext context, WidgetRef ref) { -// final student = ref.read(studentProvider); - -// final TextEditingController aboutController = -// TextEditingController(text: student.about); - -// return Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Text( -// 'About', -// style: const TextStyle( -// fontWeight: FontWeight.bold, -// ), -// ), -// TextFormField( -// controller: aboutController, -// onChanged: (newAbout) { -// ref.read(studentProvider.notifier).editAbout(newAbout); -// }, -// decoration: const InputDecoration( -// hintText: 'Write something about yourself...', -// ), -// maxLines: 5, -// ), -// ], -// ); -// } -// } -// // class AboutEditorWidget extends ConsumerWidget { -// // const AboutEditorWidget({Key? key}) : super(key: key); - -// // @override -// // Widget build(BuildContext context, WidgetRef ref) { -// // final student = ref.read(studentProvider); - -// // final TextEditingController aboutController = -// // TextEditingController(text: student.about); - -// // return Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // Text( -// // 'About', -// // style: const TextStyle( -// // fontWeight: FontWeight.bold, -// // ), -// // ), -// // TextField( -// // controller: aboutController, -// // onChanged: (newAbout) { -// // ref.read(studentProvider.notifier).editAbout(newAbout); -// // }, -// // decoration: const InputDecoration( -// // hintText: 'Write something about yourself...', -// // ), -// // maxLines: 5, -// // ), -// // ], -// // ); -// // } -// // } diff --git a/frontend/lib/provider/achievements_edit_widget.dart b/frontend/lib/provider/achievements_edit_widget.dart index 62e8ada..e3a63ec 100644 --- a/frontend/lib/provider/achievements_edit_widget.dart +++ b/frontend/lib/provider/achievements_edit_widget.dart @@ -4,7 +4,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../models/achievement.dart'; final achievementsProvider = Provider>((ref) { - // Your achievements data return ref.watch(achievementsControllerProvider); }); diff --git a/frontend/lib/provider/skills_edit_widget.dart b/frontend/lib/provider/skills_edit_widget.dart index f1ba5c6..5a8f91f 100644 --- a/frontend/lib/provider/skills_edit_widget.dart +++ b/frontend/lib/provider/skills_edit_widget.dart @@ -4,7 +4,6 @@ import 'package:syncfusion_flutter_sliders/sliders.dart'; import '../models/skills.dart'; final skillsProvider = Provider>((ref) { - // Your skills data return ref.watch(skillsControllerProvider); }); @@ -109,94 +108,3 @@ class SkillsEditWidget extends ConsumerWidget { ); } } -// import 'package:flutter/material.dart'; -// import 'package:syncfusion_flutter_sliders/sliders.dart'; - -// // class SkillsEditWidget extends StatelessWidget { -// // final TextEditingController skillsController; - -// // const SkillsEditWidget({required this.skillsController}); - -// // @override -// // Widget build(BuildContext context) { -// // List skills = (jsonDecode(skillsController.text) as List) -// // .map((json) => Skill.fromJson(json)) -// // .toList(); - -// // return Column( -// // crossAxisAlignment: CrossAxisAlignment.start, -// // children: [ -// // const Text( -// // 'Skills', -// // style: TextStyle( -// // fontWeight: FontWeight.bold, -// // ), -// // ), -// // ListView.builder( -// // shrinkWrap: true, -// // itemCount: skills.length, -// // itemBuilder: (context, index) { -// // return Row( -// // children: [ -// // Expanded( -// // child: TextFormField( -// // initialValue: skills[index].name, -// // onChanged: (value) { -// // skills[index].name = value; -// // updateSkills(); -// // }, -// // decoration: const InputDecoration(labelText: 'Skill'), -// // ), -// // ), -// // Expanded( -// // child: SfSlider( -// // min: 0.0, -// // max: 100.0, -// // value: skills[index].level.toDouble(), -// // onChanged: (dynamic value) { -// // skills[index].level = value.toInt(); -// // updateSkills(); -// // }, -// // ), -// // ), -// // ], -// // ); -// // }, -// // ), -// // ], -// // ); -// // } - -// // void updateSkills() { -// // skillsController.text = jsonEncode(skills); -// // } -// // } - -// class SkillsEditWidget extends StatelessWidget { -// final TextEditingController skillsController; - -// const SkillsEditWidget({required this.skillsController}); - -// @override -// Widget build(BuildContext context) { -// return Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Text( -// 'Skills', -// style: TextStyle( -// fontWeight: FontWeight.bold, -// ), -// ), -// SfSlider( -// min: 0.0, -// max: 100.0, -// value: double.parse(skillsController.text), -// onChanged: (dynamic value) { -// skillsController.text = value.toStringAsFixed(0); -// }, -// ), -// ], -// ); -// } -// } diff --git a/frontend/lib/provider/student_provider.dart b/frontend/lib/provider/student_provider.dart index 459392f..e3b041a 100644 --- a/frontend/lib/provider/student_provider.dart +++ b/frontend/lib/provider/student_provider.dart @@ -213,28 +213,4 @@ class StudentProvider extends StateNotifier { state = newState; _logger.i("Removed student: ${student.name}"); } - - // Student getStudentById(String studentId) { - // try { - // return state.students.firstWhere((student) => student.id == studentId); - // } catch (e) { - // return Student( - // id: '1', - // name: 'John Doe', - // email: 'john.doe@example.com', - // rollNumber: 'R001', - // about: 'I am a computer science student.', - // profilePicURI: - // 'https://cdn4.sharechat.com/img_907710_35cec5f5_1681916904360_sc.jpg?tenant=sc&referrer=pwa-sharechat-service&f=360_sc.jpg', - // branch: 'Computer Science', - // graduationYear: 2023, - // skills: [DummySkills.skills[1], DummySkills.skills[2]], - // achievements: [ - // Dummyachievements.achievements[1], - // Dummyachievements.achievements[2] - // ], - // roles: ['Core Member', 'Coordinator'], - // ); - // } - // } } diff --git a/frontend/lib/screens/edit_profile.dart b/frontend/lib/screens/edit_profile.dart index f0d6b03..d1bceae 100644 --- a/frontend/lib/screens/edit_profile.dart +++ b/frontend/lib/screens/edit_profile.dart @@ -1,11 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../provider/user_providers.dart'; -// import '../models/skills.dart'; -// import '../models/achievement.dart'; import '../provider/skills_edit_widget.dart'; import '../provider/achievements_edit_widget.dart'; -import '../provider/about_Edit_widget.dart'; +import '../provider/about_edit_widget.dart'; import 'dart:convert'; class EditProfileScreen extends ConsumerWidget { @@ -29,11 +26,9 @@ class EditProfileScreen extends ConsumerWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ AboutEditWidget(), - // UI for editing skills SkillsEditWidget( skillsController: TextEditingController(text: skillsJson), ), - // UI for editing achievements AchievementsEditWidget( achievementsController: TextEditingController(text: achievementsJson), @@ -45,69 +40,3 @@ class EditProfileScreen extends ConsumerWidget { ); } } -// import 'package:flutter/material.dart'; -// import 'package:flutter_riverpod/flutter_riverpod.dart'; -// import '../provider/user_providers.dart'; -// import '../models/skills.dart'; -// import '../models/achievement.dart'; -// import '../provider/skills_edit_widget.dart'; -// import '../provider/achievements_edit_widget.dart'; -// import 'dart:convert'; - -// class EditProfileScreen extends ConsumerWidget { -// @override -// Widget build(BuildContext context, WidgetRef ref) { -// TextEditingController aboutController = -// TextEditingController(text: ref.watch(aboutProvider) ?? ""); - -// List skills = ref.watch(skillsProvider); -// List achievements = ref.watch(achievementsProvider); - -// String skillsJson = jsonEncode(skills); -// String achievementsJson = jsonEncode(achievements); - -// return Scaffold( -// appBar: AppBar( -// title: const Text('Edit Profile'), -// ), -// body: SingleChildScrollView( -// child: Padding( -// padding: const EdgeInsets.all(16.0), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// const Text( -// 'Edit About', -// style: TextStyle( -// fontWeight: FontWeight.bold, -// fontSize: 20, -// ), -// ), -// TextField( -// controller: aboutController, -// onChanged: (newAbout) { -// // ref.read(aboutProvider).state = newAbout; -// }, -// decoration: const InputDecoration( -// hintText: 'Write something about yourself...', -// ), -// maxLines: 5, -// ), - -// // UI for editing skills -// SkillsEditWidget( -// skillsController: TextEditingController(text: skillsJson), -// ), - -// // UI for editing achievements -// AchievementsEditWidget( -// achievementsController: -// TextEditingController(text: achievementsJson), -// ), -// ], -// ), -// ), -// ), -// ); -// } -// } diff --git a/frontend/lib/screens/home.dart b/frontend/lib/screens/home.dart index fb27441..7ff1127 100644 --- a/frontend/lib/screens/home.dart +++ b/frontend/lib/screens/home.dart @@ -3,7 +3,6 @@ import 'package:go_router/go_router.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import '../constants/constants.dart'; import '../provider/student_provider.dart'; -// import '../screens/user_profile.dart'; class Home extends ConsumerWidget { const Home({Key? key}); @@ -39,12 +38,6 @@ class Home extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - // const SizedBox(height: 16), - // Text( - // 'Welcome, ${student.name}!', - // style: - // const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), - // ), SizedBox(height: 16), Text('Tap the icon to view your profile.'), ], @@ -54,64 +47,3 @@ class Home extends ConsumerWidget { ); } } - - -// class Home extends ConsumerWidget { -// const Home({Key? key}); - -// @override -// Widget build(BuildContext context, WidgetRef ref) { -// final student = ref.read(studentProvider); - -// return SafeArea( -// child: Scaffold( -// appBar: AppBar( -// title: const Text( -// AppConstants.appName, -// // style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), -// ), -// backgroundColor: Colors.lightBlueAccent, -// ), -// body: Padding( -// padding: const EdgeInsets.all(16.0), -// child: Column( -// crossAxisAlignment: CrossAxisAlignment.start, -// children: [ -// Align( -// alignment: Alignment.centerRight, -// child: Padding( -// padding: const EdgeInsets.only(right: 8.0), -// child: GestureDetector( -// onTap: () { -// context.push('/user_profile'); -// }, -// child: Container( -// width: 50, -// height: 50, -// decoration: const BoxDecoration( -// shape: BoxShape.circle, -// color: Colors.lightBlue, -// ), -// child: const Icon( -// Icons.person, -// color: Colors.white, -// ), -// ), -// ), -// ), -// ), -// const SizedBox(height: 16), -// Text( -// 'Welcome, ${student.name}!', -// style: -// const TextStyle(fontSize: 18, fontWeight: FontWeight.bold), -// ), -// const SizedBox(height: 16), -// const Text('Tap the icon to view your profile.'), -// ], -// ), -// ), -// ), -// ); -// } -// } diff --git a/frontend/lib/screens/user_profile.dart b/frontend/lib/screens/user_profile.dart index 5eefe01..bd3e73c 100644 --- a/frontend/lib/screens/user_profile.dart +++ b/frontend/lib/screens/user_profile.dart @@ -119,15 +119,7 @@ class UserProfile extends ConsumerWidget { ), ), const SizedBox(height: 5), - // const Text( - // 'scroll right >> ', - // style: TextStyle( - // fontWeight: FontWeight.w100, - // fontSize: 12, - // ), - // ), - // Display Skills as separate pie charts if (currentStudent?.skills != null) Column( children: [