From 2ddcf63552ba85e089c4a97bf78e46b4ea9a8c61 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Thu, 26 Jan 2023 17:54:15 +0530 Subject: [PATCH 01/15] initial commit --- lib/Components/side_drawer.dart | 5 + lib/main.dart | 2 + lib/models/department_announcement.dart | 37 +++ .../Department/DepartmentHomepage.dart | 26 ++ lib/screens/Healthcenter/Appointment.dart | 235 +++++++++--------- .../Healthcenter/ambulanceRequest.dart | 121 ++++----- lib/screens/Healthcenter/feedback.dart | 95 ++++--- 7 files changed, 299 insertions(+), 222 deletions(-) create mode 100644 lib/models/department_announcement.dart create mode 100644 lib/screens/Department/DepartmentHomepage.dart diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..f0e6a1b2 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -121,6 +121,11 @@ class _SideDrawerState extends State { pageMover: '/programme_curriculum_home', isActive: true, ), + ModulesPadding( + line: 'Department', + pageMover: '/department_homepage', + isActive: true, + ), ModulesPadding( line: 'Gymkhana Module', pageMover: '/gymkhana_homepage'), diff --git a/lib/main.dart b/lib/main.dart index 97708725..b4b84bb5 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -42,6 +42,7 @@ import 'package:fusion/screens/Healthcenter/viewschedule.dart'; import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/screens/Department/DepartmentHomepage.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -113,6 +114,7 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), + '/department_homepage': (context) => DepartmentHomepage(), }, ); } diff --git a/lib/models/department_announcement.dart b/lib/models/department_announcement.dart new file mode 100644 index 00000000..62d0c079 --- /dev/null +++ b/lib/models/department_announcement.dart @@ -0,0 +1,37 @@ +class DepartmentAnnouncements { + String? maker_id; + DateTime? ann_date; + String? message; + String? batch; + String? department; + String? programme; + + DepartmentAnnouncements({ + this.maker_id, //id of announcement maker + this.ann_date, //announcement date and time + this.message, //message in the announcement + this.batch, + this.department, + this.programme, + }); + factory DepartmentAnnouncements.fromJson(json) { + return DepartmentAnnouncements( + maker_id: json["maker_id"], + ann_date: DateTime.parse(json["timestamp"]), + message: json["message"], + batch: json["batch"], + department: json["department"], + programme: json["programme"], + ); + } + Map toJson() { + return { + "maker_id": this.maker_id, + "ann_date": this.ann_date, + "message": this.message, + "batch": this.batch, + "department": this.department, + "programme": this.programme, + }; + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart new file mode 100644 index 00000000..9bd54538 --- /dev/null +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -0,0 +1,26 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/models/gymkhana.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/gymkhana_service.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class DepartmentHomepage extends StatefulWidget { + @override + _DepartmentHomepageState createState() => _DepartmentHomepageState(); +} + +class _DepartmentHomepageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text("DepartHomePage"), + ); + } +} diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index dd486166..2d0c9031 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; class Appointment extends StatefulWidget { - @override _AppointmentState createState() => _AppointmentState(); } @@ -10,128 +9,136 @@ class Appointment extends StatefulWidget { //int get _value=>_value; class _AppointmentState extends State { - int _value=1; + int _value = 1; @override Widget build(BuildContext context) { return Container( - // color: Colors.red, - width: 200, - //height: 120, - //color: Colors.blue, - alignment: Alignment.topCenter, - padding: EdgeInsets.all(30.0), - child:ListView( - children: [ - Text("Doctor",style:TextStyle(fontSize: 18,fontWeight: FontWeight.bold),textAlign: TextAlign.start,), - Padding( - padding:EdgeInsets.symmetric(horizontal:0.0), - child:Container( - height:0.5, - width:130.0, - color:Colors.black,),), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DropdownButton( - dropdownColor: Colors.deepOrangeAccent, - elevation: 16, - value: _value, - isExpanded: true, - hint: Text("-SELECT-"), - items: [ - DropdownMenuItem( - child: Text("--SELECT--"), - value: 1, - ), - DropdownMenuItem( - child: Text("Dr Tony Gupta"), - value: 2, - ), - DropdownMenuItem( - child: Text("Dr Hrishi Goyal"), - value: 3, - - ), - DropdownMenuItem( - child: Text("Dr Preeti Singh"), - value: 4 - ), - ], - onChanged: (value) { - setState(() { - //_value = value; - }); - }), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - //SessionView, - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'Date', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + // color: Colors.red, + width: 200, + //height: 120, + //color: Colors.blue, + alignment: Alignment.topCenter, + padding: EdgeInsets.all(30.0), + child: ListView( + children: [ + Text( + "Doctor", + style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), + textAlign: TextAlign.start, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 0.0), + child: Container( + height: 0.5, + width: 130.0, + color: Colors.black, ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'From Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DropdownButton( + dropdownColor: Colors.deepOrangeAccent, + elevation: 16, + value: _value, + isExpanded: true, + hint: Text("-SELECT-"), + items: [ + DropdownMenuItem( + child: Text("--SELECT--"), + value: 1, + ), + DropdownMenuItem( + child: Text("Dr Tony Gupta"), + value: 2, + ), + DropdownMenuItem( + child: Text("Dr Hrishi Goyal"), + value: 3, + ), + DropdownMenuItem(child: Text("Dr Preeti Singh"), value: 4), + ], + onChanged: (value) { + setState(() { + //_value = value; + }); + }), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + //SessionView, + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'Date', ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.access_time_rounded), - labelText: 'To Time', - ), - mode: DateTimeFieldPickerMode.time, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, + mode: DateTimeFieldPickerMode.date, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.access_time_rounded), + labelText: 'From Time', ), - Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), - TextFormField( - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Issues/Symptoms", - fillColor: Colors.white, - border: new OutlineInputBorder( - ), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.access_time_rounded), + labelText: 'To Time', ), - Padding(padding: EdgeInsets.symmetric(vertical: 5.0)), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), - color: Colors.deepOrangeAccent, - onPressed: () {}, + mode: DateTimeFieldPickerMode.time, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 10.0)), + TextFormField( + cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Issues/Symptoms", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green ), + style: new TextStyle( + fontFamily: "Poppins", + ), + ), + Padding(padding: EdgeInsets.symmetric(vertical: 5.0)), + Center( + child: TextButton( + child: Text( + 'Submit', + style: TextStyle(fontSize: 15.0), + ), + //color: Colors.deepOrangeAccent, + onPressed: () {}, ), - ], - ), + ), + ], + ), ); } } diff --git a/lib/screens/Healthcenter/ambulanceRequest.dart b/lib/screens/Healthcenter/ambulanceRequest.dart index 4d90910a..f78cd426 100644 --- a/lib/screens/Healthcenter/ambulanceRequest.dart +++ b/lib/screens/Healthcenter/ambulanceRequest.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:date_field/date_field.dart'; - class AmbulanceRequest extends StatefulWidget { @override _AmbulanceRequestState createState() => _AmbulanceRequestState(); @@ -13,65 +12,67 @@ class _AmbulanceRequestState extends State { return Container( padding: EdgeInsets.all(20.0), child: Column( - children: [ - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'From', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - - DateTimeFormField( - decoration: const InputDecoration( - hintStyle: TextStyle(color: Colors.black45), - errorStyle: TextStyle(color: Colors.redAccent), - border: OutlineInputBorder(), - suffixIcon: Icon(Icons.event_note), - labelText: 'To', - ), - mode: DateTimeFieldPickerMode.date, - autovalidateMode: AutovalidateMode.always, - validator: (e) => (e?.day ?? 0) == 1 ? 'Please not the first day' : null, - onDateSelected: (DateTime value) { - print(value); - }, - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - TextFormField( - maxLines: 4, - cursorHeight: 30, - decoration: new InputDecoration( - labelText: "Reason", - fillColor: Colors.white, - border: new OutlineInputBorder( - ), - //fillColor: Colors.green - ), - style: new TextStyle( - fontFamily: "Poppins", - ), - ), - Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), - color: Colors.deepOrangeAccent, - onPressed: () {}, - ), - ), - - ], + children: [ + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'From', + ), + mode: DateTimeFieldPickerMode.date, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + DateTimeFormField( + decoration: const InputDecoration( + hintStyle: TextStyle(color: Colors.black45), + errorStyle: TextStyle(color: Colors.redAccent), + border: OutlineInputBorder(), + suffixIcon: Icon(Icons.event_note), + labelText: 'To', + ), + mode: DateTimeFieldPickerMode.date, + autovalidateMode: AutovalidateMode.always, + validator: (e) => + (e?.day ?? 0) == 1 ? 'Please not the first day' : null, + onDateSelected: (DateTime value) { + print(value); + }, + ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + TextFormField( + maxLines: 4, + cursorHeight: 30, + decoration: new InputDecoration( + labelText: "Reason", + fillColor: Colors.white, + border: new OutlineInputBorder(), + //fillColor: Colors.green + ), + style: new TextStyle( + fontFamily: "Poppins", + ), + ), + Padding(padding: EdgeInsets.symmetric(vertical: 20.0)), + Center( + child: TextButton( + child: Text( + 'Submit', + style: TextStyle(fontSize: 15.0), + ), + //color: Colors.deepOrangeAccent, + onPressed: () {}, + ), + ), + ], ), ); } diff --git a/lib/screens/Healthcenter/feedback.dart b/lib/screens/Healthcenter/feedback.dart index 6b34c3f9..91429c5e 100644 --- a/lib/screens/Healthcenter/feedback.dart +++ b/lib/screens/Healthcenter/feedback.dart @@ -1,18 +1,13 @@ import 'package:flutter/material.dart'; - class FeedBack extends StatefulWidget { @override _FeedBackState createState() => _FeedBackState(); } - - class _FeedBackState extends State { @override - - - Widget feed=Container( + Widget feed = Container( padding: EdgeInsets.all(20.0), child: Column( children: [ @@ -22,25 +17,27 @@ class _FeedBackState extends State { decoration: new InputDecoration( labelText: "Feedback", fillColor: Colors.white, - border: new OutlineInputBorder( - ), + border: new OutlineInputBorder(), //fillColor: Colors.green ), style: new TextStyle( fontFamily: "Poppins", ), ), - Center(child:FlatButton( - child: Text('Submit', style: TextStyle(fontSize: 15.0),), - color: Colors.deepOrangeAccent, - onPressed: () {}, - ), + Center( + child: TextButton( + child: Text( + 'Submit', + style: TextStyle(fontSize: 15.0), + ), + //color: Colors.deepOrangeAccent, + onPressed: () {}, + ), ), ], ), ); - Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, @@ -50,41 +47,43 @@ class _FeedBackState extends State { ), body: Container( child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - SizedBox(height: 20.0), - DefaultTabController( - length: 1, // length of tabs - initialIndex: 0, - child: Column(crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - //color: Colors.deepOrangeAccent, - child: TabBar( - labelColor: Colors.deepOrange, - indicatorColor: Colors.deepOrangeAccent, - unselectedLabelColor: Colors.black, - tabs: [ - Tab( - child: Text("Feedback Form", style: TextStyle( - fontWeight: FontWeight.bold),),), - ], - ), - ), - Container( - height: 520, //height of TabBarView - decoration: BoxDecoration( - border: Border( - top: BorderSide(color: Colors.grey, width: 0.5)) + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + SizedBox(height: 20.0), + DefaultTabController( + length: 1, // length of tabs + initialIndex: 0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + //color: Colors.deepOrangeAccent, + child: TabBar( + labelColor: Colors.deepOrange, + indicatorColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + tabs: [ + Tab( + child: Text( + "Feedback Form", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + ], + ), ), - child: TabBarView(children: [ - feed, - - ]) - ) - ]) - ), - ]), + Container( + height: 520, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.grey, width: 0.5))), + child: TabBarView(children: [ + feed, + ])) + ])), + ]), ), ); } -} \ No newline at end of file +} From dcfe6fefab600f7eb266e69a693d19a9740583d9 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Thu, 26 Jan 2023 18:44:53 +0530 Subject: [PATCH 02/15] Update DepartmentHomepage.dart --- .../Department/DepartmentHomepage.dart | 88 +++++++++++++++++-- 1 file changed, 82 insertions(+), 6 deletions(-) diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index 9bd54538..c0b59ba8 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -1,13 +1,14 @@ import 'dart:async'; - +import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; -import 'package:fusion/models/gymkhana.dart'; import 'package:fusion/models/profile.dart'; import 'package:fusion/services/gymkhana_service.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:http/http.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -15,12 +16,87 @@ class DepartmentHomepage extends StatefulWidget { } class _DepartmentHomepageState extends State { + late String name = ""; + late String studentType = ""; + late ProfileData data2; + bool _loading = true; + late ProfileService profileService; + @override + void initState() { + super.initState(); + // _dashboardController = StreamController(); + // dashboardService = DashboardService(); + // _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + Response response2 = await profileService.getProfile(); + setState(() { + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name'] + + ' ' + + data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: Text("DepartHomePage"), - ); + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: ListView( + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 20.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 170.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/unknown.jpg'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + height: 10.0, + ), + Text( + //NAME OF USER + name, + // data.details!['current_user']['first_name'] + + // ' ' + + // data.details!['current_user']['last_name'], + style: TextStyle(fontSize: 20.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + studentType, + // data.details!['user_branch'] + ' | ' + "STUDENT", + // style: TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ) + ], + )); } } From 5d16d365ade3657fe5d9cb4006e1d90f66aa1364 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Fri, 3 Feb 2023 12:45:15 +0530 Subject: [PATCH 03/15] Ui ux for student --- db/Department_AboutUs.csv | 16 ++ lib/main.dart | 2 + lib/screens/Department/AboutUs.dart | 37 +++++ .../Department/DepartmentHomepage.dart | 147 +++++++++++++++++- 4 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 db/Department_AboutUs.csv create mode 100644 lib/screens/Department/AboutUs.dart diff --git a/db/Department_AboutUs.csv b/db/Department_AboutUs.csv new file mode 100644 index 00000000..e4f2cdf4 --- /dev/null +++ b/db/Department_AboutUs.csv @@ -0,0 +1,16 @@ +"Our Mission"," +The mission of the Computer Engineering Department +is to provide education programs that would +encourage students to read critically, reason +analytically. cornm.unicate persuasively. apply +professionally and prepare them to excel in the field +of computing" +"Our Vision ", +"The vision of the computer Engineering Department +is to recognize is to itself as renowned department +in the field of technical education in Computer +Engineering and strives to carry out the superior +level Of research based on the quality. innovation +and excellence; with the help or its stakeholder vil. +the students, research scholars. Facuty members, +the staff and the Alumni." \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index b4b84bb5..bd46a1df 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -43,6 +43,7 @@ import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/screens/Department/DepartmentHomepage.dart'; +import 'package:fusion/screens/Department/AboutUs.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -115,6 +116,7 @@ class MyApp extends StatelessWidget { '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), '/department_homepage': (context) => DepartmentHomepage(), + '/department_aboutus': (context) => AboutUs(), }, ); } diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart new file mode 100644 index 00000000..6a46e651 --- /dev/null +++ b/lib/screens/Department/AboutUs.dart @@ -0,0 +1,37 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AboutUs extends StatefulWidget { + @override + _AboutUsState createState() => _AboutUsState(); +} + +class _AboutUsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: ListView(children: [ + Row( + children: [ + Text( + " Welcome to CSE Department", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ) + ], + ), + Row( + children: [], + ), + Row() + ])); + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index c0b59ba8..12bbe633 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -4,11 +4,11 @@ import 'package:flutter/material.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/models/profile.dart'; -import 'package:fusion/services/gymkhana_service.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; +import 'package:fusion/screens/Department/AboutUs.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -49,6 +49,8 @@ class _DepartmentHomepageState extends State { @override Widget build(BuildContext context) { + double kHeight = MediaQuery.of(context).size.height; + double kWidth = MediaQuery.of(context).size.width; return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), @@ -95,7 +97,148 @@ class _DepartmentHomepageState extends State { ), ], ), - ) + ), + Container( + height: 0.4 * kHeight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () { + Navigator.pushNamed( + context, "/department_aboutus"); + }, + child: Column( + children: [ + Icon( + Icons.info, + size: 45.0, + ), + Text('About Us'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.article_rounded, + size: 45.0, + ), + Text('Facilities'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.attribution_outlined, + size: 45.0, + ), + Text('Faculty'), + ], + ), + ), + ], + ), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.group, + size: 45.0, + ), + Text('Students'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.volume_down_outlined, + size: 45.0, + ), + Text('Announcements'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.app_registration, + size: 45.0, + ), + Text('Requests'), + ], + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), ], )); } From f2dc749b30154e03956e9679726c764a9dfdec58 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Sun, 12 Feb 2023 19:54:43 +0530 Subject: [PATCH 04/15] Developed UI/UX for About us page and fetched data for cse department --- db/Department_AboutUs.csv | 16 ---- db/Department_AboutUs_cse.csv | 2 + lib/main.dart | 5 +- lib/screens/Department/AboutUs.dart | 76 +++++++++++++++++-- lib/screens/Department/Announcements.dart | 33 ++++++++ .../Department/DepartmentHomepage.dart | 11 ++- 6 files changed, 117 insertions(+), 26 deletions(-) delete mode 100644 db/Department_AboutUs.csv create mode 100644 db/Department_AboutUs_cse.csv create mode 100644 lib/screens/Department/Announcements.dart diff --git a/db/Department_AboutUs.csv b/db/Department_AboutUs.csv deleted file mode 100644 index e4f2cdf4..00000000 --- a/db/Department_AboutUs.csv +++ /dev/null @@ -1,16 +0,0 @@ -"Our Mission"," -The mission of the Computer Engineering Department -is to provide education programs that would -encourage students to read critically, reason -analytically. cornm.unicate persuasively. apply -professionally and prepare them to excel in the field -of computing" -"Our Vision ", -"The vision of the computer Engineering Department -is to recognize is to itself as renowned department -in the field of technical education in Computer -Engineering and strives to carry out the superior -level Of research based on the quality. innovation -and excellence; with the help or its stakeholder vil. -the students, research scholars. Facuty members, -the staff and the Alumni." \ No newline at end of file diff --git a/db/Department_AboutUs_cse.csv b/db/Department_AboutUs_cse.csv new file mode 100644 index 00000000..598da1ab --- /dev/null +++ b/db/Department_AboutUs_cse.csv @@ -0,0 +1,2 @@ +"Our Mission :","The mission of the Computer Engineering Department is to provide education programs that would encourage students to read critically, reason analytically. cormmunicate persuasively. apply professionally and prepare them to excel in the field of computing" +"Our Vision :","The vision of the computer Engineering Department is to recognize is to itself as renowned department in the field of technical education in Computer Engineering and strives to carry out the superior level Of research based on the quality. innovation and excellence; with the help or its stakeholder vil. the students, research scholars. Facuty members, the staff and the Alumni." \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index bd46a1df..e626e110 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; import 'package:fusion/screens/Complaint/ComplaintHistory/complain_history.dart'; import 'package:fusion/screens/Complaint/Feedback/feedback.dart'; import 'package:fusion/screens/Complaint/LodgeComplaint/lodge_complaint.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; import 'package:fusion/screens/Establishment/establishment_home_page.dart'; import 'package:fusion/screens/Library/Book_Search.dart'; import 'package:fusion/screens/Library/dues.dart'; @@ -44,6 +45,7 @@ import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/screens/Department/DepartmentHomepage.dart'; import 'package:fusion/screens/Department/AboutUs.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -116,7 +118,8 @@ class MyApp extends StatelessWidget { '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), '/department_homepage': (context) => DepartmentHomepage(), - '/department_aboutus': (context) => AboutUs(), + '/department_homepage/aboutus': (context) => AboutUs(), + '/department_homepage/announcements': (context) => Announcements(), }, ); } diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index 6a46e651..989dfded 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -2,8 +2,16 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; +import 'package:csv/csv.dart'; +import 'package:flutter/foundation.dart'; class AboutUs extends StatefulWidget { @override @@ -11,27 +19,81 @@ class AboutUs extends StatefulWidget { } class _AboutUsState extends State { + late ProfileService profileService; + late String Department = ""; + late ProfileData data; + bool _loading = true; + List> StaticData = []; + + @override + void initState() { + super.initState(); + profileService = ProfileService(); + getData(); + } + + // ignore: non_constant_identifier_names + _loadCSV_CSE() async { + try { + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_cse.csv'); + StaticData = const CsvToListConverter().convert(staticdata); + } catch (e) { + print(e); + } + } + + getData() async { + try { + Response response = await profileService.getProfile(); + setState(() { + data = ProfileData.fromJson(jsonDecode(response.body)); + _loading = false; + }); + Department = data.profile!['department']!['name']; + if (Department == 'CSE') { + _loadCSV_CSE(); + } + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), body: ListView(children: [ - Row( + Column( children: [ Text( - " Welcome to CSE Department", + " Welcome to " + Department + " Department", style: TextStyle( fontSize: 35, ), textAlign: TextAlign.center, - ) + ), + Wrap(children: [ + StaticData.isEmpty + ? Text("Fetching Data") + : Column(children: [ + for (int i = 0; i < StaticData.length; i++) ...[ + Padding( + padding: EdgeInsets.fromLTRB(10, 30, 10, 10), + child: Text(StaticData[i][0], + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold))), + Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Text(StaticData[i][1], + style: TextStyle(fontSize: 20))), + ] + ]) + ]) ], ), - Row( - children: [], - ), - Row() ])); } } diff --git a/lib/screens/Department/Announcements.dart b/lib/screens/Department/Announcements.dart new file mode 100644 index 00000000..5f718a0b --- /dev/null +++ b/lib/screens/Department/Announcements.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; + +class Announcements extends StatefulWidget { + @override + _AnnouncementsState createState() => _AnnouncementsState(); +} + +class _AnnouncementsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text( + "Welcome to Announcements", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index 12bbe633..2bdddce7 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -9,6 +9,7 @@ import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; import 'package:fusion/screens/Department/AboutUs.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -19,6 +20,7 @@ class _DepartmentHomepageState extends State { late String name = ""; late String studentType = ""; late ProfileData data2; + late String user_type = ""; bool _loading = true; late ProfileService profileService; @override @@ -42,6 +44,7 @@ class _DepartmentHomepageState extends State { studentType = data2.profile!['department']!['name'] + ' ' + data2.profile!['user_type']; + user_type = data2.profile!['user_type']; } catch (e) { print(e); } @@ -99,6 +102,7 @@ class _DepartmentHomepageState extends State { ), ), Container( + // UI/UX of student height: 0.4 * kHeight, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -114,7 +118,7 @@ class _DepartmentHomepageState extends State { TextButton( onPressed: () { Navigator.pushNamed( - context, "/department_aboutus"); + context, "/department_homepage/aboutus"); }, child: Column( children: [ @@ -200,7 +204,10 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed(context, + "/department_homepage/announcements"); + }, child: Column( children: [ Icon( From 3e5a777db59aafd0a06b79440fcdb568631cdcb9 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:33:14 +0530 Subject: [PATCH 05/15] fixed minor data fetching issue --- lib/screens/Department/AboutUs.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index 989dfded..1012ce1e 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -30,6 +30,7 @@ class _AboutUsState extends State { super.initState(); profileService = ProfileService(); getData(); + _loadCSV_CSE(); } // ignore: non_constant_identifier_names From 1f4ac5738632eb3bc9915bebde4e7784eeddff78 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Thu, 26 Jan 2023 17:54:15 +0530 Subject: [PATCH 06/15] initial commit --- lib/Components/side_drawer.dart | 5 + lib/main.dart | 125 ++++++++---------- lib/models/department_announcement.dart | 37 ++++++ .../Department/DepartmentHomepage.dart | 26 ++++ lib/screens/Healthcenter/Appointment.dart | 2 + lib/screens/Healthcenter/feedback.dart | 1 - 6 files changed, 126 insertions(+), 70 deletions(-) create mode 100644 lib/models/department_announcement.dart create mode 100644 lib/screens/Department/DepartmentHomepage.dart diff --git a/lib/Components/side_drawer.dart b/lib/Components/side_drawer.dart index be08db0e..f0e6a1b2 100644 --- a/lib/Components/side_drawer.dart +++ b/lib/Components/side_drawer.dart @@ -121,6 +121,11 @@ class _SideDrawerState extends State { pageMover: '/programme_curriculum_home', isActive: true, ), + ModulesPadding( + line: 'Department', + pageMover: '/department_homepage', + isActive: true, + ), ModulesPadding( line: 'Gymkhana Module', pageMover: '/gymkhana_homepage'), diff --git a/lib/main.dart b/lib/main.dart index 29a2c810..46859aaf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -42,6 +42,7 @@ import 'package:fusion/screens/Healthcenter/viewschedule.dart'; import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/screens/Department/DepartmentHomepage.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -59,75 +60,61 @@ void main() { class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - MediaQueryData windowData = - MediaQueryData.fromWindow(WidgetsBinding.instance.window); - windowData = windowData.copyWith( - textScaleFactor: 1, - ); - return MediaQuery( - data: windowData, - child: MaterialApp( - useInheritedMediaQuery: true, - title: 'Fusion', - debugShowCheckedModeBanner: false, - theme: ThemeData( - // primarySwatch: Colors.blueGrey, - colorSchemeSeed: Color(0xFF2085D0), - fontFamily: 'Nunito', - useMaterial3: true, - ), - initialRoute: '/landing', - routes: { - '/landing': (context) => LandingPage(), - '/login_page': (context) => LoginPage(), - '/dashboard': (context) => Dashboard(), - '/academic_home_page': (context) => AcademicHomePage( - ModalRoute.of(context)!.settings.arguments.toString()), - '/academic_home_page/current_semester_home_page': (context) => - CurrentSemesterHomePage(), - '/academic_home_page/registration_home_page': (context) => - RegistrationHomePage(), - '/academic_home_page/bonafide': (context) => Bonafide(), - '/academic_home_page/branch_change': (context) => BranchChange(), - '/academic_home_page/attendance': (context) => Attendance(), - '/academic_home_page/dues': (context) => Dues(), - '/academic_home_page/thesis': (context) => ThesisHomePage(), - '/academic_home_page/performance': (context) => Performance(), - '/academic_home_page/add_drop_courses': (context) => AddDropCourses(), - '/programme_curriculum_home': (context) => ProgrammeCurriculumHome(), - '/programme_curriculum_home/programme': (context) => Programme(), - '/programme_curriculum_home/batches': (context) => Batches(), - '/programme_curriculum_home/discipline': (context) => Discipline(), - '/programme_curriculum_home/curriculum': (context) => Curriculum(), - '/programme_curriculum_home/programme_info': (context) => - ProgrammeInfo(), - '/programme_curriculum_home/courses': (context) => Courses(), - '/programme_curriculum_home/courses_info': (context) => CoursesInfo(), - '/establishment': (context) => Establishment(), - '/gymkhana_homepage': (context) => GymkhanaHomepage(), - '/gymkhana_homepage/apply': (context) => Apply(), - '/gymkhana_homepage/polls': (context) => Polls(), - '/gymkhana_homepage/clubs': (context) => Club(), - '/gymkhana_homepage/member_records': (context) => Records(), - '/library_homepage': (context) => LibraryHomeScreen(), - '/library_homepage/book_search': (context) => BookSearch(), - '/library_homepage/issued_items': (context) => IssuedItems(), - '/library_homepage/dues': (context) => LibraryDues(), - '/complaint': (context) => - Complaint(ModalRoute.of(context)!.settings.arguments.toString()), - '/complaint/lodge_complaint': (context) => LodgeComplaint( - ModalRoute.of(context)!.settings.arguments.toString()), - '/complaint/complaint_history': (context) => ComplainHistory(), - '/complaint/feedback': (context) => ComplaintFeedBack(), - '/profile': (context) => Profile(), - '/health_center': (context) => HealthCenterMod( - ModalRoute.of(context)!.settings.arguments.toString()), - '/health_center/healthcenter': (context) => HealthCenter(), - '/health_center/feedback': (context) => FeedBack(), - '/health_center/viewschedule': (context) => ViewSchedule(), - '/health_center/history': (context) => History(), - }, - ), + return MaterialApp( + title: 'Fusion', + debugShowCheckedModeBanner: false, + theme: ThemeData(primarySwatch: Colors.blueGrey, fontFamily: 'Nunito'), + initialRoute: '/landing', + routes: { + '/landing': (context) => LandingPage(), + '/login_page': (context) => LoginPage(), + '/dashboard': (context) => Dashboard(), + '/academic_home_page': (context) => AcademicHomePage( + ModalRoute.of(context)!.settings.arguments.toString()), + '/academic_home_page/current_semester_home_page': (context) => + CurrentSemesterHomePage(), + '/academic_home_page/registration_home_page': (context) => + RegistrationHomePage(), + '/academic_home_page/bonafide': (context) => Bonafide(), + '/academic_home_page/branch_change': (context) => BranchChange(), + '/academic_home_page/attendance': (context) => Attendance(), + '/academic_home_page/dues': (context) => Dues(), + '/academic_home_page/thesis': (context) => ThesisHomePage(), + '/academic_home_page/performance': (context) => Performance(), + '/academic_home_page/add_drop_courses': (context) => AddDropCourses(), + '/programme_curriculum_home': (context) => ProgrammeCurriculumHome(), + '/programme_curriculum_home/programme': (context) => Programme(), + '/programme_curriculum_home/batches': (context) => Batches(), + '/programme_curriculum_home/discipline': (context) => Discipline(), + '/programme_curriculum_home/curriculum': (context) => Curriculum(), + '/programme_curriculum_home/programme_info': (context) => + ProgrammeInfo(), + '/programme_curriculum_home/courses': (context) => Courses(), + '/programme_curriculum_home/courses_info': (context) => CoursesInfo(), + '/establishment': (context) => Establishment(), + '/gymkhana_homepage': (context) => GymkhanaHomepage(), + '/gymkhana_homepage/apply': (context) => Apply(), + '/gymkhana_homepage/polls': (context) => Polls(), + '/gymkhana_homepage/clubs': (context) => Club(), + '/gymkhana_homepage/member_records': (context) => Records(), + '/library_homepage': (context) => LibraryHomeScreen(), + '/library_homepage/book_search': (context) => BookSearch(), + '/library_homepage/issued_items': (context) => IssuedItems(), + '/library_homepage/dues': (context) => LibraryDues(), + '/complaint': (context) => + Complaint(ModalRoute.of(context)!.settings.arguments.toString()), + '/complaint/lodge_complaint': (context) => LodgeComplaint( + ModalRoute.of(context)!.settings.arguments.toString()), + '/complaint/complaint_history': (context) => ComplainHistory(), + '/complaint/feedback': (context) => ComplaintFeedBack(), + '/profile': (context) => Profile(), + '/health_center': (context) => HealthCenterMod( + ModalRoute.of(context)!.settings.arguments.toString()), + '/health_center/healthcenter': (context) => HealthCenter(), + '/health_center/feedback': (context) => FeedBack(), + '/health_center/viewschedule': (context) => ViewSchedule(), + '/health_center/history': (context) => History(), + }, ); } } diff --git a/lib/models/department_announcement.dart b/lib/models/department_announcement.dart new file mode 100644 index 00000000..62d0c079 --- /dev/null +++ b/lib/models/department_announcement.dart @@ -0,0 +1,37 @@ +class DepartmentAnnouncements { + String? maker_id; + DateTime? ann_date; + String? message; + String? batch; + String? department; + String? programme; + + DepartmentAnnouncements({ + this.maker_id, //id of announcement maker + this.ann_date, //announcement date and time + this.message, //message in the announcement + this.batch, + this.department, + this.programme, + }); + factory DepartmentAnnouncements.fromJson(json) { + return DepartmentAnnouncements( + maker_id: json["maker_id"], + ann_date: DateTime.parse(json["timestamp"]), + message: json["message"], + batch: json["batch"], + department: json["department"], + programme: json["programme"], + ); + } + Map toJson() { + return { + "maker_id": this.maker_id, + "ann_date": this.ann_date, + "message": this.message, + "batch": this.batch, + "department": this.department, + "programme": this.programme, + }; + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart new file mode 100644 index 00000000..9bd54538 --- /dev/null +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -0,0 +1,26 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/models/gymkhana.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/gymkhana_service.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; + +class DepartmentHomepage extends StatefulWidget { + @override + _DepartmentHomepageState createState() => _DepartmentHomepageState(); +} + +class _DepartmentHomepageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text("DepartHomePage"), + ); + } +} diff --git a/lib/screens/Healthcenter/Appointment.dart b/lib/screens/Healthcenter/Appointment.dart index 8188e9d5..abe03dc9 100644 --- a/lib/screens/Healthcenter/Appointment.dart +++ b/lib/screens/Healthcenter/Appointment.dart @@ -134,7 +134,9 @@ class _AppointmentState extends State { 'Submit', style: TextStyle(fontSize: 15.0), ), + // color: Colors.deepOrangeAccent, + onPressed: () {}, ), ), diff --git a/lib/screens/Healthcenter/feedback.dart b/lib/screens/Healthcenter/feedback.dart index 86fe408c..ac470eef 100644 --- a/lib/screens/Healthcenter/feedback.dart +++ b/lib/screens/Healthcenter/feedback.dart @@ -30,7 +30,6 @@ class _FeedBackState extends State { 'Submit', style: TextStyle(fontSize: 15.0), ), - // color: Colors.deepOrangeAccent, onPressed: () {}, ), ), From 0702a5ef24693020bd240e5d762af4ca13a2332e Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Thu, 26 Jan 2023 18:44:53 +0530 Subject: [PATCH 07/15] Update DepartmentHomepage.dart --- .../Department/DepartmentHomepage.dart | 88 +++++++++++++++++-- 1 file changed, 82 insertions(+), 6 deletions(-) diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index 9bd54538..c0b59ba8 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -1,13 +1,14 @@ import 'dart:async'; - +import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; -import 'package:fusion/models/gymkhana.dart'; import 'package:fusion/models/profile.dart'; import 'package:fusion/services/gymkhana_service.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:http/http.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -15,12 +16,87 @@ class DepartmentHomepage extends StatefulWidget { } class _DepartmentHomepageState extends State { + late String name = ""; + late String studentType = ""; + late ProfileData data2; + bool _loading = true; + late ProfileService profileService; + @override + void initState() { + super.initState(); + // _dashboardController = StreamController(); + // dashboardService = DashboardService(); + // _profileController = StreamController(); + profileService = ProfileService(); + getData(); + } + + getData() async { + try { + Response response2 = await profileService.getProfile(); + setState(() { + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; + studentType = data2.profile!['department']!['name'] + + ' ' + + data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: Text("DepartHomePage"), - ); + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: ListView( + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 20.0), + shadowColor: Colors.black, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(top: 20.0), + width: 170.0, + height: 170.0, + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/unknown.jpg'), + fit: BoxFit.cover, + ), + ), + ), + SizedBox( + height: 10.0, + ), + Text( + //NAME OF USER + name, + // data.details!['current_user']['first_name'] + + // ' ' + + // data.details!['current_user']['last_name'], + style: TextStyle(fontSize: 20.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + Text( + studentType, + // data.details!['user_branch'] + ' | ' + "STUDENT", + // style: TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ) + ], + )); } } From d98bd2688eca313d55e3cf30fe45516bc3bf63fe Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Fri, 3 Feb 2023 12:45:15 +0530 Subject: [PATCH 08/15] Ui ux for student --- db/Department_AboutUs.csv | 16 ++ lib/main.dart | 3 + lib/screens/Department/AboutUs.dart | 37 +++++ .../Department/DepartmentHomepage.dart | 147 +++++++++++++++++- 4 files changed, 201 insertions(+), 2 deletions(-) create mode 100644 db/Department_AboutUs.csv create mode 100644 lib/screens/Department/AboutUs.dart diff --git a/db/Department_AboutUs.csv b/db/Department_AboutUs.csv new file mode 100644 index 00000000..e4f2cdf4 --- /dev/null +++ b/db/Department_AboutUs.csv @@ -0,0 +1,16 @@ +"Our Mission"," +The mission of the Computer Engineering Department +is to provide education programs that would +encourage students to read critically, reason +analytically. cornm.unicate persuasively. apply +professionally and prepare them to excel in the field +of computing" +"Our Vision ", +"The vision of the computer Engineering Department +is to recognize is to itself as renowned department +in the field of technical education in Computer +Engineering and strives to carry out the superior +level Of research based on the quality. innovation +and excellence; with the help or its stakeholder vil. +the students, research scholars. Facuty members, +the staff and the Alumni." \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 46859aaf..bd46a1df 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -43,6 +43,7 @@ import 'package:fusion/screens/Healthcenter/history.dart'; import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/screens/Department/DepartmentHomepage.dart'; +import 'package:fusion/screens/Department/AboutUs.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -114,6 +115,8 @@ class MyApp extends StatelessWidget { '/health_center/feedback': (context) => FeedBack(), '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), + '/department_homepage': (context) => DepartmentHomepage(), + '/department_aboutus': (context) => AboutUs(), }, ); } diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart new file mode 100644 index 00000000..6a46e651 --- /dev/null +++ b/lib/screens/Department/AboutUs.dart @@ -0,0 +1,37 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; + +class AboutUs extends StatefulWidget { + @override + _AboutUsState createState() => _AboutUsState(); +} + +class _AboutUsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: ListView(children: [ + Row( + children: [ + Text( + " Welcome to CSE Department", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ) + ], + ), + Row( + children: [], + ), + Row() + ])); + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index c0b59ba8..12bbe633 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -4,11 +4,11 @@ import 'package:flutter/material.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/models/profile.dart'; -import 'package:fusion/services/gymkhana_service.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; +import 'package:fusion/screens/Department/AboutUs.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -49,6 +49,8 @@ class _DepartmentHomepageState extends State { @override Widget build(BuildContext context) { + double kHeight = MediaQuery.of(context).size.height; + double kWidth = MediaQuery.of(context).size.width; return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), @@ -95,7 +97,148 @@ class _DepartmentHomepageState extends State { ), ], ), - ) + ), + Container( + height: 0.4 * kHeight, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () { + Navigator.pushNamed( + context, "/department_aboutus"); + }, + child: Column( + children: [ + Icon( + Icons.info, + size: 45.0, + ), + Text('About Us'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.article_rounded, + size: 45.0, + ), + Text('Facilities'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.attribution_outlined, + size: 45.0, + ), + Text('Faculty'), + ], + ), + ), + ], + ), + ), + ], + ), + Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.group, + size: 45.0, + ), + Text('Students'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.volume_down_outlined, + size: 45.0, + ), + Text('Announcements'), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + Icon( + Icons.app_registration, + size: 45.0, + ), + Text('Requests'), + ], + ), + ), + ], + ), + ), + ], + ), + ], + ), + ), ], )); } From db490cd5a6fe2e742dfb76761acf893f29269c3f Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Sun, 12 Feb 2023 19:54:43 +0530 Subject: [PATCH 09/15] Developed UI/UX for About us page and fetched data for cse department --- db/Department_AboutUs.csv | 16 ---- db/Department_AboutUs_cse.csv | 2 + lib/main.dart | 5 +- lib/screens/Department/AboutUs.dart | 76 +++++++++++++++++-- lib/screens/Department/Announcements.dart | 33 ++++++++ .../Department/DepartmentHomepage.dart | 11 ++- 6 files changed, 117 insertions(+), 26 deletions(-) delete mode 100644 db/Department_AboutUs.csv create mode 100644 db/Department_AboutUs_cse.csv create mode 100644 lib/screens/Department/Announcements.dart diff --git a/db/Department_AboutUs.csv b/db/Department_AboutUs.csv deleted file mode 100644 index e4f2cdf4..00000000 --- a/db/Department_AboutUs.csv +++ /dev/null @@ -1,16 +0,0 @@ -"Our Mission"," -The mission of the Computer Engineering Department -is to provide education programs that would -encourage students to read critically, reason -analytically. cornm.unicate persuasively. apply -professionally and prepare them to excel in the field -of computing" -"Our Vision ", -"The vision of the computer Engineering Department -is to recognize is to itself as renowned department -in the field of technical education in Computer -Engineering and strives to carry out the superior -level Of research based on the quality. innovation -and excellence; with the help or its stakeholder vil. -the students, research scholars. Facuty members, -the staff and the Alumni." \ No newline at end of file diff --git a/db/Department_AboutUs_cse.csv b/db/Department_AboutUs_cse.csv new file mode 100644 index 00000000..598da1ab --- /dev/null +++ b/db/Department_AboutUs_cse.csv @@ -0,0 +1,2 @@ +"Our Mission :","The mission of the Computer Engineering Department is to provide education programs that would encourage students to read critically, reason analytically. cormmunicate persuasively. apply professionally and prepare them to excel in the field of computing" +"Our Vision :","The vision of the computer Engineering Department is to recognize is to itself as renowned department in the field of technical education in Computer Engineering and strives to carry out the superior level Of research based on the quality. innovation and excellence; with the help or its stakeholder vil. the students, research scholars. Facuty members, the staff and the Alumni." \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index bd46a1df..e626e110 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -4,6 +4,7 @@ import 'package:fusion/screens/Academic/Add_Drop_Courses/add_drop_courses.dart'; import 'package:fusion/screens/Complaint/ComplaintHistory/complain_history.dart'; import 'package:fusion/screens/Complaint/Feedback/feedback.dart'; import 'package:fusion/screens/Complaint/LodgeComplaint/lodge_complaint.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; import 'package:fusion/screens/Establishment/establishment_home_page.dart'; import 'package:fusion/screens/Library/Book_Search.dart'; import 'package:fusion/screens/Library/dues.dart'; @@ -44,6 +45,7 @@ import 'package:fusion/screens/Healthcenter/HealthCenter.dart'; import 'package:fusion/services/service_locator.dart'; import 'package:fusion/screens/Department/DepartmentHomepage.dart'; import 'package:fusion/screens/Department/AboutUs.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -116,7 +118,8 @@ class MyApp extends StatelessWidget { '/health_center/viewschedule': (context) => ViewSchedule(), '/health_center/history': (context) => History(), '/department_homepage': (context) => DepartmentHomepage(), - '/department_aboutus': (context) => AboutUs(), + '/department_homepage/aboutus': (context) => AboutUs(), + '/department_homepage/announcements': (context) => Announcements(), }, ); } diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index 6a46e651..989dfded 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -2,8 +2,16 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; +import 'package:csv/csv.dart'; +import 'package:flutter/foundation.dart'; class AboutUs extends StatefulWidget { @override @@ -11,27 +19,81 @@ class AboutUs extends StatefulWidget { } class _AboutUsState extends State { + late ProfileService profileService; + late String Department = ""; + late ProfileData data; + bool _loading = true; + List> StaticData = []; + + @override + void initState() { + super.initState(); + profileService = ProfileService(); + getData(); + } + + // ignore: non_constant_identifier_names + _loadCSV_CSE() async { + try { + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_cse.csv'); + StaticData = const CsvToListConverter().convert(staticdata); + } catch (e) { + print(e); + } + } + + getData() async { + try { + Response response = await profileService.getProfile(); + setState(() { + data = ProfileData.fromJson(jsonDecode(response.body)); + _loading = false; + }); + Department = data.profile!['department']!['name']; + if (Department == 'CSE') { + _loadCSV_CSE(); + } + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), body: ListView(children: [ - Row( + Column( children: [ Text( - " Welcome to CSE Department", + " Welcome to " + Department + " Department", style: TextStyle( fontSize: 35, ), textAlign: TextAlign.center, - ) + ), + Wrap(children: [ + StaticData.isEmpty + ? Text("Fetching Data") + : Column(children: [ + for (int i = 0; i < StaticData.length; i++) ...[ + Padding( + padding: EdgeInsets.fromLTRB(10, 30, 10, 10), + child: Text(StaticData[i][0], + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold))), + Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Text(StaticData[i][1], + style: TextStyle(fontSize: 20))), + ] + ]) + ]) ], ), - Row( - children: [], - ), - Row() ])); } } diff --git a/lib/screens/Department/Announcements.dart b/lib/screens/Department/Announcements.dart new file mode 100644 index 00000000..5f718a0b --- /dev/null +++ b/lib/screens/Department/Announcements.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; + +class Announcements extends StatefulWidget { + @override + _AnnouncementsState createState() => _AnnouncementsState(); +} + +class _AnnouncementsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text( + "Welcome to Announcements", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index 12bbe633..2bdddce7 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -9,6 +9,7 @@ import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; import 'package:fusion/screens/Department/AboutUs.dart'; +import 'package:fusion/screens/Department/Announcements.dart'; class DepartmentHomepage extends StatefulWidget { @override @@ -19,6 +20,7 @@ class _DepartmentHomepageState extends State { late String name = ""; late String studentType = ""; late ProfileData data2; + late String user_type = ""; bool _loading = true; late ProfileService profileService; @override @@ -42,6 +44,7 @@ class _DepartmentHomepageState extends State { studentType = data2.profile!['department']!['name'] + ' ' + data2.profile!['user_type']; + user_type = data2.profile!['user_type']; } catch (e) { print(e); } @@ -99,6 +102,7 @@ class _DepartmentHomepageState extends State { ), ), Container( + // UI/UX of student height: 0.4 * kHeight, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -114,7 +118,7 @@ class _DepartmentHomepageState extends State { TextButton( onPressed: () { Navigator.pushNamed( - context, "/department_aboutus"); + context, "/department_homepage/aboutus"); }, child: Column( children: [ @@ -200,7 +204,10 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed(context, + "/department_homepage/announcements"); + }, child: Column( children: [ Icon( From 071e87291c96290c91c45724d56f679a50925a24 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Sun, 12 Feb 2023 20:33:14 +0530 Subject: [PATCH 10/15] fixed minor data fetching issue --- lib/screens/Department/AboutUs.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index 989dfded..1012ce1e 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -30,6 +30,7 @@ class _AboutUsState extends State { super.initState(); profileService = ProfileService(); getData(); + _loadCSV_CSE(); } // ignore: non_constant_identifier_names From 4c1b0b3dd49676b40c155aa76993dbeb4305c1f1 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Fri, 14 Apr 2023 10:09:55 +0530 Subject: [PATCH 11/15] Completed announcements functionality( both post and fetch)) --- db/Department_AboutUs_ece.csv | 2 + db/Department_AboutUs_me.csv | 2 + db/Department_AboutUs_sm.csv | 2 + lib/Components/faculty_card.dart | 62 ++++ lib/api.dart | 4 + lib/main.dart | 15 +- lib/models/department.dart | 45 +++ lib/models/department_announcement.dart | 37 -- lib/screens/Department/AboutUs.dart | 111 +++--- lib/screens/Department/Achievements.dart | 33 ++ lib/screens/Department/Alumni.dart | 33 ++ lib/screens/Department/Announcements.dart | 327 +++++++++++++++++- .../Department/DepartmentHomepage.dart | 121 +++++-- lib/screens/Department/Facilities.dart | 28 ++ lib/screens/Department/Faculty.dart | 76 ++++ lib/screens/Department/PostAnnouncement.dart | 149 ++++++++ lib/screens/Department/Students.dart | 33 ++ lib/services/announcement_service.dart | 78 +++++ lib/services/profile_service.dart | 1 + pubspec.yaml | 4 + 20 files changed, 1040 insertions(+), 123 deletions(-) create mode 100644 db/Department_AboutUs_ece.csv create mode 100644 db/Department_AboutUs_me.csv create mode 100644 db/Department_AboutUs_sm.csv create mode 100644 lib/Components/faculty_card.dart create mode 100644 lib/models/department.dart delete mode 100644 lib/models/department_announcement.dart create mode 100644 lib/screens/Department/Achievements.dart create mode 100644 lib/screens/Department/Alumni.dart create mode 100644 lib/screens/Department/Facilities.dart create mode 100644 lib/screens/Department/Faculty.dart create mode 100644 lib/screens/Department/PostAnnouncement.dart create mode 100644 lib/screens/Department/Students.dart create mode 100644 lib/services/announcement_service.dart diff --git a/db/Department_AboutUs_ece.csv b/db/Department_AboutUs_ece.csv new file mode 100644 index 00000000..c4daa6ed --- /dev/null +++ b/db/Department_AboutUs_ece.csv @@ -0,0 +1,2 @@ +"Our Mission :","The discipline of Electronics and Communication Engineering (ECE) has a perfect combination of teaching and research activities pertaining to field of Electronics and Communication. Since its inception the main objective of discipline is to impart quality education, hands-on training and research in the frontier areas of Electronics & Communication Engineering with broad focus on IT enabled design and manufacturing." +"Our Vision :","The vision of ECE department is to become pioneer in higher learning and research and to produce creative solution to societal needs. To provide excellence in education, research and public service. To provide quality education and to make the students entrepreneur and employable." \ No newline at end of file diff --git a/db/Department_AboutUs_me.csv b/db/Department_AboutUs_me.csv new file mode 100644 index 00000000..b05c18bc --- /dev/null +++ b/db/Department_AboutUs_me.csv @@ -0,0 +1,2 @@ +"Our Mission :","The primary focus of our pedagogy is to impart technical know-how to students, promote their problem solving and innovation skills and make them abreast with new technologies. The department offers a wide spectrum of optional courses to the students to pursue their interest. The course contents are periodically updated to keep them inline with the global developments. Undergraduate students are encouraged for hands-on-training, in the form of course projects and participate in various sponsored research projects." +"Our Vision :","The vision of the mechanical Engineering Department is to recognize itself as renowned department in the field of Research and technical education in Mechanical Engineering and strives to carry out the superior level of research based on the quality, innovation and excellence; with the help of its stakeholders viz. the students, research scholars, faculty members, the support staff and the alumni." \ No newline at end of file diff --git a/db/Department_AboutUs_sm.csv b/db/Department_AboutUs_sm.csv new file mode 100644 index 00000000..1805556f --- /dev/null +++ b/db/Department_AboutUs_sm.csv @@ -0,0 +1,2 @@ +"Our Mission :","The programme is designed to provide various tools and techniques associated with IoT, IIoT, Information and Computing Technology (ICT) and System Engineering, with special focus on additive manufacturing (AM) or 3D printing and near net shape manufacturing processes." +"Our Vision :","This programme focuses on some of the disruptive innovations that the last decade has been witnessed to, namely, Internet of Things (IoT), Robotics, Additive Manufacturing (3D Printing), Industrial Automation, Artificial Intelligence, Machine Learning, etc. These technologies have a huge potential to shape the future of mankind. Smart manufacturing, being an important aspect of the Industrial Internet of Things (IIoT) is the next industrial revolution. Smart manufacturing integrates data and information from multiple open and vendor applications and products to form new solutions. It can be applied to a single machine line, an entire factory or across a network of manufacturers, suppliers and customers. This new area of innovation will optimize the entire manufacturing industry to create higher quality products at lower prices, improve productivity, increase energy efficiency, and sustain safer plants." \ No newline at end of file diff --git a/lib/Components/faculty_card.dart b/lib/Components/faculty_card.dart new file mode 100644 index 00000000..d541d8ce --- /dev/null +++ b/lib/Components/faculty_card.dart @@ -0,0 +1,62 @@ +import 'package:flutter/material.dart'; + +class FacultyCard extends StatelessWidget { + final String name; + final String email; + final String department; + final String researchInterest; + + const FacultyCard({ + Key? key, + required this.name, + required this.email, + required this.department, + required this.researchInterest, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Flexible( + child: SizedBox( + height: 300, + child: Card( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20.0), + ), + margin: EdgeInsets.all(10.0), + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CircleAvatar( + radius: 40.0, + backgroundImage: AssetImage('assets/unknown.jpg'), + ), + const SizedBox(height: 8), + Text( + name, + style: Theme.of(context).textTheme.headline6, + ), + const SizedBox(height: 8), + Text( + email, + style: Theme.of(context).textTheme.subtitle1, + ), + const SizedBox(height: 8), + Text( + department, + style: Theme.of(context).textTheme.subtitle1, + ), + const SizedBox(height: 8), + Text( + researchInterest, + style: Theme.of(context).textTheme.subtitle1, + ), + ], + ), + ), + ), + )); + } +} diff --git a/lib/api.dart b/lib/api.dart index 802bee2d..fd7dacf5 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -29,6 +29,10 @@ const kGymkhanaMemberRecords = '/api/gymkhana/members_record'; //HealthCentre String kHealthCentreStudent = "/healthcenter/api/student"; +//Department +String kFetchAnnouncement = "/dep/fetchAnnouncements/"; +String kAddNewAnnouncement = "/dep/addNewAnnouncement/"; + //------------Screens------------ //screens/Academic/Current_Semester diff --git a/lib/main.dart b/lib/main.dart index e626e110..55b0a8a0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -46,6 +46,12 @@ import 'package:fusion/services/service_locator.dart'; import 'package:fusion/screens/Department/DepartmentHomepage.dart'; import 'package:fusion/screens/Department/AboutUs.dart'; import 'package:fusion/screens/Department/Announcements.dart'; +import 'package:fusion/screens/Department/Achievements.dart'; +import 'package:fusion/screens/Department/Students.dart'; +import 'package:fusion/screens/Department/Faculty.dart'; +import 'package:fusion/screens/Department/Alumni.dart'; +import 'package:fusion/screens/Department/Facilities.dart'; +import 'package:fusion/screens/Department/PostAnnouncement.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -119,7 +125,14 @@ class MyApp extends StatelessWidget { '/health_center/history': (context) => History(), '/department_homepage': (context) => DepartmentHomepage(), '/department_homepage/aboutus': (context) => AboutUs(), - '/department_homepage/announcements': (context) => Announcements(), + '/department_homepage/announcements': (context) => AnnouncementTable(), + '/department_homepage/faculty': (context) => Faculty(), + '/department_homepage/achievements': (context) => Achievements(), + '/department_homepage/students': (context) => Students(), + '/department_homepage/facilities': (context) => Facilities(), + '/department_homepage/alumni': (context) => Alumni(), + '/department_homepage/postannouncement': (context) => + PostAnnouncement(), }, ); } diff --git a/lib/models/department.dart b/lib/models/department.dart new file mode 100644 index 00000000..d2d5bb16 --- /dev/null +++ b/lib/models/department.dart @@ -0,0 +1,45 @@ +class Announcements { + final String makerId; + final DateTime annDate; + final String message; + final String batch; + final String department; + final String programme; + final String? uploadAnnouncement; + final String id; + + Announcements({ + required this.makerId, + required this.annDate, + required this.message, + required this.batch, + required this.department, + required this.programme, + this.uploadAnnouncement, + required this.id, + }); + + factory Announcements.fromJson(Map json) { + return Announcements( + makerId: json['maker_id'], + annDate: DateTime.parse(json['ann_date']), + message: json['message'], + batch: json['batch'], + department: json['department'], + programme: json['programme'], + uploadAnnouncement: json['upload_announcement'], + id: json['id'].toString(), + ); + } + + Map toJson() => { + 'maker_id': makerId, + 'ann_date': annDate.toIso8601String(), + 'message': message, + 'batch': batch, + 'department': department, + 'programme': programme, + 'upload_announcement': uploadAnnouncement, + 'id': id, + }; +} diff --git a/lib/models/department_announcement.dart b/lib/models/department_announcement.dart deleted file mode 100644 index 62d0c079..00000000 --- a/lib/models/department_announcement.dart +++ /dev/null @@ -1,37 +0,0 @@ -class DepartmentAnnouncements { - String? maker_id; - DateTime? ann_date; - String? message; - String? batch; - String? department; - String? programme; - - DepartmentAnnouncements({ - this.maker_id, //id of announcement maker - this.ann_date, //announcement date and time - this.message, //message in the announcement - this.batch, - this.department, - this.programme, - }); - factory DepartmentAnnouncements.fromJson(json) { - return DepartmentAnnouncements( - maker_id: json["maker_id"], - ann_date: DateTime.parse(json["timestamp"]), - message: json["message"], - batch: json["batch"], - department: json["department"], - programme: json["programme"], - ); - } - Map toJson() { - return { - "maker_id": this.maker_id, - "ann_date": this.ann_date, - "message": this.message, - "batch": this.batch, - "department": this.department, - "programme": this.programme, - }; - } -} diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index 1012ce1e..ea76c784 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -29,31 +29,31 @@ class _AboutUsState extends State { void initState() { super.initState(); profileService = ProfileService(); - getData(); - _loadCSV_CSE(); } // ignore: non_constant_identifier_names - _loadCSV_CSE() async { - try { - final staticdata = - await rootBundle.loadString('db/Department_AboutUs_cse.csv'); - StaticData = const CsvToListConverter().convert(staticdata); - } catch (e) { - print(e); - } - } - getData() async { + Future getData() async { try { Response response = await profileService.getProfile(); - setState(() { - data = ProfileData.fromJson(jsonDecode(response.body)); - _loading = false; - }); + data = ProfileData.fromJson(jsonDecode(response.body)); Department = data.profile!['department']!['name']; if (Department == 'CSE') { - _loadCSV_CSE(); + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_cse.csv'); + StaticData = const CsvToListConverter().convert(staticdata); + } else if (Department == 'ME') { + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_me.csv'); + StaticData = const CsvToListConverter().convert(staticdata); + } else if (Department == 'SM') { + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_sm.csv'); + StaticData = const CsvToListConverter().convert(staticdata); + } else if (Department == 'ECE') { + final staticdata = + await rootBundle.loadString('db/Department_AboutUs_ece.csv'); + StaticData = const CsvToListConverter().convert(staticdata); } } catch (e) { print(e); @@ -63,38 +63,51 @@ class _AboutUsState extends State { @override Widget build(BuildContext context) { return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: ListView(children: [ - Column( - children: [ - Text( - " Welcome to " + Department + " Department", - style: TextStyle( - fontSize: 35, + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error loading data')); + } else { + return ListView(children: [ + Column( + children: [ + Text( + " Welcome to " + Department + " Department", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + Wrap(children: [ + StaticData.isEmpty + ? Text("Fetching Data") + : Column(children: [ + for (int i = 0; i < StaticData.length; i++) ...[ + Padding( + padding: + EdgeInsets.fromLTRB(10, 30, 10, 10), + child: Text(StaticData[i][0], + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold))), + Padding( + padding: + EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Text(StaticData[i][1], + style: TextStyle(fontSize: 20))), + ] + ]) + ]) + ], ), - textAlign: TextAlign.center, - ), - Wrap(children: [ - StaticData.isEmpty - ? Text("Fetching Data") - : Column(children: [ - for (int i = 0; i < StaticData.length; i++) ...[ - Padding( - padding: EdgeInsets.fromLTRB(10, 30, 10, 10), - child: Text(StaticData[i][0], - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold))), - Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Text(StaticData[i][1], - style: TextStyle(fontSize: 20))), - ] - ]) - ]) - ], - ), - ])); + ]); + } + }), + ); } } diff --git a/lib/screens/Department/Achievements.dart b/lib/screens/Department/Achievements.dart new file mode 100644 index 00000000..ef3906a8 --- /dev/null +++ b/lib/screens/Department/Achievements.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; + +class Achievements extends StatefulWidget { + @override + _AchievementsState createState() => _AchievementsState(); +} + +class _AchievementsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text( + "Welcome to Achievements", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/screens/Department/Alumni.dart b/lib/screens/Department/Alumni.dart new file mode 100644 index 00000000..00115157 --- /dev/null +++ b/lib/screens/Department/Alumni.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; + +class Alumni extends StatefulWidget { + @override + _AlumniState createState() => _AlumniState(); +} + +class _AlumniState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text( + "Welcome to Alumni", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/screens/Department/Announcements.dart b/lib/screens/Department/Announcements.dart index 5f718a0b..642e04d2 100644 --- a/lib/screens/Department/Announcements.dart +++ b/lib/screens/Department/Announcements.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/services/service_locator.dart'; @@ -9,24 +10,332 @@ import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:fusion/models/profile.dart'; import 'package:http/http.dart'; +import 'package:csv/csv.dart'; +import 'package:flutter/foundation.dart'; +import 'package:fusion/models/department.dart'; +import 'package:fusion/services/announcement_service.dart'; +import 'package:fusion/Components/pdf_view.dart'; -class Announcements extends StatefulWidget { +class AnnouncementTable extends StatefulWidget { @override - _AnnouncementsState createState() => _AnnouncementsState(); + _AnnouncementTableState createState() => _AnnouncementTableState(); } -class _AnnouncementsState extends State { +class _AnnouncementTableState extends State { + late Future> _announcementsFuture; + bool _loading = true; + late ProfileService profileService; + late String user_type = ""; + late ProfileData data2; + late AnnouncementService announcementService; + // late Announcements announcementsData; + @override + void initState() { + super.initState(); + profileService = + ProfileService(); // calling profile service to get user's data + announcementService = AnnouncementService(); + getData(); + print(user_type); + _announcementsFuture = _fetchAnnouncements(); + } + + getData() async { + try { + Response response2 = await profileService.getProfile(); + setState(() { + data2 = ProfileData.fromJson(jsonDecode(response2.body)); + _loading = false; + }); + + user_type = data2.profile!['user_type']; + } catch (e) { + print(e); + } + } + + Future> _fetchAnnouncements() async { + // fetch the announcements from the server + // replace this with your actual API call + print("___trying to fetch data"); + late Future> data = + announcementService.fetchAnnouncements(); + print(data); + await Future.delayed(Duration(seconds: 2)); // simulate network delay + if (data != null) + return data; + else + return [ + Announcements( + makerId: "Atul Gupta", + annDate: DateTime.parse('2023-04-01T12:00:00Z'), + message: "Lorem ipsum dolor sit amet.", + batch: "2021", + department: "Computer Science", + programme: "B.Tech", + uploadAnnouncement: "https://example.com/announcement1.pdf", + id: '1', + ), + Announcements( + makerId: "Irshad Ahmad Ansari", + annDate: DateTime.parse('2023-04-02T12:00:00Z'), + message: "Consectetur adipiscing elit.", + batch: "2022", + department: "Information Technology", + programme: "M.Tech", + uploadAnnouncement: null, + id: '1', + ), + Announcements( + makerId: "V.K Jain", + annDate: DateTime.parse('2023-04-03T12:00:00Z'), + message: + "Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", + batch: "2023", + department: "Data Science", + programme: "Ph.D", + uploadAnnouncement: "https://example.com/announcement3.pdf", + id: '1', + ), + ]; + } + @override Widget build(BuildContext context) { return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), - body: Text( - "Welcome to Announcements", - style: TextStyle( - fontSize: 35, - ), - textAlign: TextAlign.center, + body: Center( + child: Column(children: [ + if (user_type == 'faculty' || user_type == 'Admin') ...[ + TextButton( + style: ButtonStyle( + backgroundColor: MaterialStateProperty.all( + Color.fromARGB(255, 102, 243, 106)), + foregroundColor: MaterialStateProperty.all( + Color.fromARGB(255, 251, 253, 254)), + ), + onPressed: () { + Navigator.pushNamed( + context, "/department_homepage/postannouncement"); + }, + child: Text( + "Post Announcement", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + )) + ], + Expanded( + child: FutureBuilder>( + future: _announcementsFuture, + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + // show a loading indicator while fetching the announcements + return CircularProgressIndicator(); + } else if (snapshot.hasError) { + // show an error message if there was an error fetching the announcements + return Text("Error: ${snapshot.error}"); + } else { + // show the table of announcements + final announcements = snapshot.data!; + return SingleChildScrollView( + scrollDirection: Axis.vertical, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: DataTable( + columns: [ + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Announcement Date", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + numeric: true, + ), + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Announcement By", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + numeric: true, + ), + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Programme", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + numeric: true, + ), + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Batch", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + numeric: true, + ), + DataColumn( + label: Flexible( + child: SizedBox( + width: 200, // set the desired width + child: Text( + "Message", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "File", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + numeric: true, + ), + ], + rows: announcements.map((announcement) { + return DataRow(cells: [ + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.annDate.toString(), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.makerId, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.programme, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.batch, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataCell( + Flexible( + child: SizedBox( + width: 200, // set the desired width + child: Text( + announcement.message, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), + ), + ), + DataCell(Flexible( + child: SizedBox( + width: 100, // set the desired width + child: announcement.uploadAnnouncement != null + ? ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PDFViewerFromUrl( + url: announcement + .uploadAnnouncement ?? + "", + label: announcement.message, + ), + ), + ); + }, + child: Text('view'), + ) + : Text("N/A"), + ), + )), + ]); + }).toList(), + ), + ), + ); + } + }, + )) + ]), ), ); } diff --git a/lib/screens/Department/DepartmentHomepage.dart b/lib/screens/Department/DepartmentHomepage.dart index 2bdddce7..527af6dd 100644 --- a/lib/screens/Department/DepartmentHomepage.dart +++ b/lib/screens/Department/DepartmentHomepage.dart @@ -1,21 +1,22 @@ import 'dart:async'; +import 'package:fusion/constants.dart'; import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/models/profile.dart'; -import 'package:fusion/services/service_locator.dart'; -import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:http/http.dart'; -import 'package:fusion/screens/Department/AboutUs.dart'; -import 'package:fusion/screens/Department/Announcements.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class DepartmentHomepage extends StatefulWidget { @override _DepartmentHomepageState createState() => _DepartmentHomepageState(); } +Color textColor = Colors.black; + class _DepartmentHomepageState extends State { late String name = ""; late String studentType = ""; @@ -26,11 +27,11 @@ class _DepartmentHomepageState extends State { @override void initState() { super.initState(); - // _dashboardController = StreamController(); - // dashboardService = DashboardService(); - // _profileController = StreamController(); - profileService = ProfileService(); - getData(); + + profileService = + ProfileService(); // calling profile service to get user's data + + getData(); // storing user's data in their respective variables } getData() async { @@ -40,6 +41,7 @@ class _DepartmentHomepageState extends State { data2 = ProfileData.fromJson(jsonDecode(response2.body)); _loading = false; }); + name = data2.user!['first_name'] + ' ' + data2.user!['last_name']; studentType = data2.profile!['department']!['name'] + ' ' + @@ -82,18 +84,15 @@ class _DepartmentHomepageState extends State { Text( //NAME OF USER name, - // data.details!['current_user']['first_name'] + - // ' ' + - // data.details!['current_user']['last_name'], + style: TextStyle(fontSize: 20.0, color: Colors.black), ), SizedBox( height: 10.0, ), Text( + // users brnch and role(faculty/ student /admin) studentType, - // data.details!['user_branch'] + ' | ' + "STUDENT", - // style: TextStyle(fontSize: 15.0, color: Colors.black), ), SizedBox( height: 10.0, @@ -102,8 +101,7 @@ class _DepartmentHomepageState extends State { ), ), Container( - // UI/UX of student - height: 0.4 * kHeight, + height: 0.5 * kHeight, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ @@ -124,9 +122,11 @@ class _DepartmentHomepageState extends State { children: [ Icon( Icons.info, + color: kPrimaryColor, size: 45.0, ), - Text('About Us'), + Text('About Us', + style: TextStyle(color: textColor)), ], ), ), @@ -139,14 +139,19 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed( + context, "/department_homepage/facilities"); + }, child: Column( children: [ Icon( Icons.article_rounded, + color: kPrimaryColor, size: 45.0, ), - Text('Facilities'), + Text('Facilities', + style: TextStyle(color: textColor)), ], ), ), @@ -159,14 +164,44 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed( + context, "/department_homepage/faculty"); + }, child: Column( children: [ Icon( Icons.attribution_outlined, + color: kPrimaryColor, + size: 45.0, + ), + Text('Faculty', + style: TextStyle(color: textColor)), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () { + Navigator.pushNamed(context, + "/department_homepage/achievements"); + }, + child: Column( + children: [ + Icon( + Icons.emoji_events, + color: kPrimaryColor, size: 45.0, ), - Text('Faculty'), + Text('Achievements', + style: TextStyle(color: textColor)), ], ), ), @@ -184,14 +219,19 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed( + context, "/department_homepage/students"); + }, child: Column( children: [ Icon( Icons.group, + color: kPrimaryColor, size: 45.0, ), - Text('Students'), + Text('Students', + style: TextStyle(color: textColor)), ], ), ), @@ -212,9 +252,11 @@ class _DepartmentHomepageState extends State { children: [ Icon( Icons.volume_down_outlined, + color: kPrimaryColor, size: 45.0, ), - Text('Announcements'), + Text('Announcements', + style: TextStyle(color: textColor)), ], ), ), @@ -227,14 +269,39 @@ class _DepartmentHomepageState extends State { child: Column( children: [ TextButton( - onPressed: () {}, + onPressed: () { + Navigator.pushNamed( + context, "/department_homepage/alumni"); + }, child: Column( children: [ Icon( - Icons.app_registration, + FontAwesomeIcons.graduationCap, + color: kPrimaryColor, size: 45.0, ), - Text('Requests'), + Text('Alumni', + style: TextStyle(color: textColor)), + ], + ), + ), + ], + ), + ), + SizedBox( + height: 80.0, + width: 150.0, + child: Column( + children: [ + TextButton( + onPressed: () {}, + child: Column( + children: [ + // Icon( + // Icons.app_registration, + // size: 45.0, + // ), + Text(''), ], ), ), diff --git a/lib/screens/Department/Facilities.dart b/lib/screens/Department/Facilities.dart new file mode 100644 index 00000000..16e369e3 --- /dev/null +++ b/lib/screens/Department/Facilities.dart @@ -0,0 +1,28 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; +// import 'package:my_app/html_view.dart'; + +class Facilities extends StatefulWidget { + @override + _FacilitiesState createState() => _FacilitiesState(); +} + +class _FacilitiesState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: HtmlWidget("
hello world
")); + } +} diff --git a/lib/screens/Department/Faculty.dart b/lib/screens/Department/Faculty.dart new file mode 100644 index 00000000..a5df74da --- /dev/null +++ b/lib/screens/Department/Faculty.dart @@ -0,0 +1,76 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; +import 'package:fusion/Components/faculty_card.dart'; + +class Faculty extends StatefulWidget { + @override + _FacultyState createState() => _FacultyState(); +} + +class _FacultyState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Container( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ), + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ), + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ) + ], + ), + ))); + } +} diff --git a/lib/screens/Department/PostAnnouncement.dart b/lib/screens/Department/PostAnnouncement.dart new file mode 100644 index 00000000..b651e2df --- /dev/null +++ b/lib/screens/Department/PostAnnouncement.dart @@ -0,0 +1,149 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:file_picker/file_picker.dart'; +import 'package:fusion/services/announcement_service.dart'; + +class PostAnnouncement extends StatefulWidget { + @override + _PostAnnouncementState createState() => _PostAnnouncementState(); +} + +class _PostAnnouncementState extends State { + List _programmeTypes = [ + 'B.Tech', + "B.Des", + 'M.Tech', + 'M.Des', + 'PhD', + ]; + late String _selectedProgrammeType = _programmeTypes[0]; + + List _batches = ["2018", "2019", "2020", "2021", "2022"]; + late String _selectedBatch = _batches[0]; + + List _departments = ["CSE", "ME", "ECE", "SM", "DS"]; + late String _selectedDepartment = _departments[0]; + late AnnouncementService announcementService; + String _announcementDetails = ''; + String? _uploadedFileUrl; + @override + void initState() { + super.initState(); + // calling profile service to get user's data + announcementService = AnnouncementService(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Programme Type:'), + DropdownButton( + value: _selectedProgrammeType, + onChanged: (String? newValue) { + setState(() { + _selectedProgrammeType = newValue!; + }); + }, + items: _programmeTypes.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 16.0), + Text('Batch:'), + DropdownButton( + value: _selectedBatch, + onChanged: (String? newValue) { + setState(() { + _selectedBatch = newValue!; + }); + }, + items: _batches.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 16.0), + Text('Department:'), + DropdownButton( + value: _selectedDepartment, + onChanged: (String? newValue) { + setState(() { + _selectedDepartment = newValue!; + }); + }, + items: _departments.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 16.0), + Text('Announcement Details:'), + TextFormField( + onChanged: (value) { + _announcementDetails = value; + }, + maxLines: 5, + decoration: InputDecoration( + hintText: 'Enter announcement details', + ), + ), + SizedBox(height: 16.0), + Text('Upload File:'), + ElevatedButton( + onPressed: () async { + final result = await FilePicker.platform.pickFiles(); + if (result != null) { + setState(() { + _uploadedFileUrl = result.files.single.path; + }); + } else { + print("file not picked"); + } + }, + child: Text('Choose File'), + ), + SizedBox(height: 16.0), + _uploadedFileUrl != null + ? Text('File uploaded successfully!') + : Container(), + SizedBox(height: 32.0), + ElevatedButton( + onPressed: () { + _publishAnnouncement(); + }, + child: Text('Publish'), + ), + ], + ), + ), + ); + } + + void _publishAnnouncement() { + announcementService.addNewAnnouncement( + _selectedBatch, + _selectedProgrammeType, + _selectedDepartment, + _announcementDetails, + _uploadedFileUrl); + // print("tried"); + } +} diff --git a/lib/screens/Department/Students.dart b/lib/screens/Department/Students.dart new file mode 100644 index 00000000..91d0210f --- /dev/null +++ b/lib/screens/Department/Students.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'dart:convert'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:fusion/Components/appBar.dart'; +import 'package:fusion/Components/side_drawer.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:fusion/services/profile_service.dart'; +import 'package:fusion/models/profile.dart'; +import 'package:http/http.dart'; + +class Students extends StatefulWidget { + @override + _StudentsState createState() => _StudentsState(); +} + +class _StudentsState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Text( + "Welcome to Students", + style: TextStyle( + fontSize: 35, + ), + textAlign: TextAlign.center, + ), + ); + } +} diff --git a/lib/services/announcement_service.dart b/lib/services/announcement_service.dart new file mode 100644 index 00000000..cc4bba94 --- /dev/null +++ b/lib/services/announcement_service.dart @@ -0,0 +1,78 @@ +import 'dart:io'; +import 'dart:typed_data'; +import 'package:http/http.dart' as http; +import 'package:fusion/models/department.dart'; +import 'dart:convert'; +import 'package:fusion/api.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:path/path.dart'; + +class AnnouncementService { + final String baseUrl = "http://172.27.16.214"; + // ignore: non_constant_identifier_names + var token = "069ae2846544200f20f5886b94b54cbe8cfb776e"; + var storage_service = locator(); + + Future> fetchAnnouncements() async { + //storage_service.userInDB?.token ; + // var token = + // storage_service.userInDB?.token; //this is the line for actual token + final response = await http.get(Uri.parse(baseUrl + kFetchAnnouncement), + headers: {'Authorization': 'Token ' + (token ?? "")}); + // print(response.body); + + if (response.statusCode == 200) { + List body = jsonDecode(response.body)['payload']; + List announcements = + body.map((dynamic item) => Announcements.fromJson(item)).toList(); + return announcements; + } else { + throw Exception('Failed to load announcements'); + } + } + + Future addNewAnnouncement( + String batch, + String programme, + String department, + String message, + String? upload_announcement, + ) async { + // var token = storage_service.userInDB?.token; + var request = + http.MultipartRequest('POST', Uri.parse(baseUrl + kAddNewAnnouncement)); + request.headers.addAll({ + 'Authorization': 'Token ${token ?? ""}', + }); + request.fields['batch'] = batch; + request.fields['programme'] = programme; + request.fields['department'] = department; + request.fields['message'] = message; + + if (upload_announcement != null) { + var file = new File(upload_announcement); + var fileStream = http.ByteStream(file.openRead()); + var fileLength = await file.length(); + var fileName = file.path.split('/').last; + var multipartFile = http.MultipartFile( + 'upload_announcement', + fileStream, + fileLength, + filename: fileName, + ); + request.files.add(multipartFile); + } else { + request.fields['upload_announcement'] = ""; + } + + final response = await request.send(); + final responseStr = await response.stream.bytesToString(); + if (response.statusCode == 200) { + // print("done"); + return "Announcement added successfully"; + } else { + throw Exception('Failed to add announcement: $responseStr'); + } + } +} diff --git a/lib/services/profile_service.dart b/lib/services/profile_service.dart index 7214af5a..89ee7fe7 100644 --- a/lib/services/profile_service.dart +++ b/lib/services/profile_service.dart @@ -16,6 +16,7 @@ class ProfileService { Map headers = { 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") }; + print(headers); print("fetching profile"); var client = http.Client(); http.Response response = await client.get( diff --git a/pubspec.yaml b/pubspec.yaml index 49030f0b..4135c27c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,6 +39,10 @@ dependencies: path_provider: ^2.0.8 open_file: ^3.2.1 flutter_html: ^2.2.1 + font_awesome_flutter: ^10.4.0 + flutter_widget_from_html: ^0.9.1 + my_app: ^1.0.0 + file_picker: ^4.6.1 From dbabc50f69699d4999c661260c541ed014583b74 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Fri, 14 Apr 2023 15:48:36 +0530 Subject: [PATCH 12/15] announcement minor changes --- lib/Components/appBar.dart | 3 +- lib/screens/Department/Announcements.dart | 326 ++++++++++--------- lib/screens/Department/Faculty.dart | 101 +++--- lib/screens/Department/PostAnnouncement.dart | 177 +++++----- 4 files changed, 308 insertions(+), 299 deletions(-) diff --git a/lib/Components/appBar.dart b/lib/Components/appBar.dart index 9f4cb686..bdf75464 100644 --- a/lib/Components/appBar.dart +++ b/lib/Components/appBar.dart @@ -8,7 +8,8 @@ class DefaultAppBar { backgroundColor: kPrimaryColor, title: Text( "Dashboard", - style: TextStyle(color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), + style: TextStyle( + color: Colors.white, fontSize: 18, fontWeight: FontWeight.bold), ), actions: [ Padding( diff --git a/lib/screens/Department/Announcements.dart b/lib/screens/Department/Announcements.dart index a591483f..ebc3764c 100644 --- a/lib/screens/Department/Announcements.dart +++ b/lib/screens/Department/Announcements.dart @@ -105,7 +105,9 @@ class _AnnouncementTableState extends State { @override Widget build(BuildContext context) { - return Scaffold( + return SafeArea( + child: Scaffold( + resizeToAvoidBottomInset: false, appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), body: Center( @@ -146,193 +148,195 @@ class _AnnouncementTableState extends State { scrollDirection: Axis.vertical, child: SingleChildScrollView( scrollDirection: Axis.horizontal, - child: DataTable( - columns: [ - DataColumn( - label: Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - "Announcement Date", - style: TextStyle( - fontWeight: FontWeight.bold, + child: Flexible( + fit: FlexFit.loose, + child: DataTable( + columns: [ + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Announcement Date", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), + numeric: true, ), - ), - numeric: true, - ), - DataColumn( - label: Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - "Announcement By", - style: TextStyle( - fontWeight: FontWeight.bold, + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Announcement By", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), + numeric: true, ), - ), - numeric: true, - ), - DataColumn( - label: Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - "Programme", - style: TextStyle( - fontWeight: FontWeight.bold, + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Programme", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), + numeric: true, ), - ), - numeric: true, - ), - DataColumn( - label: Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - "Batch", - style: TextStyle( - fontWeight: FontWeight.bold, + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "Batch", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), + numeric: true, ), - ), - numeric: true, - ), - DataColumn( - label: Flexible( - child: SizedBox( - width: 200, // set the desired width - child: Text( - "Message", - style: TextStyle( - fontWeight: FontWeight.bold, + DataColumn( + label: Flexible( + child: SizedBox( + width: 200, // set the desired width + child: Text( + "Message", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), ), - ), - ), - DataColumn( - label: Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - "File", - style: TextStyle( - fontWeight: FontWeight.bold, + DataColumn( + label: Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + "File", + style: TextStyle( + fontWeight: FontWeight.bold, + ), + overflow: TextOverflow.visible, + softWrap: true, + ), ), - overflow: TextOverflow.visible, - softWrap: true, ), + numeric: true, ), - ), - numeric: true, - ), - ], - rows: announcements.map((announcement) { - return DataRow(cells: [ - DataCell( - Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - announcement.annDate.toString(), - overflow: TextOverflow.visible, - softWrap: true, + ], + rows: announcements.map((announcement) { + return DataRow(cells: [ + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.annDate.toString(), + overflow: TextOverflow.visible, + softWrap: true, + ), + ), ), ), - ), - ), - DataCell( - Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - announcement.makerId, - overflow: TextOverflow.visible, - softWrap: true, + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.makerId, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), ), ), - ), - ), - DataCell( - Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - announcement.programme, - overflow: TextOverflow.visible, - softWrap: true, + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.programme, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), ), ), - ), - ), - DataCell( - Flexible( - child: SizedBox( - width: 100, // set the desired width - child: Text( - announcement.batch, - overflow: TextOverflow.visible, - softWrap: true, + DataCell( + Flexible( + child: SizedBox( + width: 100, // set the desired width + child: Text( + announcement.batch, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), ), ), - ), - ), - DataCell( - Flexible( - child: SizedBox( - width: 200, // set the desired width - child: Text( - announcement.message, - overflow: TextOverflow.visible, - softWrap: true, + DataCell( + Flexible( + child: SizedBox( + width: 200, // set the desired width + child: Text( + announcement.message, + overflow: TextOverflow.visible, + softWrap: true, + ), + ), ), ), - ), - ), - DataCell(Flexible( - child: SizedBox( - width: 100, // set the desired width - child: announcement.uploadAnnouncement != null - ? ElevatedButton( - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - PDFViewerFromUrl( - url: announcement - .uploadAnnouncement ?? - "", - label: announcement.message, - ), - ), - ); - }, - child: Text('view'), - ) - : Text("N/A"), - ), - )), - ]); - }).toList(), - ), + DataCell(Flexible( + child: SizedBox( + width: 100, // set the desired width + child: announcement.uploadAnnouncement != null + ? ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + PDFViewerFromUrl( + url: announcement + .uploadAnnouncement ?? + "", + label: announcement.message, + ), + ), + ); + }, + child: Text('view'), + ) + : Text("N/A"), + ), + )), + ]); + }).toList(), + )), ), ); } @@ -340,6 +344,6 @@ class _AnnouncementTableState extends State { )) ]), ), - ); + )); } } diff --git a/lib/screens/Department/Faculty.dart b/lib/screens/Department/Faculty.dart index a5df74da..4c68e577 100644 --- a/lib/screens/Department/Faculty.dart +++ b/lib/screens/Department/Faculty.dart @@ -19,58 +19,59 @@ class Faculty extends StatefulWidget { class _FacultyState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: Container( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Column( - children: [ - Row( + return SafeArea( + child: Scaffold( + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: Container( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( children: [ - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ), + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ), + Row( + children: [ + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + FacultyCard( + name: 'John Smith', + email: 'john.smith@university.edu', + department: 'Computer Science', + researchInterest: 'Artificial Intelligence'), + ], + ) ], ), - Row( - children: [ - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), - ], - ), - Row( - children: [ - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), - FacultyCard( - name: 'John Smith', - email: 'john.smith@university.edu', - department: 'Computer Science', - researchInterest: 'Artificial Intelligence'), - ], - ) - ], - ), - ))); + )))); } } diff --git a/lib/screens/Department/PostAnnouncement.dart b/lib/screens/Department/PostAnnouncement.dart index b651e2df..8f58a120 100644 --- a/lib/screens/Department/PostAnnouncement.dart +++ b/lib/screens/Department/PostAnnouncement.dart @@ -40,98 +40,101 @@ class _PostAnnouncementState extends State { @override Widget build(BuildContext context) { return Scaffold( + resizeToAvoidBottomInset: false, appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), - body: Padding( - padding: EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Programme Type:'), - DropdownButton( - value: _selectedProgrammeType, - onChanged: (String? newValue) { - setState(() { - _selectedProgrammeType = newValue!; - }); - }, - items: _programmeTypes.map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - SizedBox(height: 16.0), - Text('Batch:'), - DropdownButton( - value: _selectedBatch, - onChanged: (String? newValue) { - setState(() { - _selectedBatch = newValue!; - }); - }, - items: _batches.map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - SizedBox(height: 16.0), - Text('Department:'), - DropdownButton( - value: _selectedDepartment, - onChanged: (String? newValue) { - setState(() { - _selectedDepartment = newValue!; - }); - }, - items: _departments.map((String value) { - return DropdownMenuItem( - value: value, - child: Text(value), - ); - }).toList(), - ), - SizedBox(height: 16.0), - Text('Announcement Details:'), - TextFormField( - onChanged: (value) { - _announcementDetails = value; - }, - maxLines: 5, - decoration: InputDecoration( - hintText: 'Enter announcement details', + body: SingleChildScrollView( + child: Padding( + padding: EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('Programme Type:'), + DropdownButton( + value: _selectedProgrammeType, + onChanged: (String? newValue) { + setState(() { + _selectedProgrammeType = newValue!; + }); + }, + items: _programmeTypes.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 16.0), + Text('Batch:'), + DropdownButton( + value: _selectedBatch, + onChanged: (String? newValue) { + setState(() { + _selectedBatch = newValue!; + }); + }, + items: _batches.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), ), - ), - SizedBox(height: 16.0), - Text('Upload File:'), - ElevatedButton( - onPressed: () async { - final result = await FilePicker.platform.pickFiles(); - if (result != null) { + SizedBox(height: 16.0), + Text('Department:'), + DropdownButton( + value: _selectedDepartment, + onChanged: (String? newValue) { setState(() { - _uploadedFileUrl = result.files.single.path; + _selectedDepartment = newValue!; }); - } else { - print("file not picked"); - } - }, - child: Text('Choose File'), - ), - SizedBox(height: 16.0), - _uploadedFileUrl != null - ? Text('File uploaded successfully!') - : Container(), - SizedBox(height: 32.0), - ElevatedButton( - onPressed: () { - _publishAnnouncement(); - }, - child: Text('Publish'), - ), - ], + }, + items: _departments.map((String value) { + return DropdownMenuItem( + value: value, + child: Text(value), + ); + }).toList(), + ), + SizedBox(height: 16.0), + Text('Announcement Details:'), + TextFormField( + onChanged: (value) { + _announcementDetails = value; + }, + maxLines: 5, + decoration: InputDecoration( + hintText: 'Enter announcement details', + ), + ), + SizedBox(height: 16.0), + Text('Upload File:'), + ElevatedButton( + onPressed: () async { + final result = await FilePicker.platform.pickFiles(); + if (result != null) { + setState(() { + _uploadedFileUrl = result.files.single.path; + }); + } else { + print("file not picked"); + } + }, + child: Text('Choose File'), + ), + SizedBox(height: 16.0), + _uploadedFileUrl != null + ? Text('File uploaded successfully!') + : Container(), + SizedBox(height: 32.0), + ElevatedButton( + onPressed: () { + _publishAnnouncement(); + }, + child: Text('Publish'), + ), + ], + ), ), ), ); From c5a7743616c2f8288ae8ee2387ac6b4d42f8286a Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Sat, 15 Apr 2023 02:31:34 +0530 Subject: [PATCH 13/15] Completed Announcements --- lib/services/announcement_service.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/announcement_service.dart b/lib/services/announcement_service.dart index cc4bba94..f466c633 100644 --- a/lib/services/announcement_service.dart +++ b/lib/services/announcement_service.dart @@ -11,7 +11,7 @@ import 'package:path/path.dart'; class AnnouncementService { final String baseUrl = "http://172.27.16.214"; // ignore: non_constant_identifier_names - var token = "069ae2846544200f20f5886b94b54cbe8cfb776e"; + var token = "134712e89ec9dce6dc7b6c2313a7c0b7d5a82128"; var storage_service = locator(); Future> fetchAnnouncements() async { @@ -39,7 +39,7 @@ class AnnouncementService { String message, String? upload_announcement, ) async { - // var token = storage_service.userInDB?.token; + // var token = storage_service.userInDB?.token; //this is the line for actual token var request = http.MultipartRequest('POST', Uri.parse(baseUrl + kAddNewAnnouncement)); request.headers.addAll({ From 94f28e101e6fd2608ac90cda2068557ec2ac761b Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Tue, 18 Apr 2023 22:33:32 +0530 Subject: [PATCH 14/15] Made AboutUs,facilities,Achievements --- db/Dep/about/CSE.html | 17 ++ db/Dep/about/DESIGN.html | 17 ++ db/Dep/about/ECE.html | 12 + db/Dep/about/ME.html | 12 + db/Dep/about/SM.html | 12 + db/Dep/achievements/CSE.html | 38 +++ db/Dep/achievements/DESIGN.html | 38 +++ db/Dep/achievements/ECE.html | 38 +++ db/Dep/achievements/ME.html | 38 +++ db/Dep/achievements/SM.html | 38 +++ db/Dep/facilities/CSE.html | 58 ++++ db/Dep/facilities/DESIGN.html | 58 ++++ db/Dep/facilities/ECE.html | 58 ++++ db/Dep/facilities/ME.html | 58 ++++ db/Dep/facilities/SM.html | 58 ++++ lib/screens/Department/AboutUs.dart | 289 ++++++++++++++----- lib/screens/Department/Achievements.dart | 247 +++++++++++++++- lib/screens/Department/Facilities.dart | 241 +++++++++++++++- lib/screens/Department/PostAnnouncement.dart | 1 + pubspec.yaml | 3 + 20 files changed, 1252 insertions(+), 79 deletions(-) create mode 100644 db/Dep/about/CSE.html create mode 100644 db/Dep/about/DESIGN.html create mode 100644 db/Dep/about/ECE.html create mode 100644 db/Dep/about/ME.html create mode 100644 db/Dep/about/SM.html create mode 100644 db/Dep/achievements/CSE.html create mode 100644 db/Dep/achievements/DESIGN.html create mode 100644 db/Dep/achievements/ECE.html create mode 100644 db/Dep/achievements/ME.html create mode 100644 db/Dep/achievements/SM.html create mode 100644 db/Dep/facilities/CSE.html create mode 100644 db/Dep/facilities/DESIGN.html create mode 100644 db/Dep/facilities/ECE.html create mode 100644 db/Dep/facilities/ME.html create mode 100644 db/Dep/facilities/SM.html diff --git a/db/Dep/about/CSE.html b/db/Dep/about/CSE.html new file mode 100644 index 00000000..87f4f863 --- /dev/null +++ b/db/Dep/about/CSE.html @@ -0,0 +1,17 @@ +

+ Our Missions : +

+

+ The mission of the Computer Engineering Department is to provide educational programs that would encourage students + to read critically, reason analytically, communicate persuasively, apply professionally and prepare them to excel in + the field of computing. +

+

+ Our Vision : +

+

+ The vision of the Computer Engineering Department is to recognize itself as renowned department in the field of + technical education in Computer Engineering and strives to carry out the superior level of research based on the + quality, innovation and excellence; with the help of its stakeholders viz. the students, research scholars, faculty + members, the support staff and the alumni. +

\ No newline at end of file diff --git a/db/Dep/about/DESIGN.html b/db/Dep/about/DESIGN.html new file mode 100644 index 00000000..87f4f863 --- /dev/null +++ b/db/Dep/about/DESIGN.html @@ -0,0 +1,17 @@ +

+ Our Missions : +

+

+ The mission of the Computer Engineering Department is to provide educational programs that would encourage students + to read critically, reason analytically, communicate persuasively, apply professionally and prepare them to excel in + the field of computing. +

+

+ Our Vision : +

+

+ The vision of the Computer Engineering Department is to recognize itself as renowned department in the field of + technical education in Computer Engineering and strives to carry out the superior level of research based on the + quality, innovation and excellence; with the help of its stakeholders viz. the students, research scholars, faculty + members, the support staff and the alumni. +

\ No newline at end of file diff --git a/db/Dep/about/ECE.html b/db/Dep/about/ECE.html new file mode 100644 index 00000000..7d40697a --- /dev/null +++ b/db/Dep/about/ECE.html @@ -0,0 +1,12 @@ +

+ Our Missions : +

+

+ The discipline of Electronics and Communication Engineering (ECE) has a perfect combination of teaching and research activities pertaining to field of Electronics and Communication. Since its inception the main objective of discipline is to impart quality education, hands-on training and research in the frontier areas of Electronics & Communication Engineering with broad focus on IT enabled design and manufacturing. +

+

+ Our Vision : +

+

+ The vision of ECE department is to become pioneer in higher learning and research and to produce creative solution to societal needs. To provide excellence in education, research and public service. To provide quality education and to make the students entrepreneur and employable. +

\ No newline at end of file diff --git a/db/Dep/about/ME.html b/db/Dep/about/ME.html new file mode 100644 index 00000000..5213aebd --- /dev/null +++ b/db/Dep/about/ME.html @@ -0,0 +1,12 @@ +

+ Our Missions : +

+

+ The primary focus of our pedagogy is to impart technical know-how to students, promote their problem solving and innovation skills and make them abreast with new technologies. The department offers a wide spectrum of optional courses to the students to pursue their interest. The course contents are periodically updated to keep them inline with the global developments. Undergraduate students are encouraged for hands-on-training, in the form of course projects and participate in various sponsored research projects. +

+

+ Our Vision : +

+

+ The vision of the mechanical Engineering Department is to recognize itself as renowned department in the field of Research and technical education in Mechanical Engineering and strives to carry out the superior level of research based on the quality, innovation and excellence; with the help of its stakeholders viz. the students, research scholars, faculty members, the support staff and the alumni. +

\ No newline at end of file diff --git a/db/Dep/about/SM.html b/db/Dep/about/SM.html new file mode 100644 index 00000000..1d582b5e --- /dev/null +++ b/db/Dep/about/SM.html @@ -0,0 +1,12 @@ +

+ Our Missions : +

+

+ The programme is designed to provide various tools and techniques associated with IoT, IIoT, Information and Computing Technology (ICT) and System Engineering, with special focus on additive manufacturing (AM) or 3D printing and near net shape manufacturing processes. +

+

+ Our Vision : +

+

+ This programme focuses on some of the disruptive innovations that the last decade has been witnessed to, namely, Internet of Things (IoT), Robotics, Additive Manufacturing (3D Printing), Industrial Automation, Artificial Intelligence, Machine Learning, etc. These technologies have a huge potential to shape the future of mankind. Smart manufacturing, being an important aspect of the Industrial Internet of Things (IIoT) is the next industrial revolution. Smart manufacturing integrates data and information from multiple open and vendor applications and products to form new solutions. It can be applied to a single machine line, an entire factory or across a network of manufacturers, suppliers and customers. This new area of innovation will optimize the entire manufacturing industry to create higher quality products at lower prices, improve productivity, increase energy efficiency, and sustain safer plants. +

\ No newline at end of file diff --git a/db/Dep/achievements/CSE.html b/db/Dep/achievements/CSE.html new file mode 100644 index 00000000..0c700e5d --- /dev/null +++ b/db/Dep/achievements/CSE.html @@ -0,0 +1,38 @@ +

Achievements

+
    +
  1. +

    + PDPM IIITDMJ Student Team has won the International Chess + Competition, out of 160 teams participated, organized by Collegiate Chess League 2021 +

    +
  2. +
    +
  3. +

    + Ph.D. student Mr. Ravi Yadav working under the guidance of Dr. Ravi Panwar + awarded with "Swachhta Saarthi Fellowship" under the Waste to Wealth Mission of the Government of India, + 2021 +

    +
  4. +
    +
  5. +

    + Ph.D. student Mr. Varun Chaudhary working + under the guidance of Dr. Ravi Panwar won the MP Young Scientist Award with the First Position and was + rewarded with a cash prize of Rs. 25,000 /-, 2021 +

    +
  6. +
    +
  7. +

    + Abhishek Patel student of M.Tech ECE won Silver Medal in Men's Single Fairway Competition in All India + Inter-University Woodball Championship 2019-2020 held at Chandigarh University, Chandigarh from + 04-07Jan,2020 +

    +
  8. +
  9. +

    + fusion is going to be deployed on 30.04.2023. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/achievements/DESIGN.html b/db/Dep/achievements/DESIGN.html new file mode 100644 index 00000000..0c700e5d --- /dev/null +++ b/db/Dep/achievements/DESIGN.html @@ -0,0 +1,38 @@ +

Achievements

+
    +
  1. +

    + PDPM IIITDMJ Student Team has won the International Chess + Competition, out of 160 teams participated, organized by Collegiate Chess League 2021 +

    +
  2. +
    +
  3. +

    + Ph.D. student Mr. Ravi Yadav working under the guidance of Dr. Ravi Panwar + awarded with "Swachhta Saarthi Fellowship" under the Waste to Wealth Mission of the Government of India, + 2021 +

    +
  4. +
    +
  5. +

    + Ph.D. student Mr. Varun Chaudhary working + under the guidance of Dr. Ravi Panwar won the MP Young Scientist Award with the First Position and was + rewarded with a cash prize of Rs. 25,000 /-, 2021 +

    +
  6. +
    +
  7. +

    + Abhishek Patel student of M.Tech ECE won Silver Medal in Men's Single Fairway Competition in All India + Inter-University Woodball Championship 2019-2020 held at Chandigarh University, Chandigarh from + 04-07Jan,2020 +

    +
  8. +
  9. +

    + fusion is going to be deployed on 30.04.2023. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/achievements/ECE.html b/db/Dep/achievements/ECE.html new file mode 100644 index 00000000..0c700e5d --- /dev/null +++ b/db/Dep/achievements/ECE.html @@ -0,0 +1,38 @@ +

Achievements

+
    +
  1. +

    + PDPM IIITDMJ Student Team has won the International Chess + Competition, out of 160 teams participated, organized by Collegiate Chess League 2021 +

    +
  2. +
    +
  3. +

    + Ph.D. student Mr. Ravi Yadav working under the guidance of Dr. Ravi Panwar + awarded with "Swachhta Saarthi Fellowship" under the Waste to Wealth Mission of the Government of India, + 2021 +

    +
  4. +
    +
  5. +

    + Ph.D. student Mr. Varun Chaudhary working + under the guidance of Dr. Ravi Panwar won the MP Young Scientist Award with the First Position and was + rewarded with a cash prize of Rs. 25,000 /-, 2021 +

    +
  6. +
    +
  7. +

    + Abhishek Patel student of M.Tech ECE won Silver Medal in Men's Single Fairway Competition in All India + Inter-University Woodball Championship 2019-2020 held at Chandigarh University, Chandigarh from + 04-07Jan,2020 +

    +
  8. +
  9. +

    + fusion is going to be deployed on 30.04.2023. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/achievements/ME.html b/db/Dep/achievements/ME.html new file mode 100644 index 00000000..0c700e5d --- /dev/null +++ b/db/Dep/achievements/ME.html @@ -0,0 +1,38 @@ +

Achievements

+
    +
  1. +

    + PDPM IIITDMJ Student Team has won the International Chess + Competition, out of 160 teams participated, organized by Collegiate Chess League 2021 +

    +
  2. +
    +
  3. +

    + Ph.D. student Mr. Ravi Yadav working under the guidance of Dr. Ravi Panwar + awarded with "Swachhta Saarthi Fellowship" under the Waste to Wealth Mission of the Government of India, + 2021 +

    +
  4. +
    +
  5. +

    + Ph.D. student Mr. Varun Chaudhary working + under the guidance of Dr. Ravi Panwar won the MP Young Scientist Award with the First Position and was + rewarded with a cash prize of Rs. 25,000 /-, 2021 +

    +
  6. +
    +
  7. +

    + Abhishek Patel student of M.Tech ECE won Silver Medal in Men's Single Fairway Competition in All India + Inter-University Woodball Championship 2019-2020 held at Chandigarh University, Chandigarh from + 04-07Jan,2020 +

    +
  8. +
  9. +

    + fusion is going to be deployed on 30.04.2023. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/achievements/SM.html b/db/Dep/achievements/SM.html new file mode 100644 index 00000000..0c700e5d --- /dev/null +++ b/db/Dep/achievements/SM.html @@ -0,0 +1,38 @@ +

Achievements

+
    +
  1. +

    + PDPM IIITDMJ Student Team has won the International Chess + Competition, out of 160 teams participated, organized by Collegiate Chess League 2021 +

    +
  2. +
    +
  3. +

    + Ph.D. student Mr. Ravi Yadav working under the guidance of Dr. Ravi Panwar + awarded with "Swachhta Saarthi Fellowship" under the Waste to Wealth Mission of the Government of India, + 2021 +

    +
  4. +
    +
  5. +

    + Ph.D. student Mr. Varun Chaudhary working + under the guidance of Dr. Ravi Panwar won the MP Young Scientist Award with the First Position and was + rewarded with a cash prize of Rs. 25,000 /-, 2021 +

    +
  6. +
    +
  7. +

    + Abhishek Patel student of M.Tech ECE won Silver Medal in Men's Single Fairway Competition in All India + Inter-University Woodball Championship 2019-2020 held at Chandigarh University, Chandigarh from + 04-07Jan,2020 +

    +
  8. +
  9. +

    + fusion is going to be deployed on 30.04.2023. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/facilities/CSE.html b/db/Dep/facilities/CSE.html new file mode 100644 index 00000000..a1d5466a --- /dev/null +++ b/db/Dep/facilities/CSE.html @@ -0,0 +1,58 @@ +

+ Central Library: +

+

+ Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The + Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, + Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. + Total number of books in the Institute library by the year 2009-10 are approximately 6742. +

+

+ High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 + Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz + Processor and WiFi Campus etc. +

+

+ Lab Infrastructure : +

+
    +
  1. +

    + Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC + Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical + Machining System, Injection Moulding Machine etc. +

    +
  2. +
    +
  3. +

    + Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 + p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. +

    +
  4. +
    +
  5. +

    + Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter + SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, + Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online + Processing etc. +

    +
  6. +
    +
  7. +

    + Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT + Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse + Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. +

    +
  8. +
    +
  9. +

    + Materials Research Laboratory : This Laboratory contains three important instruments for material + characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force + Microscope (AFM) including SPM, MFM etc. +

    +
  10. +
diff --git a/db/Dep/facilities/DESIGN.html b/db/Dep/facilities/DESIGN.html new file mode 100644 index 00000000..a1d5466a --- /dev/null +++ b/db/Dep/facilities/DESIGN.html @@ -0,0 +1,58 @@ +

+ Central Library: +

+

+ Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The + Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, + Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. + Total number of books in the Institute library by the year 2009-10 are approximately 6742. +

+

+ High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 + Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz + Processor and WiFi Campus etc. +

+

+ Lab Infrastructure : +

+
    +
  1. +

    + Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC + Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical + Machining System, Injection Moulding Machine etc. +

    +
  2. +
    +
  3. +

    + Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 + p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. +

    +
  4. +
    +
  5. +

    + Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter + SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, + Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online + Processing etc. +

    +
  6. +
    +
  7. +

    + Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT + Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse + Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. +

    +
  8. +
    +
  9. +

    + Materials Research Laboratory : This Laboratory contains three important instruments for material + characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force + Microscope (AFM) including SPM, MFM etc. +

    +
  10. +
diff --git a/db/Dep/facilities/ECE.html b/db/Dep/facilities/ECE.html new file mode 100644 index 00000000..a1d5466a --- /dev/null +++ b/db/Dep/facilities/ECE.html @@ -0,0 +1,58 @@ +

+ Central Library: +

+

+ Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The + Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, + Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. + Total number of books in the Institute library by the year 2009-10 are approximately 6742. +

+

+ High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 + Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz + Processor and WiFi Campus etc. +

+

+ Lab Infrastructure : +

+
    +
  1. +

    + Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC + Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical + Machining System, Injection Moulding Machine etc. +

    +
  2. +
    +
  3. +

    + Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 + p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. +

    +
  4. +
    +
  5. +

    + Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter + SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, + Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online + Processing etc. +

    +
  6. +
    +
  7. +

    + Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT + Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse + Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. +

    +
  8. +
    +
  9. +

    + Materials Research Laboratory : This Laboratory contains three important instruments for material + characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force + Microscope (AFM) including SPM, MFM etc. +

    +
  10. +
diff --git a/db/Dep/facilities/ME.html b/db/Dep/facilities/ME.html new file mode 100644 index 00000000..6dc9a860 --- /dev/null +++ b/db/Dep/facilities/ME.html @@ -0,0 +1,58 @@ +

+ Central Library: +

+

+ Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The + Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, + Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. + Total number of books in the Institute library by the year 2009-10 are approximately 6742. +

+

+ High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 + Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz + Processor and WiFi Campus etc. +

+

+ Lab Infrastructure : +

+
    +
  1. +

    + Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC + Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical + Machining System, Injection Moulding Machine etc. +

    +
  2. +
    +
  3. +

    + Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 + p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. +

    +
  4. +
    +
  5. +

    + Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter + SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, + Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online + Processing etc. +

    +
  6. +
    +
  7. +

    + Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT + Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse + Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. +

    +
  8. +
    +
  9. +

    + Materials Research Laboratory : This Laboratory contains three important instruments for material + characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force + Microscope (AFM) including SPM, MFM etc. +

    +
  10. +
\ No newline at end of file diff --git a/db/Dep/facilities/SM.html b/db/Dep/facilities/SM.html new file mode 100644 index 00000000..a1d5466a --- /dev/null +++ b/db/Dep/facilities/SM.html @@ -0,0 +1,58 @@ +

+ Central Library: +

+

+ Institute library has e-resources through INDEST, Science Direct, IEEE, ACM, Springger Link, Nature and ASME. The + Institute also has access to various online research journals & articles like following resources SIAm, AMS, ACS, + Kluwer, APS, Palgrave, INFORMS, Rev.of Scientific Instruments, Appl.Physics Letters and the search engine Scopus. + Total number of books in the Institute library by the year 2009-10 are approximately 6742. +

+

+ High Performance Computing Labortory : Specification of Parallel Cluster (for Central Computing Facility)- JS22 + Blade No.3, 16GB(2*8GB) DDR2 533 Mhz DiMMs, IBM 146GB SAS 10K SFF HDD, IBM blade center JS22 4-core 4.0 Ghz + Processor and WiFi Campus etc. +

+

+ Lab Infrastructure : +

+
    +
  1. +

    + Advanced Manufacturing Laboratory : This Laboratory contains Rapid Prototyping Machine, CNC + Controlled Abrasive Waterjet Machine, CNC Milling Center, CNC Turning Center, Dynamometer, Electro Chemical + Machining System, Injection Moulding Machine etc. +

    +
  2. +
    +
  3. +

    + Biometric Laboratory : This Laboratory contains S Series, H Series, W Series cameras and p6 + p520(Tower Model), p6 p520:8203 Model servers Made by IBM etc. +

    +
  4. +
    +
  5. +

    + Digital Signal Processing and Image Processing Laboratory : This Laboratory contains DSP Starter + SPARTAN-3 kit (DSK), TMS 320C6713 DSK with CCS (Code Composer Studio), Image Daughter Kit with CCD Cameras, + Bloom with DSP, Matrox Imaging Library, Matrox Morphis, Frame Graber Card, Color CCD Camera for online + Processing etc. +

    +
  6. +
    +
  7. +

    + Infrared Imaging Laboratory : This Laboratory contains Radiometeric calibration, Extender rings, NDT + Base Module, Central computing unit with TFT display, Software Modules for Lockin, Transient-and Pulse + Measurement, Module Pulse- and Transient- Thermography, Source for Vibro- Thermography etc. +

    +
  8. +
    +
  9. +

    + Materials Research Laboratory : This Laboratory contains three important instruments for material + characterization which are X-Ray Diffractometer (XRD), Scanning Electron Microscope (SEM) and Atomic Force + Microscope (AFM) including SPM, MFM etc. +

    +
  10. +
diff --git a/lib/screens/Department/AboutUs.dart b/lib/screens/Department/AboutUs.dart index ea76c784..5ddc8275 100644 --- a/lib/screens/Department/AboutUs.dart +++ b/lib/screens/Department/AboutUs.dart @@ -3,6 +3,7 @@ import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/services/service_locator.dart'; @@ -12,6 +13,7 @@ import 'package:fusion/models/profile.dart'; import 'package:http/http.dart'; import 'package:csv/csv.dart'; import 'package:flutter/foundation.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class AboutUs extends StatefulWidget { @override @@ -19,41 +21,44 @@ class AboutUs extends StatefulWidget { } class _AboutUsState extends State { - late ProfileService profileService; - late String Department = ""; - late ProfileData data; - bool _loading = true; - List> StaticData = []; - + String depart = 'CSE'; + String tab = 'about'; + String htmlData = ''; + String fieldData = ''; + bool edit = false; + late String path = ''; + List Departments = ["CSE", "ME", "SM", "ECE", "DESIGN"]; @override void initState() { super.initState(); - profileService = ProfileService(); } - // ignore: non_constant_identifier_names + void changeData() async { + try { + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString(tab + depart, fieldData); + htmlData = fieldData; + // print(fieldData); + // print(htmlData); + } catch (e) { + print(e); + } + } Future getData() async { try { - Response response = await profileService.getProfile(); - data = ProfileData.fromJson(jsonDecode(response.body)); - Department = data.profile!['department']!['name']; - if (Department == 'CSE') { - final staticdata = - await rootBundle.loadString('db/Department_AboutUs_cse.csv'); - StaticData = const CsvToListConverter().convert(staticdata); - } else if (Department == 'ME') { - final staticdata = - await rootBundle.loadString('db/Department_AboutUs_me.csv'); - StaticData = const CsvToListConverter().convert(staticdata); - } else if (Department == 'SM') { - final staticdata = - await rootBundle.loadString('db/Department_AboutUs_sm.csv'); - StaticData = const CsvToListConverter().convert(staticdata); - } else if (Department == 'ECE') { - final staticdata = - await rootBundle.loadString('db/Department_AboutUs_ece.csv'); - StaticData = const CsvToListConverter().convert(staticdata); + SharedPreferences prefs = await SharedPreferences.getInstance(); + if (prefs.containsKey(tab + depart)) { + final Data = prefs.getString(tab + depart); + htmlData = Data!; + fieldData = htmlData; + } else { + final Data = await rootBundle + .loadString('db/Dep/' + tab + '/' + depart + '.html'); + prefs.setString(tab + depart, Data); + // print(depart); + htmlData = Data; + fieldData = htmlData; } } catch (e) { print(e); @@ -62,52 +67,198 @@ class _AboutUsState extends State { @override Widget build(BuildContext context) { + double kHeight = MediaQuery.of(context).size.height; + double kWidth = MediaQuery.of(context).size.width; return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), - body: FutureBuilder( - future: getData(), - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.waiting) { - return Center(child: CircularProgressIndicator()); - } else if (snapshot.hasError) { - return Center(child: Text('Error loading data')); - } else { - return ListView(children: [ - Column( - children: [ - Text( - " Welcome to " + Department + " Department", - style: TextStyle( - fontSize: 35, + body: !edit + ? FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error loading data')); + } else { + return Column( + children: [ + Row( + children: [ + for (int i = 0; i < Departments.length; i++) ...[ + Column( + children: [ + Container( + height: kHeight * 0.05, + width: kWidth * 0.18, + margin: EdgeInsets.all(kWidth * 0.01), + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.black)), + child: Text( + Departments[i], + style: TextStyle( + color: Colors.white, + fontSize: kWidth * 0.025), + ), + onPressed: () => { + // print(Departments[i]), + setState(() { + depart = Departments[i]; + edit = false; + getData(); + }) + }, + ), + ) + ], + ) + ] + ], ), - textAlign: TextAlign.center, - ), - Wrap(children: [ - StaticData.isEmpty - ? Text("Fetching Data") - : Column(children: [ - for (int i = 0; i < StaticData.length; i++) ...[ - Padding( - padding: - EdgeInsets.fromLTRB(10, 30, 10, 10), - child: Text(StaticData[i][0], - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold))), - Padding( - padding: - EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Text(StaticData[i][1], - style: TextStyle(fontSize: 20))), - ] - ]) - ]) - ], - ), - ]); - } - }), + if (!edit) ...[ + Flexible( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + child: Flexible( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(kWidth * 0.05), + child: HtmlWidget( + "

" + + depart + + " Department

" + + htmlData, + textStyle: TextStyle(fontSize: 20)), + ), + Container( + margin: EdgeInsets.all(kHeight * 0.05), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + // print(htmlData), + // updateHtmlFile(htmlData), + setState(() { + print("edit mode on"); + edit = true; + }) + }), + child: Text( + "Edit", + style: TextStyle(fontSize: 50), + )), + ), + ) + ], + )), + ))) + ] else ...[ + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + fieldData = value; + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: + TextStyle(fontSize: 50))), + ), + ) + ], + )), + )) + ] + ], + ); + } + }) + : SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + setState(() { + fieldData = value; + }); + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: TextStyle(fontSize: 50))), + ), + ) + ], + )), + )), ); } } diff --git a/lib/screens/Department/Achievements.dart b/lib/screens/Department/Achievements.dart index ef3906a8..142eefaa 100644 --- a/lib/screens/Department/Achievements.dart +++ b/lib/screens/Department/Achievements.dart @@ -1,7 +1,10 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/services/service_locator.dart'; @@ -9,6 +12,9 @@ import 'package:fusion/services/storage_service.dart'; import 'package:fusion/services/profile_service.dart'; import 'package:fusion/models/profile.dart'; import 'package:http/http.dart'; +import 'package:flutter/services.dart' show rootBundle; +import 'package:path_provider/path_provider.dart'; +import 'package:shared_preferences/shared_preferences.dart'; class Achievements extends StatefulWidget { @override @@ -16,18 +22,245 @@ class Achievements extends StatefulWidget { } class _AchievementsState extends State { + String depart = 'CSE'; + String tab = 'achievements'; + String htmlData = ''; + String fieldData = ''; + late String user_type = ""; + bool edit = false; + late String path = ''; + List Departments = ["CSE", "ME", "SM", "ECE", "DESIGN"]; + @override + void initState() { + super.initState(); + } + + void changeData() async { + try { + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString(tab + depart, fieldData); + htmlData = fieldData; + // print(fieldData); + // print(htmlData); + } catch (e) { + print(e); + } + } + + Future getData() async { + try { + SharedPreferences prefs = await SharedPreferences.getInstance(); + if (prefs.containsKey(tab + depart)) { + final Data = prefs.getString(tab + depart); + htmlData = Data!; + fieldData = htmlData; + } else { + final Data = await rootBundle + .loadString('db/Dep/' + tab + '/' + depart + '.html'); + prefs.setString(tab + depart, Data); + // print(depart); + htmlData = Data; + fieldData = htmlData; + } + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { + double kHeight = MediaQuery.of(context).size.height; + double kWidth = MediaQuery.of(context).size.width; return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), - body: Text( - "Welcome to Achievements", - style: TextStyle( - fontSize: 35, - ), - textAlign: TextAlign.center, - ), + body: !edit + ? FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error loading data')); + } else { + return Column( + children: [ + Row( + children: [ + for (int i = 0; i < Departments.length; i++) ...[ + Column( + children: [ + Container( + height: kHeight * 0.05, + width: kWidth * 0.18, + margin: EdgeInsets.all(kWidth * 0.01), + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.black)), + child: Text( + Departments[i], + style: TextStyle( + color: Colors.white, + fontSize: kWidth * 0.025), + ), + onPressed: () => { + // print(Departments[i]), + setState(() { + depart = Departments[i]; + edit = false; + getData(); + }) + }, + ), + ) + ], + ) + ] + ], + ), + if (!edit) ...[ + Flexible( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + child: Flexible( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(kWidth * 0.05), + child: HtmlWidget( + "

" + + depart + + " Department

" + + htmlData, + textStyle: TextStyle(fontSize: 20)), + ), + Container( + margin: EdgeInsets.all(kHeight * 0.05), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + // print(htmlData), + // updateHtmlFile(htmlData), + setState(() { + print("edit mode on"); + edit = true; + }) + }), + child: Text( + "Edit", + style: TextStyle(fontSize: 50), + )), + ), + ) + ], + )), + ))) + ] else ...[ + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + fieldData = value; + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: + TextStyle(fontSize: 50))), + ), + ) + ], + )), + )) + ] + ], + ); + } + }) + : SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + setState(() { + fieldData = value; + }); + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: TextStyle(fontSize: 50))), + ), + ) + ], + )), + )), ); } } diff --git a/lib/screens/Department/Facilities.dart b/lib/screens/Department/Facilities.dart index 16e369e3..10700451 100644 --- a/lib/screens/Department/Facilities.dart +++ b/lib/screens/Department/Facilities.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:convert'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:fusion/Components/appBar.dart'; import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/services/service_locator.dart'; @@ -10,6 +11,7 @@ import 'package:fusion/services/profile_service.dart'; import 'package:fusion/models/profile.dart'; import 'package:http/http.dart'; import 'package:flutter_widget_from_html/flutter_widget_from_html.dart'; +import 'package:shared_preferences/shared_preferences.dart'; // import 'package:my_app/html_view.dart'; class Facilities extends StatefulWidget { @@ -18,11 +20,244 @@ class Facilities extends StatefulWidget { } class _FacilitiesState extends State { + String depart = 'CSE'; + String tab = 'facilites'; + String htmlData = ''; + String fieldData = ''; + bool edit = false; + late String path = ''; + List Departments = ["CSE", "ME", "SM", "ECE", "DESIGN"]; + @override + void initState() { + super.initState(); + } + + void changeData() async { + try { + SharedPreferences prefs = await SharedPreferences.getInstance(); + prefs.setString(tab + depart, fieldData); + htmlData = fieldData; + // print(fieldData); + // print(htmlData); + } catch (e) { + print(e); + } + } + + Future getData() async { + try { + SharedPreferences prefs = await SharedPreferences.getInstance(); + if (prefs.containsKey(tab + depart)) { + final Data = prefs.getString(tab + depart); + htmlData = Data!; + fieldData = htmlData; + } else { + final Data = await rootBundle + .loadString('db/Dep/' + tab + '/' + depart + '.html'); + prefs.setString(tab + depart, Data); + // print(depart); + htmlData = Data; + fieldData = htmlData; + } + } catch (e) { + print(e); + } + } + @override Widget build(BuildContext context) { + double kHeight = MediaQuery.of(context).size.height; + double kWidth = MediaQuery.of(context).size.width; return Scaffold( - appBar: DefaultAppBar().buildAppBar(), - drawer: SideDrawer(), - body: HtmlWidget("
hello world
")); + appBar: DefaultAppBar().buildAppBar(), + drawer: SideDrawer(), + body: !edit + ? FutureBuilder( + future: getData(), + builder: (BuildContext context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return Center(child: CircularProgressIndicator()); + } else if (snapshot.hasError) { + return Center(child: Text('Error loading data')); + } else { + return Column( + children: [ + Row( + children: [ + for (int i = 0; i < Departments.length; i++) ...[ + Column( + children: [ + Container( + height: kHeight * 0.05, + width: kWidth * 0.18, + margin: EdgeInsets.all(kWidth * 0.01), + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.black)), + child: Text( + Departments[i], + style: TextStyle( + color: Colors.white, + fontSize: kWidth * 0.025), + ), + onPressed: () => { + // print(Departments[i]), + setState(() { + depart = Departments[i]; + edit = false; + getData(); + }) + }, + ), + ) + ], + ) + ] + ], + ), + if (!edit) ...[ + Flexible( + flex: 1, + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + child: Flexible( + child: Column( + children: [ + Container( + margin: EdgeInsets.all(kWidth * 0.05), + child: HtmlWidget( + "

" + + depart + + " Department

" + + htmlData, + textStyle: TextStyle(fontSize: 20)), + ), + Container( + margin: EdgeInsets.all(kHeight * 0.05), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + // print(htmlData), + // updateHtmlFile(htmlData), + setState(() { + print("edit mode on"); + edit = true; + }) + }), + child: Text( + "Edit", + style: TextStyle(fontSize: 50), + )), + ), + ) + ], + )), + ))) + ] else ...[ + SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + fieldData = value; + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all< + Color>(Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: + TextStyle(fontSize: 50))), + ), + ) + ], + )), + )) + ] + ], + ); + } + }) + : SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + margin: EdgeInsets.all(kWidth * 0.035), + child: Flexible( + fit: FlexFit.loose, + child: Column( + children: [ + Container( + child: TextFormField( + maxLines: 20, + style: TextStyle(fontSize: 20), + initialValue: htmlData, + onChanged: (value) { + print("value changed"); + setState(() { + fieldData = value; + }); + }), + ), + Container( + margin: EdgeInsets.all(kWidth * 0.030), + child: SizedBox( + height: kHeight * 0.1, + width: kWidth * 0.4, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: + MaterialStateProperty.all( + Colors.green), + ), + onPressed: (() => { + print("pressed done"), + changeData(), + setState(() { + edit = false; + }) + }), + child: Text("Done", + style: TextStyle(fontSize: 50))), + ), + ) + ], + )), + )), + ); } } diff --git a/lib/screens/Department/PostAnnouncement.dart b/lib/screens/Department/PostAnnouncement.dart index 8f58a120..c3f22ad5 100644 --- a/lib/screens/Department/PostAnnouncement.dart +++ b/lib/screens/Department/PostAnnouncement.dart @@ -44,6 +44,7 @@ class _PostAnnouncementState extends State { appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), body: SingleChildScrollView( + child: Padding( padding: EdgeInsets.all(16.0), child: Column( diff --git a/pubspec.yaml b/pubspec.yaml index 4135c27c..ec756143 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -73,6 +73,9 @@ flutter: - assets/unknown.jpg - assets/profile_pic.png - db/ + - db/Dep/achievements/ + - db/Dep/about/ + - db/Dep/facilities/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. From 6b7dd76a7dced5b5b38fbc0c0efef96d92453d04 Mon Sep 17 00:00:00 2001 From: Rajat376 <89566014+Rajat376@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:45:46 +0530 Subject: [PATCH 15/15] minor changes in facilities --- lib/screens/Department/Facilities.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/screens/Department/Facilities.dart b/lib/screens/Department/Facilities.dart index 10700451..35e05ea5 100644 --- a/lib/screens/Department/Facilities.dart +++ b/lib/screens/Department/Facilities.dart @@ -21,9 +21,10 @@ class Facilities extends StatefulWidget { class _FacilitiesState extends State { String depart = 'CSE'; - String tab = 'facilites'; + String tab = 'facilities'; String htmlData = ''; String fieldData = ''; + late String user_type = ""; bool edit = false; late String path = ''; List Departments = ["CSE", "ME", "SM", "ECE", "DESIGN"];