diff --git a/assets/byAditya/ad.png b/assets/homepageImages/ad.png similarity index 100% rename from assets/byAditya/ad.png rename to assets/homepageImages/ad.png diff --git a/assets/byAditya/aditya.png b/assets/homepageImages/aditya.png similarity index 100% rename from assets/byAditya/aditya.png rename to assets/homepageImages/aditya.png diff --git a/assets/byAditya/attendance.jpg b/assets/homepageImages/attendance.jpg similarity index 100% rename from assets/byAditya/attendance.jpg rename to assets/homepageImages/attendance.jpg diff --git a/assets/byAditya/cs.png b/assets/homepageImages/cs.png similarity index 100% rename from assets/byAditya/cs.png rename to assets/homepageImages/cs.png diff --git a/assets/byAditya/de.png b/assets/homepageImages/de.png similarity index 100% rename from assets/byAditya/de.png rename to assets/homepageImages/de.png diff --git a/assets/byAditya/ds.png b/assets/homepageImages/ds.png similarity index 100% rename from assets/byAditya/ds.png rename to assets/homepageImages/ds.png diff --git a/assets/byAditya/homeMain.svg b/assets/homepageImages/homeMain.svg similarity index 100% rename from assets/byAditya/homeMain.svg rename to assets/homepageImages/homeMain.svg diff --git a/assets/byAditya/mathFinal.jpg b/assets/homepageImages/mathFinal.jpg similarity index 100% rename from assets/byAditya/mathFinal.jpg rename to assets/homepageImages/mathFinal.jpg diff --git a/assets/byAditya/wd.png b/assets/homepageImages/wd.png similarity index 100% rename from assets/byAditya/wd.png rename to assets/homepageImages/wd.png diff --git a/lib/constants/StringConstt.dart b/lib/constants/StringConstt.dart index 5f97dc2..b5ca002 100644 --- a/lib/constants/StringConstt.dart +++ b/lib/constants/StringConstt.dart @@ -1,2 +1,14 @@ const String DIRECTOR_MSG = "Being the Director of an ‘Institution of National Importance’it is a matter of pride as well as responsibility. Now, as the baton has passed on to me, I realize that it is for me to lay a roadmap that would take this institution to even greater heights. Having come from a research background and having seen, at close quarters, what meaningful research output can do for the growth and prestige of the country, I am convinced that research has to be a thrust area for our institutions of higher learning. I would strive to provide that thrust in this institution. If we succeed in enthusing our faculty, staff and students towards this end, our institute would become a cradle of creative and innovative ideas that can help develop new technologies, which, in turn, would transform our country. As a young institute, IIIT Sonepat has a unique opportunity to make a difference not only to Indian IT industry and the academic research community, but also the people of the entire region of Haryana. With this environment and rapidly improving connectivity to the IT capital New Delhi and the business city Gurugram, IIIT Sonepat is strategically positioned to develop into one of the best institutes of national importance in the country, under able and caring mentorship by NIT-Kurukshetra. In the coming years, with the support of its eminent Chairperson and Governing Body, the Institute will make every effort to construct and move to its spacious permanent campus located in a pristine setting near Sonepat. IIIT Sonepat is keen to push an effective research agenda and enhance its academic offerings by adding postgraduate and research programmes as well as more specializations of current relevance in undergraduate studies. Postgraduate studies and research will be a key factor for improving our visibility to the world. I also seek support of all stake holders in steering the institute to a great future. We have lots of work to do as multiple fronts. We have to create quality infrastructure, develop labs for academic and research activities, enhance research potential, expand the academic programs. We have to achieve all these in the fast changing education system. Let's all work together to achieve these goals."; +String greetingMessage() { + var timeNow = DateTime.now().hour; + + if (timeNow <= 12) { + return 'Good Morning'; + } else if ((timeNow > 12) && (timeNow <= 16)) { + return 'Good Afternoon'; + } else { + return 'Good Evening'; + } +} +String greeting = greetingMessage(); \ No newline at end of file diff --git a/lib/constants/decorations.dart b/lib/constants/decorations.dart new file mode 100644 index 0000000..9fd179e --- /dev/null +++ b/lib/constants/decorations.dart @@ -0,0 +1,39 @@ +import 'package:flutter/material.dart'; +InputDecoration inputDecor({String hint, IconData prefix, bool obscure, IconData suffix, Function toogle}) { + return InputDecoration( + enabledBorder: OutlineInputBorder( + borderSide: BorderSide(color: Colors.transparent), + borderRadius: BorderRadius.all( + Radius.circular(30.0), + ), + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.all( + Radius.circular(30.0), + ), + borderSide: BorderSide(color: Colors.grey[100]), + ), + hintText: hint, + filled: true, + fillColor: Colors.grey.shade200, + prefixIcon: Icon( + prefix, + size: 25.0, + color: Colors.black, + ), + suffixIcon: IconButton( + onPressed: toogle, + icon: Icon( + obscure ? Icons.visibility_off : suffix, + size: 25.0, + color: Colors.black, + ), + ), + hintStyle: TextStyle( + color: Colors.grey, + fontSize: 12.0, + fontWeight: FontWeight.w900, + fontStyle: FontStyle.normal, + ), + ); +} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index c906080..16622f2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,13 +1,9 @@ -import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; - import 'package:iiit_sonepat_stable/constants/routes.dart'; import 'package:iiit_sonepat_stable/ui/Auth/Login_Page/SplashScreen.dart'; import 'package:iiit_sonepat_stable/ui/Auth/Login_Page/Landing.dart'; void main() async { - // WidgetsFlutterBinding.ensureInitialized(); - // await Firebase.initializeApp(); runApp( MyApp(), ); @@ -19,7 +15,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, - title: 'Flutter Demo', + title: 'IIIT Sonepat App', theme: ThemeData( primarySwatch: Colors.blue, ), diff --git a/lib/ui/Auth/Login_Page/Auth.dart b/lib/ui/Auth/Login_Page/Auth.dart index c7321c4..130f2f8 100644 --- a/lib/ui/Auth/Login_Page/Auth.dart +++ b/lib/ui/Auth/Login_Page/Auth.dart @@ -1,12 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:iiit_sonepat_stable/constants/routes.dart'; import 'package:iiit_sonepat_stable/constants/screenSize.dart'; import 'package:iiit_sonepat_stable/constants/theme.dart'; import 'package:iiit_sonepat_stable/constants/validators.dart'; -import 'package:iiit_sonepat_stable/ui/Auth/Login_Page/Landing.dart'; -import 'package:iiit_sonepat_stable/main.dart'; import 'package:iiit_sonepat_stable/ui/Home/homepage.dart'; -import 'FogetPasswordPage.dart'; import 'package:fluttertoast/fluttertoast.dart'; +import 'package:iiit_sonepat_stable/constants/decorations.dart'; class Auth extends StatefulWidget { @override @@ -14,8 +13,6 @@ class Auth extends StatefulWidget { } class _AuthState extends State { - final _scaffoldKey = GlobalKey(); - final TextEditingController emailController = new TextEditingController(); final TextEditingController passwordController = new TextEditingController(); @@ -24,50 +21,6 @@ class _AuthState extends State { bool isObscure = true; - InputDecoration inputDecor( - String hint, IconData prefix, bool obscure, IconData suffix) { - return InputDecoration( - enabledBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.transparent), - borderRadius: BorderRadius.all( - Radius.circular(30.0), - ), - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.all( - Radius.circular(30.0), - ), - borderSide: BorderSide(color: Colors.grey[100]), - ), - hintText: hint, - filled: true, - fillColor: Colors.grey.shade200, - prefixIcon: Icon( - prefix, - size: 25.0, - color: Colors.black, - ), - suffixIcon: IconButton( - onPressed: () { - setState(() { - isObscure = !isObscure; - }); - }, - icon: Icon( - isObscure && obscure ? Icons.visibility_off : suffix, - size: 25.0, - color: Colors.black, - ), - ), - hintStyle: TextStyle( - color: Colors.grey, - fontSize: 12.0, - fontWeight: FontWeight.w900, - fontStyle: FontStyle.normal, - ), - ); - } - @override Widget build(BuildContext context) { SizeConfig().init(context); @@ -140,7 +93,8 @@ class _AuthState extends State { child: Column( children: [ TextFormField( - // autovalidateMode: AutovalidateMode.always, + autovalidateMode: + AutovalidateMode.onUserInteraction, validator: emailValidator, style: TextStyle( color: Colors.black, @@ -148,16 +102,19 @@ class _AuthState extends State { ), controller: emailController, decoration: inputDecor( - "name.rollno@iiitsonepat.ac.in", - Icons.mail_outline, - false, - null), + hint: "name.rollno@iiitsonepat.ac.in", + prefix: Icons.mail_outline, + obscure: false, + suffix: null, + toogle: null, + ), ), SizedBox( height: 12.0, ), TextFormField( - //autovalidateMode: AutovalidateMode.always, + autovalidateMode: + AutovalidateMode.onUserInteraction, validator: pwdValidator, style: TextStyle( color: Colors.black, @@ -166,10 +123,15 @@ class _AuthState extends State { obscureText: isObscure, controller: passwordController, decoration: inputDecor( - "Password", - Icons.lock_outline_rounded, - true, - Icons.visibility), + hint: "Password", + prefix: Icons.lock_outline_rounded, + obscure: isObscure, + suffix: Icons.visibility, + toogle: () { + setState(() { + isObscure = !isObscure; + }); + }), ), ], ), @@ -192,17 +154,6 @@ class _AuthState extends State { onTap: () { //[TODO] add direct mail facilty to contact admin Fluttertoast.showToast(msg: "Contact Admin"); - // Navigator.push( - // context, - // MaterialPageRoute( - // builder: (context) => - // ForgetPassword( - // rollController, - // phoneController, - // nameController, - // ), - // ), - // ); }), ), ), @@ -211,30 +162,32 @@ class _AuthState extends State { child: ButtonTheme( minWidth: 250, height: 60, + // ignore: deprecated_member_use child: RaisedButton( - color: Colors.black87, - child: Text( - "Sign In", - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.w600, - color: Colors.white), - ), - shape: RoundedRectangleBorder( - borderRadius: new BorderRadius.circular(30.0), - ), - onPressed: () { - if (!formAuthKey.currentState.validate()) { - Fluttertoast.showToast( - msg: 'Oops something went wrong'); - } else { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => HomeScreen()), - ); - } - }), + color: Colors.black87, + child: Text( + "Sign In", + style: TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.w600, + color: Colors.white), + ), + shape: RoundedRectangleBorder( + borderRadius: new BorderRadius.circular(30.0), + ), + onPressed: () { + if (!formAuthKey.currentState.validate()) { + Fluttertoast.showToast( + msg: 'Oops something went wrong'); + } else { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => HomeScreen()), + ); + } + }, + ), ), ), ], diff --git a/lib/ui/Home/homepage.dart b/lib/ui/Home/homepage.dart index d51c4af..9b6cbf9 100644 --- a/lib/ui/Home/homepage.dart +++ b/lib/ui/Home/homepage.dart @@ -1,12 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:iiit_sonepat_stable/ui/Home/subjectsSlides.dart'; -import 'package:iiit_sonepat_stable/ui/Home/slider.dart'; import 'package:iiit_sonepat_stable/constants/screenSize.dart'; -import 'package:iiit_sonepat_stable/ui/Home/drawerScreen.dart'; -import 'package:iiit_sonepat_stable/ui/AttendancePage/attendance_page.dart'; -import 'package:iiit_sonepat_stable/ui/SubjectPages/subjectpage.dart'; +import 'package:iiit_sonepat_stable/widgets/backPopScopeWidget.dart'; +import 'package:iiit_sonepat_stable/widgets/homescreen_buttons.dart'; +import 'package:iiit_sonepat_stable/constants/StringConstt.dart'; class HomeScreen extends StatefulWidget { @override @@ -14,71 +12,11 @@ class HomeScreen extends StatefulWidget { } class _HomeScreenState extends State { - Future _onBackPressed() { - return showDialog( - context: context, - builder: (context) => new AlertDialog( - title: new Text('Are you sure?'), - content: new Text('Do you want to exit an App'), - actions: [ - new GestureDetector( - onTap: () => Navigator.of(context).pop(false), - child: roundedButton( - "No", const Color(0xFF167F67), const Color(0xFFFFFFFF)), - ), - new GestureDetector( - onTap: () => Navigator.of(context).pop(true), - child: roundedButton( - " Yes ", const Color(0xFF167F67), const Color(0xFFFFFFFF)), - ), - ], - ), - ) ?? - false; - } - - Widget roundedButton(String buttonLabel, Color bgColor, Color textColor) { - var loginBtn = new Container( - padding: EdgeInsets.all(5.0), - alignment: FractionalOffset.center, - decoration: new BoxDecoration( - color: bgColor, - borderRadius: new BorderRadius.all(const Radius.circular(10.0)), - boxShadow: [ - BoxShadow( - color: const Color(0xFF696969), - offset: Offset(1.0, 6.0), - blurRadius: 0.001, - ), - ], - ), - child: Text( - buttonLabel, - style: new TextStyle( - color: textColor, fontSize: 20.0, fontWeight: FontWeight.bold), - ), - ); - return loginBtn; - } - @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: _onBackPressed, - child: MaterialApp( - home: Scaffold( - body: Stack( - children: [ - DrawerScreen(), - MyApp(), - ], - ), - ), - ), - ); + return MyWillPopScope(app: MyApp(),); } } - class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); @@ -89,22 +27,10 @@ class _MyAppState extends State { String userName = "Aditya Chaudhary"; double xOffset = 0; double yOffset = 0; - double scalefactor = 1; + double scaleFactor = 1; bool isDrawerOpen = false; String yearOfStudent = "First"; - String greetingMessage() { - var timeNow = DateTime.now().hour; - - if (timeNow <= 12) { - return 'Good Morning'; - } else if ((timeNow > 12) && (timeNow <= 16)) { - return 'Good Afternoon'; - } else { - return 'Good Evening'; - } - } - @override Widget build(BuildContext context) { String greeting = greetingMessage(); @@ -127,7 +53,7 @@ class _MyAppState extends State { ], ), transform: Matrix4.translationValues(xOffset, yOffset, 0) - ..scale(scalefactor) + ..scale(scaleFactor) ..rotateY(isDrawerOpen ? -0.5 : 0), duration: Duration(milliseconds: 200), child: Scaffold( @@ -142,7 +68,7 @@ class _MyAppState extends State { child: Stack( children: [ SvgPicture.asset( - 'assets/byAditya/homeMain.svg', + 'assets/homepageImages/homeMain.svg', alignment: Alignment.topCenter, ), Positioned( @@ -154,32 +80,32 @@ class _MyAppState extends State { children: [ isDrawerOpen ? IconButton( - icon: Icon( - Icons.arrow_back, - color: Colors.white, - ), - onPressed: () { - setState(() { - xOffset = 0; - yOffset = 0; - scalefactor = 1; - isDrawerOpen = false; - }); - }) + icon: Icon( + Icons.arrow_back, + color: Colors.white, + ), + onPressed: () { + setState(() { + xOffset = 0; + yOffset = 0; + scaleFactor = 1; + isDrawerOpen = false; + }); + }) : IconButton( - icon: Icon( - Icons.menu, - color: Colors.white, - ), - onPressed: () { - setState(() { - xOffset = 180; - yOffset = 70; - scalefactor = 0.8; - isDrawerOpen = true; - }); - _scaffoldKey.currentState.openDrawer(); - }), + icon: Icon( + Icons.menu, + color: Colors.white, + ), + onPressed: () { + setState(() { + xOffset = 180; + yOffset = 70; + scaleFactor = 0.8; + isDrawerOpen = true; + }); + _scaffoldKey.currentState.openDrawer(); + }), Column( children: [ Column( @@ -187,13 +113,9 @@ class _MyAppState extends State { SizedBox( height: height / 40, ), - Text( - "$greeting", - style: TextStyle( - color: Colors.white, - fontSize: 35.0, - fontFamily: 'Questrial', - ), + HomePageTextWidget( + text: greeting, + fontSize: 35.0, ), ], ), @@ -202,7 +124,7 @@ class _MyAppState extends State { CircleAvatar( radius: 25.0, backgroundImage: - AssetImage('assets/byAditya/aditya.png'), + AssetImage('assets/homepageImages/aditya.png'), ), ], ), @@ -214,155 +136,24 @@ class _MyAppState extends State { SizedBox( height: 70.0, ), - Row( - children: [ - SizedBox( - width: width / 20, - ), - Text( - "$userName", - style: TextStyle( - color: Colors.white, - textBaseline: TextBaseline.alphabetic, - fontSize: 25.0, - fontFamily: 'Questrial', - fontWeight: FontWeight.w900, - ), - ), - ], - ), - Row( - children: [ - SizedBox( - width: width / 20, - ), - Text( - "$yearOfStudent year", - style: TextStyle( - color: Colors.white, - fontSize: 20.0, - fontFamily: 'Questrial', - ), - ), - ], + HomePageTextWidget( + text: userName, + width: width / 20, + fontSize: 25.0, ), + HomePageTextWidget( + text: "$yearOfStudent Year", + width: width / 20, + fontSize: 20.0, + ) ], ), ), - Positioned( - top: height / 4, - left: width / 25, - child: GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return AttendancePage(); - }, - ), - ); - }, - child: CircleAvatar( - radius: 30.0, - backgroundImage: - AssetImage('assets/byAditya/attendance.jpg'), - ), - ), - ) + PositionedRoutingButton(height: height, width: width), ], ), ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 20, - subjectName: 'Communication Skills', - imagePath: "assets/subjectPageImages/communication_skill.webp", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Communication Skills", - color1: Colors.deepPurple, - color2: Colors.lightBlueAccent, - address: "assets/byAditya/cs.png", - ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 19, - subjectName: 'Data Structures', - imagePath: "assets/subjectPageImages/dsa.webp", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Data Structures", - color1: Colors.black, - color2: Colors.black12, - address: "assets/byAditya/ds.png", - ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 21, - subjectName: 'Web Designing', - imagePath: "assets/subjectPageImages/web_design.webp", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Web Designing", - color1: Colors.lightBlueAccent, - color2: Colors.lightGreen, - address: "assets/byAditya/wd.png", - ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 17, - subjectName: 'Mathematics', - imagePath: "assets/subjectPageImages/maths.png", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Mathematics", - color1: Colors.red, - color2: Colors.yellow, - address: "assets/byAditya/mathFinal.jpg", - ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 22, - subjectName: 'Application Programming', - imagePath: "assets/subjectPageImages/application_dev.jpeg", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Application Programming", - color1: Color(0xFFFC7170), - color2: Color(0xFFEFB8B0), - address: "assets/byAditya/ad.png", - ), - SubjectButton( - navigateTo: SubjectPage( - initialPage: 18, - subjectName: 'Digital Electronics', - imagePath: "assets/subjectPageImages/dig_elec.gif", - quote: - "Maths is the language in which god has written the universe.", - ), - height: height, - width: width, - subject: "Digital Electronics", - address: "assets/byAditya/de.png", - color1: Colors.orange, - color2: Colors.yellow, - ), + subjectButtonWidgets, ], ), ), diff --git a/lib/ui/Home/slider.dart b/lib/ui/Home/slider.dart deleted file mode 100644 index 171e91b..0000000 --- a/lib/ui/Home/slider.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; - -class CarouselChild extends StatelessWidget { - CarouselChild({@required this.address, this.onPress}); - final String address; - final Function onPress; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: onPress, - child: Container( - decoration: BoxDecoration( - border: Border.all( - color: Colors.black, - width: 2.0, - ), - borderRadius: BorderRadius.circular(30.0), - image: DecorationImage( - image: AssetImage(address), - fit: BoxFit.cover, - ), - ), - ), - ); - } -} diff --git a/lib/ui/Home/subjectsSlides.dart b/lib/ui/Home/subjectsSlides.dart deleted file mode 100644 index 825d1a2..0000000 --- a/lib/ui/Home/subjectsSlides.dart +++ /dev/null @@ -1,71 +0,0 @@ -import 'package:flutter/material.dart'; - -class SubjectButton extends StatelessWidget { - const SubjectButton( - {@required this.height, - @required this.width, - this.subject, - this.color1, - this.color2, - this.address, - this.navigateTo}); - final Widget navigateTo; - final double height; - final double width; - final String subject; - final Color color1; - final Color color2; - final String address; - - @override - Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) { - return navigateTo; - }, - ), - ); - }, - child: Padding( - padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), - child: Container( - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "$subject", - style: TextStyle( - fontSize: 28.0, - color: Colors.white, - fontFamily: 'Questrial'), - ), - CircleAvatar( - backgroundImage: AssetImage("$address"), - radius: 27.0, - ), - ], - ), - ), - decoration: BoxDecoration( - gradient: LinearGradient( - begin: Alignment.topLeft, - end: Alignment.bottomRight, - colors: [color1, color2]), - borderRadius: BorderRadius.only( - topRight: Radius.circular(100.0), - bottomRight: Radius.circular(100.0), - ), - ), - height: height / 10, - width: width / 1.02, - ), - ), - ); - } -} diff --git a/lib/ui/SubjectPages/subjectpage.dart b/lib/ui/SubjectPages/subjectpage.dart deleted file mode 100644 index dcee362..0000000 --- a/lib/ui/SubjectPages/subjectpage.dart +++ /dev/null @@ -1,97 +0,0 @@ -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:native_pdf_view/native_pdf_view.dart'; - -class SubjectPage extends StatelessWidget { - SubjectPage({this.initialPage, this.subjectName, this.imagePath, this.quote}); - - final int initialPage; - final String subjectName; - final String imagePath; - final String quote; - - @override - Widget build(BuildContext context) { - final pdfController = PdfController( - initialPage: initialPage, - document: PdfDocument.openAsset('assets/iiit_sonepat_syllabus.pdf'), - ); - final height = MediaQuery.of(context).size.height; - return SafeArea( - child: Scaffold( - body: SingleChildScrollView( - child: Column( - children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - //=========NavBar=========// - Container( - // height: height*0.1, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - IconButton( - icon: Icon( - Icons.arrow_back_rounded, - size: 32, - ), - onPressed: () { - Navigator.pop(context); - }, - ), - Text( - subjectName, - style: TextStyle( - fontSize: 35.0, - ), - ), - ], - ), - ), - SizedBox( - height: 10.0, - ), - Padding( - padding: const EdgeInsets.symmetric(horizontal: 20.0), - child: Container( - height: height * 0.47, - decoration: BoxDecoration( - image: DecorationImage( - fit: BoxFit.fill, - image: AssetImage(imagePath), - ), - ), - ), - ), - ], - ), - ), - Container( - margin: EdgeInsets.all(10), - height: 160.0, - child: Center( - child: Text( - "\"${quote}\"", - style: TextStyle(fontSize: 28.0, fontFamily: 'Pacifico'), - ), - ), - ), - Text( - 'Syllabus', - style: TextStyle(fontSize: 28.0, fontFamily: 'Ubuntu'), - ), - Container( - height: height * 0.9, - child: PdfView( - controller: pdfController, - ), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/widgets/backPopScopeWidget.dart b/lib/widgets/backPopScopeWidget.dart new file mode 100644 index 0000000..3bd96f6 --- /dev/null +++ b/lib/widgets/backPopScopeWidget.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:iiit_sonepat_stable/ui/Home/drawerScreen.dart'; + +Future onBackPressed(context) { + return showDialog( + context: context, + builder: (context) => new AlertDialog( + title: new Text('Are you sure?'), + content: new Text('Do you want to exit an App'), + actions: [ + new GestureDetector( + onTap: () => Navigator.of(context).pop(false), + child: roundedButton( + "No", const Color(0xFF167F67), const Color(0xFFFFFFFF)), + ), + new GestureDetector( + onTap: () => Navigator.of(context).pop(true), + child: roundedButton( + " Yes ", const Color(0xFF167F67), const Color(0xFFFFFFFF)), + ), + ], + ), + ) ?? + false; +} + +Widget roundedButton(String buttonLabel, Color bgColor, Color textColor) { + var loginBtn = new Container( + padding: EdgeInsets.all(5.0), + alignment: FractionalOffset.center, + decoration: new BoxDecoration( + color: bgColor, + borderRadius: new BorderRadius.all(const Radius.circular(10.0)), + boxShadow: [ + BoxShadow( + color: const Color(0xFF696969), + offset: Offset(1.0, 6.0), + blurRadius: 0.001, + ), + ], + ), + child: Text( + buttonLabel, + style: new TextStyle( + color: textColor, fontSize: 20.0, fontWeight: FontWeight.bold), + ), + ); + return loginBtn; +} + +class MyWillPopScope extends StatelessWidget { + MyWillPopScope({this.app}); + final Widget app; + @override + Widget build(BuildContext context) { + return WillPopScope( + onWillPop: () { + return onBackPressed(context); + }, + child: MaterialApp( + home: Scaffold( + body: Stack( + children: [ + DrawerScreen(), + app, + ], + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/widgets/homescreen_buttons.dart b/lib/widgets/homescreen_buttons.dart index b32e35c..b19b4d9 100644 --- a/lib/widgets/homescreen_buttons.dart +++ b/lib/widgets/homescreen_buttons.dart @@ -1,58 +1,209 @@ import 'package:flutter/material.dart'; +import 'package:iiit_sonepat_stable/ui/AttendancePage/attendance_page.dart'; +import 'package:iiit_sonepat_stable/widgets/subjectPageWidget.dart'; + +class HomePageTextWidget extends StatelessWidget { + HomePageTextWidget({this.text, this.width, this.fontSize}); -class HomeScreenButton extends StatelessWidget { - HomeScreenButton({this.icon, this.text, this.pageToOpen}); - final IconData icon; final String text; - final Widget pageToOpen; + final double width; + final double fontSize; + @override Widget build(BuildContext context) { - return Container( + return Row( + children: [ + SizedBox( + width: width, + ), + Text( + "$text", + style: TextStyle( + color: Colors.white, + textBaseline: TextBaseline.alphabetic, + fontSize: fontSize, + fontFamily: 'Questrial', + fontWeight: FontWeight.w900, + ), + ), + ], + ); + } +} + +class SubjectButton extends StatelessWidget { + const SubjectButton( + {this.subject, this.color1, this.color2, this.address, this.navigateTo}); + + final Widget navigateTo; + final String subject; + final Color color1; + final Color color2; + final String address; + + @override + Widget build(BuildContext context) { + double height = MediaQuery.of(context).size.height; + double width = MediaQuery.of(context).size.width; + return GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return navigateTo; + }, + ), + ); + }, child: Padding( - padding: const EdgeInsets.all(15), - child: Center( - child: Column( - children: [ - ClipOval( - child: Center( - child: Container( - color: Color.fromRGBO(46, 49, 61, 1), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Builder(builder: (BuildContext context) { - return IconButton( - iconSize: 40, - // ignore: deprecated_member_use - color: Theme.of(context).textTheme.body1.color, - icon: Icon(icon), - splashColor: Color.fromRGBO(10, 71, 131, 1), - highlightColor: Color.fromRGBO(10, 71, 131, 1), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => pageToOpen)); - }, - ); - }), - ), + padding: const EdgeInsets.only(top: 8.0, bottom: 8.0), + child: Container( + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 2.0, horizontal: 5.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "$subject", + style: TextStyle( + fontSize: 28.0, + color: Colors.white, + fontFamily: 'Questrial'), ), - ), - ), - Padding( - padding: const EdgeInsets.fromLTRB(0, 12, 0, 0), - child: Text( - text, - style: TextStyle( - fontSize: 16, - // ignore: deprecated_member_use - color: Theme.of(context).textTheme.body1.color, + CircleAvatar( + backgroundImage: AssetImage("$address"), + radius: 27.0, ), - ), - ) - ], - )), + ], + ), + ), + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topLeft, + end: Alignment.bottomRight, + colors: [color1, color2]), + borderRadius: BorderRadius.only( + topRight: Radius.circular(100.0), + bottomRight: Radius.circular(100.0), + ), + ), + height: height / 10, + width: width / 1.02, + ), + ), + ); + } +} + +class PositionedRoutingButton extends StatelessWidget { + const PositionedRoutingButton({ + Key key, + @required this.height, + @required this.width, + }) : super(key: key); + + final double height; + final double width; + + @override + Widget build(BuildContext context) { + return Positioned( + top: height / 4, + left: width / 25, + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) { + return AttendancePage(); + }, + ), + ); + }, + child: CircleAvatar( + radius: 30.0, + backgroundImage: AssetImage('assets/homepageImages/attendance.jpg'), + ), ), ); } } + +final subjectButtonWidgets = Column( + children: [ + SubjectButton( + navigateTo: SubjectPage( + initialPage: 20, + subjectName: 'Communication Skills', + imagePath: "assets/subjectPageImages/communication_skill.webp", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Communication Skills", + color1: Colors.deepPurple, + color2: Colors.lightBlueAccent, + address: "assets/homepageImages/cs.png", + ), + SubjectButton( + navigateTo: SubjectPage( + initialPage: 19, + subjectName: 'Data Structures', + imagePath: "assets/subjectPageImages/dsa.webp", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Data Structures", + color1: Colors.black, + color2: Colors.black12, + address: "assets/homepageImages/ds.png", + ), + SubjectButton( + navigateTo: SubjectPage( + initialPage: 21, + subjectName: 'Web Designing', + imagePath: "assets/subjectPageImages/web_design.webp", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Web Designing", + color1: Colors.lightBlueAccent, + color2: Colors.lightGreen, + address: "assets/homepageImages/wd.png", + ), + SubjectButton( + navigateTo: SubjectPage( + initialPage: 17, + subjectName: 'Mathematics', + imagePath: "assets/subjectPageImages/maths.png", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Mathematics", + color1: Colors.red, + color2: Colors.yellow, + address: "assets/homepageImages/mathFinal.jpg", + ), + SubjectButton( + navigateTo: SubjectPage( + initialPage: 22, + subjectName: 'Application Programming', + imagePath: "assets/subjectPageImages/application_dev.jpeg", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Application Programming", + color1: Color(0xFFFC7170), + color2: Color(0xFFEFB8B0), + address: "assets/homepageImages/ad.png", + ), + SubjectButton( + navigateTo: SubjectPage( + initialPage: 18, + subjectName: 'Digital Electronics', + imagePath: "assets/subjectPageImages/dig_elec.gif", + quote: "Maths is the language in which god has written the universe.", + ), + subject: "Digital Electronics", + address: "assets/homepageImages/de.png", + color1: Colors.orange, + color2: Colors.yellow, + ), + ], +); diff --git a/pubspec.lock b/pubspec.lock index 2975f3d..5da335d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.6.1" backdrop: dependency: "direct main" description: @@ -307,7 +307,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0" + version: "1.8.1" stack_trace: dependency: transitive description: @@ -349,7 +349,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.3.0" typed_data: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index e436c51..551f792 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,20 +1,8 @@ name: iiit_sonepat_stable description: College App made by students of IIIT Sonepat for the students of IIIT Sonepat -# The following line prevents the package from being accidentally published to -# pub.dev using `pub publish`. This is preferred for private packages. -publish_to: "none" # Remove this line if you wish to publish to pub.dev +publish_to: "none" -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html version: 1.0.0+1 environment: @@ -33,25 +21,16 @@ dependencies: flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. - # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 dev_dependencies: flutter_test: sdk: flutter -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. + uses-material-design: true - # To add assets to your application, add an assets section, like this: assets: - assets/images/logo.png - assets/images/mann.jpg @@ -59,30 +38,14 @@ flutter: - assets/images/diddi.jpg - assets/images/rajiv.jpg - assets/images/class.png - - assets/byAditya/ + - assets/homepageImages/ - assets/subjectPageImages/ - assets/subjectPageImages/maths.png - assets/subjectPageImages/web_design.webp - assets/subjectPageImages/ - assets/iiit_sonepat_syllabus.pdf - assets/images/IIIT Sonepat Logo.png - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages fonts: - family: MonoLisa fonts: