diff --git a/star_in_me_app/lib/onboarding/UI4.dart b/star_in_me_app/lib/onboarding/UI4.dart index ba65469..3f52b12 100644 --- a/star_in_me_app/lib/onboarding/UI4.dart +++ b/star_in_me_app/lib/onboarding/UI4.dart @@ -1,280 +1,346 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; - -final TextEditingController clg = TextEditingController(); -final TextEditingController mail = TextEditingController(); -final TextEditingController designation = TextEditingController(); -final TextEditingController linkedin = TextEditingController(); +import 'dart:async'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:star_in_me_app/onboarding/UI5.dart'; +import 'package:star_in_me_app/onboarding/imageupload.dart'; class UI4 extends StatelessWidget { static final onboardingUi4 = '/onboardingUI4'; + + final TextEditingController collegeController = TextEditingController(); + final TextEditingController mailController = TextEditingController(); + final TextEditingController designationController = TextEditingController(); + final TextEditingController linkedInController = TextEditingController(); + + String organizationName, mailId, designation, linkedInProfile; + final _formKey = GlobalKey(); + bool showSpinner = false; + @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - backgroundColor: Colors.white, - leading: Padding( - padding: const EdgeInsets.all(10.0), + backgroundColor: Colors.deepPurple[500], + leading: Container( + margin: EdgeInsets.all(10.0), + // padding: const EdgeInsets.all(10.0), child: Image( image: AssetImage("images/logo.png"), ), ), elevation: 15, actions: [ - Center( + Container( + margin: EdgeInsets.all(10), + padding: EdgeInsets.all(10), child: Text( "STEP 1", style: TextStyle( - color: Colors.black, - fontSize: 20.0, + color: Colors.deepPurple[500], + fontSize: 17.0, fontWeight: FontWeight.w500), ), + decoration: BoxDecoration( + color: Colors.white, + shape: BoxShape.rectangle, + borderRadius: BorderRadius.circular(20), + ), ) ], ), body: SingleChildScrollView( child: Container( - padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 8.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - SizedBox( - height: 30.0, - ), - - Text( - "Let's Complete your profile ", - style: TextStyle( - color: Color(0xff4f439a), - fontSize: 30.0, - fontWeight: FontWeight.bold, - ), - textAlign: TextAlign.start, - ), - //), - // ), - // Padding( - // padding: const EdgeInsets.only(top: 10.0, left: 22.0), - // child: - //Expanded( - //flex: 1, - //child: - Padding( - padding: const EdgeInsets.symmetric(vertical: 15.0), - child: Text( - "This will help us know your professional experience for connections.", - style: TextStyle( - color: Colors.grey.shade600, - fontSize: 20.0, - fontWeight: FontWeight.bold), - ), - ), - SizedBox( - height: 20.0, - ), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), - child: TextFormField( - controller: clg, - maxLines: 1, - cursorColor: Color(0xff4f439a), - keyboardType: TextInputType.text, - autofocus: false, - decoration: InputDecoration( - - labelText: 'College/Company/Organization', - labelStyle: TextStyle( - color: Color(0xff4f439a), - fontSize: 16.0 - ), - focusedBorder: OutlineInputBorder( - - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - color: Color(0xff4f439a) - ) - ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - // color: Colors.deepPurple, - //width: 2.0 - ) - ) + padding: EdgeInsets.all(10.0), + margin: EdgeInsets.all(10.0), + child: Form( + key: _formKey, + // color: Colors.white, + // padding: EdgeInsets.symmetric(horizontal: 25.0, vertical: 8.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + SizedBox( + height: 30.0, ), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), - child: TextFormField( - controller: mail, - maxLines: 1, - cursorColor: Color(0xff4f439a), - keyboardType: TextInputType.text, - autofocus: false, - decoration: InputDecoration( - labelText: 'pratiksha.g@xelp.com', - labelStyle: TextStyle( - color: Color(0xff4f439a), - fontSize: 16.0 - ), - - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - color: Color(0xff4f439a) - ) - ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide())), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), - child: TextFormField( - controller: designation, - cursorColor: Color(0xff4f439a), - maxLines: 1, - keyboardType: TextInputType.text, - autofocus: false, - decoration: InputDecoration( - labelText: 'Designation', - labelStyle: TextStyle( - color: Color(0xff4f439a), - fontSize: 16.0 - ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - color: Color(0xff4f439a) + Text( + "Let's Complete your profile ", + style: TextStyle( + color: Colors.deepPurple[500], + fontSize: 28.0, + fontWeight: FontWeight.bold, + ), + textAlign: TextAlign.start, + ), + //), + // ), + // Padding( + // padding: const EdgeInsets.only(top: 10.0, left: 22.0), + // child: + //Expanded( + //flex: 1, + //child: + Padding( + padding: const EdgeInsets.symmetric(vertical: 15.0), + child: Text( + "This will help us know your professional experience for connections.", + style: TextStyle( + color: Colors.grey.shade600, + fontSize: 18.0, + fontWeight: FontWeight.bold), + ), + ), + SizedBox( + height: 15.0, + ), + Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), + child: TextFormField( + controller: collegeController, + maxLines: 1, + cursorColor: Colors.deepPurple[500], + keyboardType: TextInputType.text, + autofocus: false, + decoration: InputDecoration( + labelText: 'College/Company/Organization', + labelStyle: TextStyle( + color: Colors.deepPurple[500], + fontSize: 16.0 + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide( + color: Colors.deepPurple[500] + ) + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide( + color: Colors.deepPurple[500], + //width: 2.0 + ) ) ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide())), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), - child: TextFormField( - controller: linkedin, - maxLines: 1, - cursorColor: Color(0xff4f439a), - keyboardType: TextInputType.text, - autofocus: false, - decoration: InputDecoration( - labelText: 'Linkedin Profile', - labelStyle: TextStyle( - color: Color(0xff4f439a), - fontSize: 16.0 + onChanged: (value) { + organizationName = value; + }, + validator: (value) { + if (value.isEmpty) { + return "Enter Your Organization Name"; + } + return null; + }, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), + child: TextFormField( + controller: mailController, + maxLines: 1, + cursorColor: Colors.deepPurple[500], + keyboardType: TextInputType.text, + autofocus: false, + decoration: InputDecoration( + labelText: 'pratiksha.g@xelp.com', + labelStyle: TextStyle( + color: Colors.deepPurple[500], + fontSize: 16.0 + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide( + color: Colors.deepPurple[500] + ) + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide())), + onChanged: (value) { + mailId = value; + }, + validator: (value) { + if (value.isEmpty) { + return "Enter Your Email ID"; + } + return null; + }, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), + child: TextFormField( + controller: designationController, + cursorColor: Colors.deepPurple[500], + maxLines: 1, + keyboardType: TextInputType.text, + autofocus: false, + decoration: InputDecoration( + labelText: 'Designation', + labelStyle: TextStyle( + color: Colors.deepPurple[500], + fontSize: 16.0 + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide( + color: Colors.deepPurple[500], + ) + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide())), + onChanged: (value) { + designation = value; + }, + validator: (value) { + if (value.isEmpty) { + return "Enter Your Designation"; + } + return null; + }, + ), + ), + Padding( + padding: const EdgeInsets.only(top: 10.0, bottom: 5.0), + child: TextFormField( + controller: linkedInController, + maxLines: 1, + cursorColor: Colors.deepPurple[500], + keyboardType: TextInputType.text, + autofocus: false, + decoration: InputDecoration( + labelText: 'Linkedin Profile', + labelStyle: TextStyle( + color: Colors.deepPurple[500], + fontSize: 16.0 + ), + focusedBorder: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide( + color: Colors.deepPurple[500] + ) + ), + border: OutlineInputBorder( + borderRadius: BorderRadius.circular(15.0), + borderSide: BorderSide())), + onChanged: (value) { + linkedInProfile = value; + }, + validator: (value) { + if (value.isEmpty) { + return "Enter Your LinkedIn Profile URL"; + } + return null; + }, + ), + ), + SizedBox( + height: 50.0, + ), + Padding( + padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), + child: Text( + "Upload a professional headshot", + style: TextStyle( + color: Colors.purple[300], + fontSize: 25.0, + fontWeight: FontWeight.bold, ), - focusedBorder: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide( - color: Color(0xff4f439a) - ) + ), + ), + Padding( + padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), + child: Text( + "Your picture is logo of your personal brand!", + style: TextStyle( + color: Colors.grey, + fontSize: 18.0, + fontWeight: FontWeight.w700, ), - border: OutlineInputBorder( - borderRadius: BorderRadius.circular(15.0), - borderSide: BorderSide())), - ), - ), - SizedBox( - height: 50.0, - ), - Padding( - padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), - child: Text( - "Upload a professional headshot ", - style: TextStyle( - color: Colors.black, - fontSize: 25.0, - fontWeight: FontWeight.bold, + ), ), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), - child: Text( - "Your picture is logo of your personal brand! ", - style: TextStyle( - color: Colors.grey, - fontSize: 19.0, - fontWeight: FontWeight.w700, + SizedBox( + height: 20.0, ), - ), - ), - SizedBox( - height: 20.0, - ), - Row( - textBaseline: TextBaseline.alphabetic, - mainAxisAlignment: MainAxisAlignment.start, - //scrossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon( - Icons.play_arrow, - size: 35.0, - color: Color(0xff4f439a), + Center( + child: Row( + textBaseline: TextBaseline.alphabetic, + mainAxisAlignment: MainAxisAlignment.start, + //crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox(width: 5), + Icon( + Icons.play_arrow, + size: 35.0, + color: Colors.deepPurple[500], + ), + SizedBox(width: 10), + Text( + 'WATCH DEMO VIDEO', + style: TextStyle( + color: Colors.deepPurple[500], + fontSize: 23.0, + fontWeight: FontWeight.bold), + ) + ], + ), ), - Text( - 'WATCH DEMO VIDEO', - style: TextStyle( - color: Color(0xff4f439a), - fontSize: 23.0, - fontWeight: FontWeight.bold), - ) - ], - ), - SizedBox( - height: 15.0, - ), - ButtonTheme( - minWidth: double.infinity, - height: 50.0, - child: OutlineButton( - onPressed: () => print("BUTTON PRESSED"), - child: Text( - "ADD PHOTO OR VIDEO", - style: TextStyle(color:Color(0xff4f439a), fontSize: 17.0), + SizedBox( + height: 15.0, ), - borderSide: BorderSide( - color: Color(0xff4f439a), - width: 1, + ButtonTheme( + minWidth: double.infinity, + height: 50.0, + child: OutlineButton( + onPressed: () { + Navigator.pushNamed(context, Image_Upload.imageupload); + }, + child: Text( + "ADD PHOTO OR VIDEO", + style: TextStyle( + color: Colors.deepPurple[500], fontSize: 17.0), + ), + borderSide: BorderSide( + color: Colors.deepPurple[500], + width: 1, + ), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0), + ), + ), ), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(5.0), + Padding( + padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), + child: Text( + "You can upload upto 5 photos or videos", + style: TextStyle( + color: Colors.grey, + fontSize: 19.0, + fontWeight: FontWeight.w400, + ), + ), ), - ), - ), - Padding( - padding: const EdgeInsets.only(top: 8.0, bottom: 10.0), - child: Text( - "You can uplaod upto 5 photos or videos", - style: TextStyle( - color: Colors.grey, - fontSize: 19.0, - fontWeight: FontWeight.w400, + Divider(thickness: 1), + ButtonTheme( + height: 50, + minWidth: 150, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(5.0)), + child: RaisedButton( + onPressed: () => uploadDetails(context), + child: Text("NEXT", style: TextStyle( + color: Colors.white, + fontSize: 20.0 + ),), + color: Colors.deepPurple[500], + ), ), - ), + SizedBox(height: 30), + ], ), - Divider(thickness: 1), - ButtonTheme( - height: 50, - minWidth: 150, - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5.0) ), - child: RaisedButton( - onPressed:()=> print("NEXT button pressed"), - child: Text("NEXT", style: TextStyle( - color: Colors.white, - fontSize: 20.0 - ),), - color: Color(0xff4f439a), - ), - ) - ], - ), - ), + )), ), // bottomNavigationBar: BottomAppBar( // color: Colors.grey, @@ -295,4 +361,46 @@ class UI4 extends StatelessWidget { // ), ); } + + void uploadDetails(BuildContext context) async { + if (_formKey.currentState.validate()) { + showSpinner = true; + final snapshot = await FirebaseFirestore.instance.collection( + "user_profile").doc(mailId).get(); + if (snapshot == null || snapshot.exists) { + Navigator.pushNamed(context, UI5.onboardingUi5); + } + else { + try { + FirebaseFirestore.instance.collection("user_profile").add({ + "mail_id": mailId, + "designation": designation, + "organization": organizationName, + "linked_in_profile": linkedInProfile + }); + Fluttertoast.showToast( + msg: "Data added successfully", + gravity: ToastGravity.BOTTOM, + toastLength: Toast.LENGTH_SHORT, + timeInSecForIosWeb: 1, + backgroundColor: Colors.deepPurple[500], + fontSize: 16, + textColor: Colors.white + ); + Navigator.pushNamed(context, UI5.onboardingUi5); + } catch (e) { + print(e); + Fluttertoast.showToast( + msg: e.message, + gravity: ToastGravity.BOTTOM, + toastLength: Toast.LENGTH_SHORT, + timeInSecForIosWeb: 1, + backgroundColor: Colors.deepPurple[500], + fontSize: 16, + textColor: Colors.white + ); + } + } + } + } } diff --git a/star_in_me_app/lib/onboarding/UI5.dart b/star_in_me_app/lib/onboarding/UI5.dart index 2cdf90e..49bd99c 100644 --- a/star_in_me_app/lib/onboarding/UI5.dart +++ b/star_in_me_app/lib/onboarding/UI5.dart @@ -1,7 +1,10 @@ import 'package:flutter/material.dart'; +import 'package:star_in_me_app/onboarding/UI6.dart'; +import 'package:star_in_me_app/onboarding/UI7.dart'; class UI5 extends StatelessWidget { static final onboardingUi5 = '/onboardingUI5'; + @override Widget build(BuildContext context) { return new MaterialApp( @@ -19,7 +22,7 @@ class UI5 extends StatelessWidget { title: Text( 'I am a', style: TextStyle( - color: Color(0xFF4F439A), + color: Colors.deepPurple[500], fontSize: 30.0, fontWeight: FontWeight.bold, ), @@ -29,42 +32,47 @@ class UI5 extends StatelessWidget { ), SliverFillRemaining( hasScrollBody: false, - child: Column( - children: [ - SizedBox( - height: 60.0, - ), - FlatButton( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 70.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - Icon(Icons.account_circle_outlined, size: 40,), - Text(' Student', style: TextStyle(fontSize: 16),), - ], + child: Center( + child: Column( + children: [ + SizedBox( + height: 60.0, + ), + FlatButton( + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 50.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.account_circle_outlined, size: 40,), + Text(' Student', style: TextStyle(fontSize: 16),), + ], + ), ), + onPressed: () { + Navigator.pushNamed(context, UI6.onboardingUi6); + }, ), - onPressed: () {}, - ), - SizedBox( - height: 50.0, - ), - FlatButton( - child: Padding( - padding: const EdgeInsets.symmetric(horizontal: 70.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - children: [ - - Icon(Icons.account_circle_sharp, size: 40,), - Text(' Working Professional', style: TextStyle(fontSize: 16),), - ], + SizedBox( + height: 30.0, + ), + FlatButton( + child: Container( + padding: const EdgeInsets.symmetric(horizontal: 50.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + children: [ + Icon(Icons.account_circle_sharp, size: 40,), + Text(' Working Professional', style: TextStyle(fontSize: 16),), + ], + ), ), + onPressed: () { + Navigator.pushNamed(context, UI7.onboardingUi7); + }, ), - onPressed: () {}, - ), - ], + ], + ), ), ), ], diff --git a/star_in_me_app/lib/onboarding/onbordingPage.dart b/star_in_me_app/lib/onboarding/onbordingPage.dart index 0c2d538..457513b 100644 --- a/star_in_me_app/lib/onboarding/onbordingPage.dart +++ b/star_in_me_app/lib/onboarding/onbordingPage.dart @@ -26,30 +26,29 @@ class _onboardingPageState extends State { UI3(), ]; - @override Widget build(BuildContext context) { final height = MediaQuery.of(context).size.height; return SafeArea( child: Scaffold( - backgroundColor: Colors.white, - body: SafeArea( - child: ListView( - children: [ - Container( - color: Color(0xff4f439a), - child: Row( - children: [ - Padding( - padding: const EdgeInsets.fromLTRB(10.0, 5.0, 0.0, 0.0), - child: Image.asset('images/logo.png', + backgroundColor: Colors.white, + body: SafeArea( + child: ListView( + children: [ + Container( + color: Color(0xff4f439a), + child: Row( + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(10.0, 5.0, 0.0, 0.0), + child: Image.asset('images/logo.png', height: 50.0, width: 50.0), ), ], ), ), - Container( - child: CarouselSlider( - options: CarouselOptions( + Container( + child: CarouselSlider( + options: CarouselOptions( height: 0.70 * height, viewportFraction: 1.0, enlargeCenterPage: false, @@ -72,29 +71,30 @@ class _onboardingPageState extends State { } }); }), - items: pageList.map((item) { - return Builder(builder: (BuildContext context) { - return item; - }); - }).toList(), + items: pageList.map((item) { + return Builder(builder: (BuildContext context) { + return item; + }); + }).toList(), + ), ), - ), - Padding( - padding: const EdgeInsets.only(top: 30), - child: Center( - child: DotsIndicator( - dotsCount: 3, - position: _currentPage.toDouble(), - decorator: DotsDecorator( - color: Color(0xff999999), // Inactive color - activeColor: Color(0xff4f439a), + Padding( + padding: const EdgeInsets.only(top: 30), + child: Center( + child: DotsIndicator( + dotsCount: 3, + position: _currentPage.toDouble(), + decorator: DotsDecorator( + color: Color(0xff999999), // Inactive color + activeColor: Color(0xff4f439a), + ), ), ), ), - ), - ], + ], + ), ), - ), - )); + ) + ); } }