diff --git a/lib/screens/Academic/Add_Drop_Courses/add_drop_courses.dart b/lib/screens/Academic/Add_Drop_Courses/add_drop_courses.dart index 74603d08..351c8ca9 100644 --- a/lib/screens/Academic/Add_Drop_Courses/add_drop_courses.dart +++ b/lib/screens/Academic/Add_Drop_Courses/add_drop_courses.dart @@ -9,77 +9,90 @@ class AddDropCourses extends StatefulWidget { class _AddDropCoursesState extends State { @override Widget build(BuildContext context) { - return DefaultTabController( - length: 2, - child: Scaffold( - appBar: AppBar( - backgroundColor: Colors.black, - title: Text( - "FUSION", - style: TextStyle(color: Colors.white), + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrangeAccent, + title: Text( + "Add/Drop Courses", + style: TextStyle(color: Colors.white), + ), + actions: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.search), ), - actions: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.search), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.notifications), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.more_vert), - ), - ], - bottom: TabBar( - isScrollable: true, - indicatorColor: Colors.white, - indicatorWeight: 6.0, - tabs: [ - Tab( - child: Container( - child: Text( - 'Add Course', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Drop Course', - ), - ), - ), - ], + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.notifications), ), - ), - drawer: SideDrawer(), - body: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - mainAxisSize: MainAxisSize.min, - children: [ - Flexible( - child: TabBarView( - children: [ - Center( - child: Text( - "Add Course(s)\nYou have to wait for the date", - textAlign: TextAlign.center, + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.more_vert), + ), + ], + ), // Appbar + drawer: SideDrawer(), + body: Container( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + DefaultTabController( + length: 2, // length of tabs + initialIndex: 0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + child: TabBar( + labelColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + indicatorColor: Colors.black, + tabs: [ + Tab( + child: Container( + child: Text( + 'Add Course', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Drop Course', + ), + ), + ), + ], + ), ), - ), - Center( - child: Text( - "Drop Course(s)\nYou have to wait for the date", - textAlign: TextAlign.center, + Container( + height: 400, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide(color: Colors.grey, width: 0.5))), + child: TabBarView( + children: [ + Center( + child: Text( + "Add Course(s)\nYou have to wait for the date", + textAlign: TextAlign.center, + ), + ), + Center( + child: Text( + "Drop Course(s)\nYou have to wait for the date", + textAlign: TextAlign.center, + ), + ), + ], + ), ), - ), - ], + Center(child: Text('Current Credits : 0')), + ], + ), ), - ), - Center(child: Text('Current Credits : 0')), - ], - ), + ]), ), ); } diff --git a/lib/screens/Academic/Check_Dues/dues.dart b/lib/screens/Academic/Check_Dues/dues.dart index 043b5a4a..e9f18d81 100644 --- a/lib/screens/Academic/Check_Dues/dues.dart +++ b/lib/screens/Academic/Check_Dues/dues.dart @@ -24,7 +24,7 @@ class _DuesState extends State { length: 5, child: Scaffold( appBar: AppBar( - backgroundColor: Colors.black, + backgroundColor: Colors.deepOrangeAccent, title: Text( "Check Dues", style: TextStyle(color: Colors.white), @@ -43,59 +43,92 @@ class _DuesState extends State { child: Icon(Icons.more_vert), ), ], - //TabBar for a horizontal scrollable tob bar - bottom: TabBar( - isScrollable: true, - indicatorColor: Colors.white, - indicatorWeight: 6.0, - tabs: [ - Tab( - child: Container( - child: Text( - 'Mess Due History', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Library Due History', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Hostel Due History', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Placement Cell due history', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Overall', - ), - ), - ), - ], - ), ), - //TabBarView contains all the children to be called when tapped. - body: TabBarView( - children: [ - MessDues(), - LibraryDues(), - HostelDues(), - PlaccementDues(), - OverallDues() - ], + + body: Container( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + DefaultTabController( + length: 5, // length of tabs + initialIndex: 0, + child: Column(children: [ + Container( + child: TabBar( + labelColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + isScrollable: true, + indicatorColor: Colors.black, + indicatorWeight: 6.0, + tabs: [ + Tab( + child: Container( + child: Text( + 'Mess Due History', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Library Due History', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Hostel Due History', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Placement Cell due history', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Overall', + ), + ), + ), + ], + ), + ), + Container( + height: 400, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide(color: Colors.grey, width: 0.5))), + //TabBarView contains all the children to be called when tapped. + child: TabBarView( + children: [ + Container( + child: MessDues(), + ), + Container( + child: LibraryDues(), + ), + Container( + child: HostelDues(), + ), + Container( + child: PlaccementDues(), + ), + Container( + child: OverallDues(), + ), + ], + ), + ), + ]), + ), + ]), ), ), ); diff --git a/lib/screens/Academic/Current_Semester/current_semester_home_page.dart b/lib/screens/Academic/Current_Semester/current_semester_home_page.dart index 44687082..c4ac1f22 100644 --- a/lib/screens/Academic/Current_Semester/current_semester_home_page.dart +++ b/lib/screens/Academic/Current_Semester/current_semester_home_page.dart @@ -22,9 +22,9 @@ class _CurrentSemesterHomePageState extends State { length: 5, child: Scaffold( appBar: AppBar( - backgroundColor: Colors.black, + backgroundColor: Colors.deepOrangeAccent, title: Text( - "Current Semester" + ' -> ' + data.details!['user_sem'].toString(), + "Current Semester" + ' - ' + data.details!['user_sem'].toString(), style: TextStyle(color: Colors.white), ), actions: [ @@ -41,58 +41,91 @@ class _CurrentSemesterHomePageState extends State { child: Icon(Icons.more_vert), ), ], - bottom: TabBar( - isScrollable: true, - indicatorColor: Colors.white, - indicatorWeight: 6.0, - tabs: [ - Tab( - child: Container( - child: Text( - 'Semester', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Time-Table', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Academic Calendar', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'List of Holidays', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Exam time table', - ), - ), - ), - ], - ), ), drawer: SideDrawer(), - body: TabBarView( - children: [ - Semester(data: data), - TimeTable(), - AcademicCalendar(), - HolidaysList(), - ExamTimeTable(), - ], + body: Container( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + DefaultTabController( + length: 5, // length of tabs + initialIndex: 0, + child: Column(children: [ + Container( + child: TabBar( + labelColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + isScrollable: true, + indicatorColor: Colors.black, + indicatorWeight: 6.0, + tabs: [ + Tab( + child: Container( + child: Text( + 'Semester', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Time-Table', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Academic Calendar', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'List of Holidays', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Exam time table', + ), + ), + ), + ], + ), + ), + Container( + height: 400, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide(color: Colors.grey, width: 0.5))), + child: TabBarView( + children: [ + Container( + child: Semester(data: data), + ), + Container( + child: TimeTable(), + ), + Container( + child: AcademicCalendar(), + ), + Container( + child: HolidaysList(), + ), + Container( + child: ExamTimeTable(), + ), + ], + ), + ), + ]), + ), + ]), ), ), ); diff --git a/lib/screens/Academic/Registration/final_registration.dart b/lib/screens/Academic/Registration/final_registration.dart index 4ca4b245..9430a6d8 100644 --- a/lib/screens/Academic/Registration/final_registration.dart +++ b/lib/screens/Academic/Registration/final_registration.dart @@ -1,74 +1,111 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:flutter_html/shims/dart_ui_real.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; +import 'package:intl/intl.dart'; + +const kTextFieldInputDecoration = InputDecoration( + filled: true, + fillColor: Colors.white, + contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0), + border: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(32)), + ), +); class FinalRegistration extends StatefulWidget { - final data; - const FinalRegistration({Key? key, this.data}) : super(key: key); @override _FinalRegistrationState createState() => _FinalRegistrationState(); } class _FinalRegistrationState extends State { - getRows(List? map) { - List list = []; - map?.forEach((element) { - element.length > 0 - ? list.add(DataRow(cells: [ - DataCell(Text(element[0]['course_id']['id'].toString())), - DataCell(Text(element[0]['course_code'].toString())), - DataCell(Text(element[0]['course_id']['course_name'].toString())), - DataCell(Text(element[0]['credits'].toString())), - DataCell(Text(element[0]['sem'].toString())) - ])) - : true; - }); - return list; - } + final GlobalKey _formKey = GlobalKey(); + + String? programme_type; + List programmeTypeItem = [ + 'B.Tech', + 'B.des', + 'M.Tech', + 'PhD', + ]; + String? scholarship_type; + List scholarshipTypeItem = [ + 'MCM', + 'NSP', + 'Random', + ]; + String? academicyear; + List academicyearTypeItem = [ + '1st', + '2nd', + '3rd', + '4th', + ]; @override Widget build(BuildContext context) { - List? finalData = widget.data?.final_registration_choices; - return Container( - child: Column( - children: [ - SizedBox(height: 10), - Text("Final Choices Of Courses"), - if (finalData != null && finalData[0].length > 0) - SingleChildScrollView( - scrollDirection: Axis.vertical, - child: SingleChildScrollView( - scrollDirection: Axis.horizontal, - child: DataTable(columns: [ - DataColumn( - label: Text("Course ID"), - numeric: false, - ), - DataColumn( - label: Text("Course Code"), - numeric: false, - ), - DataColumn( - label: Text("Course Name"), - numeric: false, - ), - DataColumn( - label: Text("Credits"), - numeric: false, - ), - DataColumn( - label: Text("Semester"), - numeric: false, - ) - ], rows: getRows(finalData)), + return Scaffold( + body: SingleChildScrollView( + child: new Column( + children: [ + new Container( + child: new Column( + children: [ + SizedBox(height: 20), + Text( + "Final Reistration:", + textAlign: TextAlign.center, + style: const TextStyle( + fontWeight: FontWeight.bold, fontSize: 16), + ), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 4), + child: Divider( + thickness: 1, + color: Colors.black54, + ), + ), + ], + ), ), - ), - if (finalData == null || finalData[0].length == 0) - Expanded( - child: Center( - child: Text( - 'Final Registration Date is yet to come', - style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold), - ))) - ], - )); + new Container( + child: Column(children: [ + Container( + margin: EdgeInsets.all(20), + child: Table( + defaultColumnWidth: FixedColumnWidth(120.0), + border: TableBorder.all( + color: Colors.black, style: BorderStyle.solid, width: 2), + children: [ + TableRow(children: [ + Column(children: [ + Text('Course ID', style: TextStyle(fontSize: 14.0)) + ]), + Column(children: [ + Text('Course Code', style: TextStyle(fontSize: 14.0)) + ]), + Column(children: [ + Text('User Name', style: TextStyle(fontSize: 14.0)) + ]), + Column(children: [ + Text('Semester', style: TextStyle(fontSize: 14.0)) + ]), + ]), + // TableRow(children: [ + // Column(children: [Text('Award_Name')]), + // Column(children: [Text('Student_Name')]), + // Column(children: [Text('2020')]), + // ]), + ], + ), + ), + ])) + ], + ), + + //Table + ), + ); } } diff --git a/lib/screens/Academic/Registration/registration_home_page.dart b/lib/screens/Academic/Registration/registration_home_page.dart index 24dfac50..d86a6db7 100644 --- a/lib/screens/Academic/Registration/registration_home_page.dart +++ b/lib/screens/Academic/Registration/registration_home_page.dart @@ -16,67 +16,149 @@ class _RegistrationHomePageState extends State { Widget build(BuildContext context) { final AcademicData data = ModalRoute.of(context)?.settings.arguments as AcademicData; - return DefaultTabController( - length: 3, - child: Scaffold( - appBar: AppBar( - backgroundColor: Colors.black, - title: Text( - "FUSION", - style: TextStyle(color: Colors.white), + // return DefaultTabController( + return Scaffold( + appBar: AppBar( + backgroundColor: Colors.deepOrangeAccent, + title: Text( + "Academics Module", + style: TextStyle(color: Colors.white), + ), + actions: [ + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.search), ), - actions: [ - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.search), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.notifications), - ), - Padding( - padding: EdgeInsets.all(8.0), - child: Icon(Icons.more_vert), - ), - ], - bottom: TabBar( - isScrollable: true, - indicatorColor: Colors.white, - indicatorWeight: 6.0, - tabs: [ - Tab( - child: Container( - child: Text( - 'Courses', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Pre-Registration', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Final Registration', - ), - ), - ), - ], + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.notifications), ), - ), - drawer: SideDrawer(), - body: TabBarView( - children: [ - Courses(data: data.currently_registered), - PreRegistration(), - FinalRegistration(data: data) - // FinalRegistration(data: data) - ], - ), + Padding( + padding: EdgeInsets.all(8.0), + child: Icon(Icons.more_vert), + ), + ], + ), + + drawer: SideDrawer(), + body: Container( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + DefaultTabController( + length: 3, // length of tabs + initialIndex: 0, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + 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 + 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( + data.details!['user_branch'] + ' | ' + "STUDENT", + style: TextStyle( + fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + Container( + color: Colors.deepOrangeAccent, + child: const Padding( + padding: EdgeInsets.all(10.0), + child: Center( + child: Text( + 'Registration', + style: TextStyle( + color: Colors.white, + fontSize: 35, + fontWeight: FontWeight.bold), + ), + ), + ), + ), + Container( + child: TabBar( + labelColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + tabs: [ + Tab( + child: Container( + child: Text( + 'Courses', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Pre-Registration', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Final Registration', + ), + ), + ), + ], + ), + ), + Container( + height: 400, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide( + color: Colors.grey, width: 0.5))), + child: TabBarView( + children: [ + Container( + child: Courses(data: data.currently_registered), + ), + Container( + child: PreRegistration(), + ), + Container( + child: FinalRegistration( + data: data), // FinalRegistration(data: data) + ), + ], + ), + ), + ]), + ), + ]), ), ); } diff --git a/lib/screens/Academic/Thesis/thesis_home_page.dart b/lib/screens/Academic/Thesis/thesis_home_page.dart index 699f793d..5b99b657 100644 --- a/lib/screens/Academic/Thesis/thesis_home_page.dart +++ b/lib/screens/Academic/Thesis/thesis_home_page.dart @@ -15,9 +15,9 @@ class _ThesisHomePageState extends State { length: 2, child: Scaffold( appBar: AppBar( - backgroundColor: Colors.black, + backgroundColor: Colors.deepOrangeAccent, title: Text( - "FUSION", + "Thesis", style: TextStyle(color: Colors.white), ), actions: [ @@ -34,34 +34,62 @@ class _ThesisHomePageState extends State { child: Icon(Icons.more_vert), ), ], - bottom: TabBar( - isScrollable: true, - indicatorColor: Colors.white, - indicatorWeight: 6.0, - tabs: [ - Tab( - child: Container( - child: Text( - 'Registered Thesis', - ), - ), - ), - Tab( - child: Container( - child: Text( - 'Add Thesis', - ), - ), - ), - ], - ), ), + ], drawer: SideDrawer(), - body: TabBarView( - children: [ - RegisteredThesis(), - AddThesis(), - ], + body: Container( + child: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + DefaultTabController( + length: 5, // length of tabs + initialIndex: 0, + child: Column(children: [ + Container( + child: TabBar( + labelColor: Colors.deepOrangeAccent, + unselectedLabelColor: Colors.black, + isScrollable: true, + indicatorColor: Colors.black, + indicatorWeight: 6.0, + tabs: [ + Tab( + child: Container( + child: Text( + 'Registered Thesis', + ), + ), + ), + Tab( + child: Container( + child: Text( + 'Add Thesis', + ), + ), + ), + ], + ), + ), + Container( + height: 400, //height of TabBarView + decoration: BoxDecoration( + border: Border( + top: BorderSide(color: Colors.grey, width: 0.5))), + child: TabBarView( + children: [ + Container( + child: RegisteredThesis(), + ), + Container( + child: AddThesis(), + ), + ], + ), + ), + ]), + ), + ]), ), ), ); diff --git a/lib/screens/Academic/academic_home_page.dart b/lib/screens/Academic/academic_home_page.dart index e5e9fd44..385090a5 100644 --- a/lib/screens/Academic/academic_home_page.dart +++ b/lib/screens/Academic/academic_home_page.dart @@ -4,254 +4,391 @@ import 'package:fusion/Components/side_drawer.dart'; import 'package:fusion/services/academic_service.dart'; import 'package:fusion/models/academic.dart'; import 'dart:async'; +import 'package:fusion/models/profile.dart'; +import 'package:fusion/services/profile_service.dart'; import 'dart:convert'; import 'package:http/http.dart'; +main() async { + // final String? token; + // static String tag = 'academic-page'; + // AcademicHomePage(this.token); + late ProfileService profileService; + late ProfileData data; + bool _loading = true; + late String studentType; + profileService = ProfileService(); + try { + Response response = await profileService.getProfile(); + + data = ProfileData.fromJson(jsonDecode(response.body)); + + print(data.user!['username']); + _loading = false; + studentType = data.profile!['department']!['name'] + + ' ' + + data.profile!['user_type']; + print(studentType); + } catch (e) { + print(e); + } +} + class AcademicHomePage extends StatefulWidget { - final String? token; - static String tag = 'academic-page'; - AcademicHomePage(this.token); + // final String? token; + // static String tag = 'academic-page'; + // AcademicHomePage(this.token); @override _AcademicHomePageState createState() => _AcademicHomePageState(); } class _AcademicHomePageState extends State { bool _loading1 = true; - late StreamController _academicController; - late AcademicService academicService; - late AcademicData data; + bool _loading2 = false; + bool _loading3 = false; + bool _loading = true; + + late StreamController _profileController; + late String studentType; + late ProfileService profileService; + late ProfileData data; @override void initState() { super.initState(); - _academicController = StreamController(); - academicService = AcademicService(); - getAcademicDataStream(); + + _profileController = StreamController(); + profileService = ProfileService(); + + getData(); } - getAcademicDataStream() async { + getData() async { //print('token-'+widget.token!); try { - Response response = - await academicService.getAcademicDetails(widget.token!); + Response response = await profileService.getProfile(); setState(() { - print(response.body); - data = AcademicData.fromJson(jsonDecode(response.body)); - _loading1 = false; + data = ProfileData.fromJson(jsonDecode(response.body)); + + print(data.user!['username']); + _loading = false; }); + studentType = data.profile!['department']!['name'] + + ' ' + + data.profile!['user_type']; + // print(studentType); } catch (e) { print(e); } } loadData() async { - getAcademicDataStream().then((res) { - _academicController.add(res); + getData().then((res) { + _profileController.add(res); }); } BoxDecoration myBoxDecoration() { return BoxDecoration( - border: new Border.all( - color: Colors.deepOrangeAccent, - width: 2.0, - style: BorderStyle.solid, + // border: new Border.all( + // color: Colors.deepOrangeAccent, + // width: 2.0, + // style: BorderStyle.solid, + // ), + color: Colors.white, // Add + boxShadow: [ + // Add this full block boxshadow + BoxShadow( + color: Color.fromARGB(255, 139, 139, 139), + offset: Offset(0.0, 2.0), + blurRadius: 3.0, ), - borderRadius: new BorderRadius.all(new Radius.circular(15.0))); + ], + borderRadius: BorderRadius.all( + Radius.circular(4.0), // change radius 15 to 4 + ), + ); } Text myText(String text) { return Text( text, - style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w500), + style: TextStyle( + fontSize: 17.0, + fontWeight: FontWeight.w600, + letterSpacing: + 0.7), //Change fontsize 20 to 17,fontweight w500 to w w600 ans add leetetespace ); } + // Padding myContainer(String text) { + // return Padding( + // padding: const EdgeInsets.all(8.0), + // child: Container( + // child: Padding( + // padding: const EdgeInsets.all(8.0), + // child: myText(text), + // ), + // decoration: myBoxDecoration(), + // ), + // ); + // } + + // Change this full block with given bellow block Padding myContainer(String text) { return Padding( - padding: const EdgeInsets.all(8.0), + padding: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 8.0), child: Container( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: myText(text), + padding: const EdgeInsets.symmetric(horizontal: 40.0, vertical: 8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [myText(text)], ), decoration: myBoxDecoration(), ), ); } +// Widget build(BuildContext context) { +// return Scaffold( +// appBar: DefaultAppBar().buildAppBar(), +// drawer: SideDrawer(), +// body: _loading1 == true +// ? Center(child: CircularProgressIndicator()) +// : ListView( +// shrinkWrap: true, +// physics: ClampingScrollPhysics(), +// 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 +// 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( +// data.details!['user_branch'] + ' | ' + "STUDENT", +// style: TextStyle(fontSize: 15.0, color: Colors.black), +// ), +// SizedBox( +// height: 10.0, +// ), +// ], +// ), +// ), +// Padding( +// padding: const EdgeInsets.all(8.0), +// child: Container( +// child: Padding( +// padding: const EdgeInsets.all(8.0), +// child: Center( +// child: Text( +// "Academic", +// style: TextStyle( +// fontSize: 20.0, +// color: Colors.white, +// ), +// )), +// ), +// decoration: new BoxDecoration( +// color: Colors.deepOrangeAccent, +// boxShadow: [ +// BoxShadow( +// color: Colors.black, +// offset: Offset(0.0, 1.0), +// blurRadius: 2.0, +// ) +// ], +// borderRadius: +// new BorderRadius.all(new Radius.circular(5.0)), +// ), +// ), +// ), + +// change this whole block with below Widget build(BuildContext context) { return Scaffold( appBar: DefaultAppBar().buildAppBar(), drawer: SideDrawer(), - body: _loading1 == true - ? Center(child: CircularProgressIndicator()) - : ListView( - shrinkWrap: true, - physics: ClampingScrollPhysics(), - 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 - 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( - data.details!['user_branch'] + ' | ' + "STUDENT", - style: TextStyle(fontSize: 15.0, color: Colors.black), - ), - SizedBox( - height: 10.0, - ), - ], - ), - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: Container( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Center( - child: Text( - "Academic", - style: TextStyle( - fontSize: 20.0, - color: Colors.white, - ), - )), - ), + body: ListView( + shrinkWrap: true, + physics: ClampingScrollPhysics(), + children: [ + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 20.0), + color: Color.fromARGB(255, 58, 58, 58), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 50.0, vertical: 40.0), + color: Colors.white, + child: Column( + children: [ + Container( + width: 100.0, + height: 100.0, + margin: + EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0), decoration: new BoxDecoration( - color: Colors.deepOrangeAccent, - boxShadow: [ - BoxShadow( - color: Colors.black, - offset: Offset(0.0, 1.0), - blurRadius: 2.0, - ) - ], - borderRadius: - new BorderRadius.all(new Radius.circular(5.0)), + image: DecorationImage( + image: AssetImage('assets/unknown.jpg'), + fit: BoxFit.cover, + ), ), ), - ), - Card( - elevation: 2.0, - margin: - EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), - shadowColor: Colors.black, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - InkWell( - child: myContainer("Current Semester"), - onTap: () { - Navigator.pushNamed(context, - '/academic_home_page/current_semester_home_page', - arguments: data); - }, - ), - InkWell( - child: myContainer("Registration"), - onTap: () { - Navigator.pushNamed(context, - '/academic_home_page/registration_home_page', - arguments: data); - }, - ), - InkWell( - child: myContainer("Check Dues"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/dues', - arguments: data); - }, - ), - InkWell( - child: myContainer("Apply for Bonafide"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/bonafide', - arguments: { - 'firstName': data.details!['current_user'] - ['first_name'] - .toString(), - 'lastName': data.details!['current_user'] - ['last_name'], - 'branch': data.details!['user_branch'], - 'roll_no': data.details!['current_user'] - ['username'], - }); - }, - ), - InkWell( - child: myContainer("Check Attendance"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/attendance', - arguments: data); - }, - ), - InkWell( - child: myContainer("Branch Change"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/branch_change'); - }, - ), - InkWell( - child: myContainer("Evaluate Teaching Credits"), - //onTap: (){}, - ), - InkWell( - child: myContainer("Thesis"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/thesis'); - }, - ), - InkWell( - child: myContainer("View Performance"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/performance'); - }, - ), - InkWell( - child: myContainer("Add/Drop courses"), - onTap: () { - Navigator.pushNamed( - context, '/academic_home_page/add_drop_courses'); - }, - ), - ], + SizedBox( + height: 0.0, + ), + Text( + //NAME OF USER + data.user!['first_name'] + ' ' + data.user!['last_name'], + style: TextStyle(fontSize: 18.0, color: Colors.black), + ), + SizedBox( + height: 5.0, + ), + Text( + data.profile!['department']!['name'] + ' ' + "Student", + style: TextStyle(fontSize: 15.0, color: Colors.black), + ), + SizedBox( + height: 10.0, + ), + ], + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 25.0, vertical: 10.0), + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Center( + child: Text( + "Academics Work", + style: TextStyle( + fontSize: 17.0, + fontWeight: FontWeight.bold, + letterSpacing: 1, + color: Colors.white, ), + )), + ), + decoration: new BoxDecoration( + color: Color.fromARGB(255, 247, 100, 55), + borderRadius: new BorderRadius.all(new Radius.circular(12.0)), + ), + ), + ), + Card( + elevation: 2.0, + margin: EdgeInsets.symmetric(horizontal: 10.0, vertical: 10.0), + shadowColor: Colors.black, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + InkWell( + child: myContainer("Current Semester"), + onTap: () { + Navigator.pushNamed( + context, + '/academic_home_page/current_semester_home_page', + ); + }, + ), + InkWell( + child: myContainer("Registration"), + onTap: () { + Navigator.pushNamed( + context, + '/academic_home_page/registration_home_page', + ); + }, + ), + InkWell( + child: myContainer("Add/Drop courses"), + onTap: () { + Navigator.pushNamed( + context, '/academic_home_page/add_drop_courses'); + }, + ), + InkWell( + child: myContainer("Check Dues"), + onTap: () { + Navigator.pushNamed( + context, + '/academic_home_page/dues', + ); + }, + ), + InkWell( + child: myContainer("Thesis"), + onTap: () { + Navigator.pushNamed(context, '/academic_home_page/thesis'); + }, + ), + InkWell( + child: myContainer("Apply for Bonafide"), + onTap: () { + Navigator.pushNamed( + context, + '/academic_home_page/bonafide', + ); + }, + ), + InkWell( + child: myContainer("Check Attendance"), + onTap: () { + Navigator.pushNamed( + context, '/academic_home_page/attendance'); + }, + ), + InkWell( + child: myContainer("Branch Change"), + onTap: () { + Navigator.pushNamed( + context, '/academic_home_page/branch_change'); + }, + ), + InkWell( + child: myContainer("Evaluate Teaching Credits"), + //onTap: (){}, + ), + InkWell( + child: myContainer("View Performance"), + onTap: () { + Navigator.pushNamed( + context, '/academic_home_page/performance'); + }, ), ], ), + ), + ], + ), ); } } diff --git a/lib/services/academic_service.dart b/lib/services/academic_service.dart index 81e1361f..09567035 100644 --- a/lib/services/academic_service.dart +++ b/lib/services/academic_service.dart @@ -1,11 +1,20 @@ import 'package:fusion/api.dart'; import 'package:fusion/constants.dart'; +import 'package:fusion/services/service_locator.dart'; +import 'package:fusion/services/storage_service.dart'; import 'package:http/http.dart' as http; + class AcademicService { Future getAcademicDetails(String token) async { try { - Map headers = {'Authorization': 'Token ' + token}; + var storage_service = locator(); + if (storage_service.userInDB?.token == null) + throw Exception('Token error'); + Map headers = { + 'Authorization': 'Token ' + (storage_service.userInDB?.token ?? "") + }; + print("fetching Academic Details"); var client = http.Client(); http.Response response = await client.get(