Professional Documents
Culture Documents
Psysch Diagnosis Mobile App 1214
Psysch Diagnosis Mobile App 1214
By
BACHELOR OF SCIENEC
IN
COMPUTER SCIENCE
Signatures of User
We would like to express our deepest appreciation to our Supervisor, Mr. Asif Aziz,
coordinator, Department of Computer Science, GC University, Faisalabad Layyah Campus, who
always guided us and gave us moral support in every step of our degree program as well as our
project.
We would like to express our deepest appreciation to our Mr. M. Tayyiab Shah Naqvi
Lecturer, Department of Computer Science, GC University, Faisalabad Layyah Campus, who
also guided us and gave us moral support in every step of our degree program as well as our
project.
We would also like to thank Mr. Yasir Arfat (Lecturer, Department of Computer
Science, GC University Faisalabad Layyah Campus),for her constant scholarly guidance,
skillful advice and untiring zeal, which were of immense value for the conduction of this
research work. Her cheerful attitude and warm encouragement always inspired us to work hard
to achieve goal of obtaining degree.
We are immensely grateful to Mr. Ali Raza Shah (Head Of Department, GC University
Faisalabad Layyah Campus) for providing us conducive environment to complete our project
successfully.
We would not be doing justice without acknowledging the invaluable moral support and
constant encouragement provided to us by our affectionate parents.
M. Asif Raza
M. Afaq
Summar Abbass
To
I, the Supervisor, certifies that the contents and form of the project submitted by
M. Asif Raza (Roll no.1422)
Muhammad Afaq (Roll no.1)
Summar Abbass(1400)
Have been found satisfactory for the award of the degree.
Internal Examiner:
Name:
Signature:
Internal Examiner:
Name:
Signature:
Lecturer: (Government College University Faisalabad)
Department of Computer Science
External Examiner:
Name:
Signature:
TABLE OF CONTENTS
1.1 Introduction............................................................................................................................1
1.2 Background............................................................................................................................1
1.3 Purpose..................................................................................................................................1
1.4 Scope......................................................................................................................................2
1.5 Objective................................................................................................................................2
1.6.1 Stakeholders....................................................................................................................2
3.2 Forming Use Case Diagram with Candidate and Use Cases...............................................14
4.1.1 Definition:.....................................................................................................................17
4.2.1 Definition:.....................................................................................................................18
4.2.2 Diagram:.......................................................................................................................19
4.3.2 Diagram:.......................................................................................................................20
4.4.1 Definition:.....................................................................................................................20
4.4.2 Diagram:.......................................................................................................................21
4.5.1 Definition:.....................................................................................................................21
4.5.2 Diagram:.......................................................................................................................22
4.6.1 Definition:.....................................................................................................................22
4.6.2 Diagram:.......................................................................................................................23
4.7.1 Definition:.....................................................................................................................23
4.7.2 Diagram:.......................................................................................................................24
4.8.1 Definition:.....................................................................................................................24
4.8.2 Diagram:.......................................................................................................................25
4.9.1 Definition:.....................................................................................................................25
4.9.2 Diagram:.......................................................................................................................26
5.1.1 Defination.....................................................................................................................27
5.1.2 Diagram........................................................................................................................27
5.2.1 Definition......................................................................................................................28
5.2.2 Diagram........................................................................................................................28
5.3.1 Definition......................................................................................................................28
5.3.2 Diagram........................................................................................................................29
Test Cases..................................................................................................................................33
Testing Results...........................................................................................................................35
Code...............................................................................................................................................40
ExampleInstrumentedTest.Dart.................................................................................................40
ABSTRACT
The "Psych Diagnosis Mobile App" is intended to automate the current manual system using
computerized hardware and state-of-the-art computer software, satisfying clients' needs by allowing
clients' valuable data and information to be stored for a longer period of time with simple access and
manipulation. The required application may be easily accessed and used. By using this application,
users may see and maintain track of digital records without having to make additional inputs. For
maximum effectiveness and improved diagnosis service, the project outlines how to handle user data.
Using the 'Psych diagnosis Mobile App', a mobile-based application, any business may keep the
information about its patients. In order to manage a large number of patients, their diagnoses, and the
treatments that must be made for the benefit of the company's patients, the psych diagnosis app was
created. Each patient will have a login (a special ID). The number of days will be provided based on
the date of diagnosis and the date the diagnosis is produced. The patient's department and job will
determine the base diagnosis.
CHAPTER-1
Introduction to the Problem
1.2 Background
To explore the challenges that companies have while creating and promoting patient punctuality
while operating inside "psych diagnosis mobile apps." The key study issue in the "diagnosis
management" context has developed as the rise of both corporate and channel benefits.
Examining "psych diagnosis mobile apps" in the context of the opportunities and preventive
measures that businesses have when creating and promoting the diagnoses of patients.
1.3 Purpose
The purpose of this project is to develop a mobile app based on "Psych Diagnosis" for any office
or organization, instead of performing manual management of psych diagnosis for the patients. For
example, adding new patients, deleting old patients, total attendance of each patient, etc. From this
mobile app, we shall make it possible for the working staff of offices to handle patients' psych
diagnoses swiftly and simply. It will provide quick and fast results and reduce the manual
implementation of office work.
1
1.4 Scope
The solutions for handling patient personal data, managing leaves, handling patient actions,
properly recording patient attendance, and system authentication and user authorization are all
included in the project's scope. Based on their allotted access privileges, specific users with
specific role types, such as admin, will be allowed to modify the system database. This
application will offer a way for managing attendance and pay.
1.5 Objective
The objectives of Psysch Diagnosis Mobile App are as follows:
1. Add Patient
2. Show list of all Patient
3. Manage Patient Issues
4. View Patient Attandece
5. View Patient Status
6. Manage Patient Issues
• Doctor (Admin)
• Owner of Appp
• Doctor(Admin)
• Patient Report
2
A string of letters followed by a number, such as REQ1.1, serves as the distinctive identifying
number for each need. When the need is formed, these numbers are given. When sections or
requirements are added to or removed from this document, the requirement numbers must remain
static and unaltered.
Additionally, a succinct title is given to each criterion so that it can be found in the table of contents.
A concise one- or two-sentence explanation of the requirement's purpose follows the title. An
itemised list of properties with the following definitions makes up the remaining portion of the
requirements shell:
3
Verification:
The developer and tester must come to an understanding on what will be tested to ensure that the
product satisfies the need. It alludes to a comprehensive set of tests, but not the precise tests. If
they are included in the need, implementation details could be included in this.
Priority:
4
Known Dependencies:
Other criteria that would need to be altered if this one change is known as dependencies. For
example, if the requirement is to add a new feature to the Psych diagnosis mobile app, then the
dependencies might include the requirement to update the user interface, the requirement to add
new data fields to the database, and the requirement to modify the existing algorithms.
Known Conflicts:
Contradictory requirements to this one. For example, if the requirement is to add a new feature to
the Psych diagnosis mobile app, then a conflict might be the requirement to keep the mobile app
as simple as possible.
Source/Date:
Who and when brought up this requirement? This will provide a point of contact for questions.
The source may be an individual or a group. For example, the source of the requirement to add a
new feature to the psych diagnosis mobile app might be a clinical psychologist who works at a
mental health clinic.
History
A record of the requirements' modifications. This might include the name of a CVS tag and the
date the requirement was put into effect
5
CHAPTER-2
Software Requirement Specification
6
2.1.4 Assumption and Dependencies
It is anticipated that alumni data will be provided for the project at some point after it has been
completed. Test data will be used up until then to provide the presentations' showcase. It is
deemed necessary that the user be familiar with both the mobile app and using an Android
phone. being a mobile-based application, the application. We don't necessarily need to be
connected to the internet.
Salary Management system has very simple and easy interface and it is very easy to use.
The experience may be modified to suit the demands of the user by altering the content,
layout, and system functioning. Items may be rearranged on an interface to prioritize user
preferences, fascinating subjects can be chosen, and colors, typefaces, and other visual
design elements can be changed.
Implementation of the analytics feature is the essential component that is used to track
and measure user activity inside the app in order to better understand their behavior. In
order to improve the user experience and ultimately the company's profitability, it is
helpful to determine the marketing plan.
The main component that has to be used to safeguard data privacy. To keep data safe and
secure, the app should have security features and security enhancements. It aids in
boosting and enhancing the mobile app's trust factor.
7
2.3 External Interface requirements
2.3.1 User Interfaces
Give an explanation of the logical features of each user interface for the aplication. This might
contain standard buttons and functionalities that must show on every screen, layout restrictions,
sample screen pictures, any GUI standards or product family style guidelines that must be
followed, and more. Describe the program me elements that require a user interface. A separate
user interface specification should contain the specifics of the user interface design.
8
1000 Patient at once must be supported by the application.
User-Interface
Within 5 seconds, the user interface screen must reply.
Conformity
The application has to adhere to the Android accessibility requirements.
9
CHAPTER-3
Analysis (Use case Model)
UC # 1 Ref: Req. #1
Stakeholders Admin
Action Response
10
Admin.
Extensions No extension
Frequency of
Always login to the Admin panel.
Occurrence
UC # 2 Ref: Req. #2
Stakeholders Admin
Action Response
11
5. Add email
Frequency of
Update any time
Occurrence
UC # 3 Ref: Req. #3
Stakeholders Admin/Citizen
Action Response
Main Success Scenario
1. Click on Patient list and
12
view list of all the Patients.
Frequency of Admin Panel check Multiple times in a day and can check
Occurrence the records of Patients.
UC # 4 Ref: Req. #4
Stakeholders Admin
13
Action Response
Frequency of Admin and user will also check once a times in a day and can
Occurrence check the records of attendance.
14
3.2 Forming Use Case Diagram with Candidate and Use Cases
3.2.1 Use Case diagram: User
Can review on
Doctor opinion
Will add
himself
first
Add new
Patient
Mark
Patient Disease
Generate Patient
Disease report
report Edit Patient
15
3.3 Describe the Events Flow for Use Case
An outsider should be able to quickly comprehend the interactions between the actor(s) and the
application from the sequence of events. The sequence of events should show what the system
really does, not how it is intended to carry out the needed action.
Design
4.1 Architecture Diagram
4.1.1 Definition:
An application ssytem architecture acts as a blueprint. It establishes a communication and
coordination mechanism among components and offers an abstraction to control the complexity
of the system.
It outlines an organised approach to address all technical and practical needs while
maximising standard quality characteristics like performance and security.
Additionally, it entails a number of important organisational decisions connected to
application development, and each of these choices can have a substantial influence on
the end product's quality, maintainability, performance, and overall success. These
selections include:
o Choice of the structural components and their connections, which make up the
system.
o As stated in the interactions between those elements.
o These structural and behavioral components are put together to form a sizable
subsystem.
o Architectural choices support corporate goals.
o The arrangement is guided by architectural trends.
It comes after the domain study, requirements analysis, and risk analysis and before the detailed
design, coding, integration, and testing.
17
Fig 4.1.1 Architecture Diagram
18
4.2.2 Diagram:
19
4.3.2 Diagram:
20
4.4.2 Diagram:
21
in time.
22
4.5.2 Diagram:
23
4.6.2 Diagram:
24
4.7.2 Diagram:
25
4.8.2 Diagram:
26
4.9.2 Diagram:
27
CHAPTER-5
Implementation
5.1 Component Diagram
5.1.1 Defination
A component diagram, often called a UML component diagram, shows how the physical
parts of a system are wired up and organised. To represent implementation specifics and
ensure that all necessary functionalities of the system are covered by planned
development, component diagrams are frequently created.
5.1.2 Diagram
28
5.2 Deployment Diagram
5.2.1 Definition
Deployment diagrams represent a system's physical architecture. The links between the system's
hardware and software components as well as the physical distribution of the processing are
displayed in deployment diagrams.
5.2.2 Diagram
29
separate parts that can be independently adjusted, changed, replaced, and altered thanks to
DBMS design. Understanding a database's components is also beneficial.
5.3.2 Diagram
30
Fig 5.3.2 2 tier Architecture
31
CHAPTER-6
32
6.2.5 Graph Base Testing
In Graph base testing we will test the Prior to attempting to address certain components of the
graph model for the testing modules of applications,
33
Test Cases
Test Cases Objectives
6
Make sure that the application run at
android successfully.
34
Check if the correct data is getting
8
saved in the database upon a successful
page addition.
11
Check admin can generate the report.
35
Testing Results
Table 0-1: Testing Result
Make sure that admin can add new Test successful None
employee.
36
Make sure that the application run
Test successful None
at android successfully.
37
CHAPTER-7
Android System:
The Android mobile operating system was created by the Open Handset Alliance, which is
led by Google. For Android, there is a huge developer community that produces software to
improve the functioning of the devices. With more than 10 billion downloads, its Android
Market offers 450,000 apps.
38
APPENDIX A:
USER DOCUMENT
Appendix A: User documentation
What exactly is user manuals?
User documentation is the information you provide to the customer to help them utilise your
product or service more effectively. User guides, instruction manuals, and user manuals are other
names for user documentation, which is intended to help consumers through the process of
learning about your product.
User manuals can be sent to customers through a variety of various techniques. It might be a
paper manual, a video tutorial, or an online knowledge base. You must ascertain the format that
would be most helpful to your customers and offer it to them.
39
Once they are operational, user guides are essentially free to maintain. Self-service
engagements cost just pennies, however live customer support conversations can cost up
to $12.
Agents now have more time to help clients who really need it since they don't have to
deal with regular, repeated questions. Additionally, when user documentation is easily
accessible, support employees may swiftly resolve customers' issues by pointing them to
the proper pages.
40
APPENDIX A:
Source code
Code:
ExampleInstrumentedTest.Dart
import 'package:flutter/material.dart';
import 'package:psysch_admin/splash%20screen.dart';
import 'package:firebase_core/firebase_core.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Psysch Diagnosis',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: SplashSacreen()
);
}
}
41
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:psysch_admin/HomeScreen.dart';
import 'package:psysch_admin/Log%20in%20Screen.dart';
class userState extends StatelessWidget {
@override
Widget build(BuildContext context) {
return StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (ctx, userSnapShot)
{
if (userSnapShot.data == null)
{
print('user is not logged in yet');
return Login();
}
else if (userSnapShot.hasData)
{
print('user is already logged in yet');
return HomeScreen();
}
else if (userSnapShot.hasError)
{
return const Scaffold(
body: Center(
child: Text(
('An error has been occurred.Try again late'), ), ), ); }
else if (userSnapShot.connectionState == ConnectionState.waiting)
return const Scaffold(
body: Center(
child: CircularProgressIndicator(),),);
return const Scaffold(
body: Center(
child: Text(
'Something went wrong'),),);},);}
);
}
}
42
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:psysch_admin/HomeScreen.dart';
import 'package:psysch_admin/Log%20in%20Screen.dart';
import 'package:firebase_auth/firebase_auth.dart';
class SplashSacreen extends StatefulWidget {
const SplashSacreen({Key? key}) : super(key: key);
@override
State<SplashSacreen> createState() => _SplashSacreenState();
}
class _SplashSacreenState extends State<SplashSacreen> {
void initState() {
super.initState();
Timer(Duration(seconds: 2),
()=>Navigator.pushReplacement(context,
MaterialPageRoute(builder:
(context) =>
FirebaseAuth.instance.currentUser!= null?HomeScreen():
//userState()
Login(),),),);}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
backgroundColor: Color(0xffFFFFFF),
body: SingleChildScrollView(child: Center(child: SingleChildScrollView(
child: Column(children: [Container(height: 630, alignment: Alignment.center,
child: Image.asset("assets/images/Logo.png", height: 200, width: 320, ), ),
SizedBox(height: 30,),
CircularProgressIndicator(color: Colors.blueAccent, ),
],
),),),),);
43
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:psysch_admin/signupScreen.dart';
import 'ForgotPassword.dart';
import 'HomeScreen.dart';
import 'colors.dart';
class Login extends StatefulWidget {
const Login({Key? key}) : super(key: key);
@override
State<Login> createState() => _LoginState();
}
bool _passwordVisible = false;
class _LoginState extends State<Login> {
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
void login() async {
String email = emailController.text.trim();
String password = passwordController.text.trim();
emailController.clear();
passwordController.clear();
try{
if ( email == ""|| password == ""){ print("plz fill all the fields ");}
else {
UserCredential userCredential =
await FirebaseAuth.instance.signInWithEmailAndPassword(email: email, password: password);
if(userCredential.user !=null){
Navigator.push(context,CupertinoPageRoute(builder:(context)=>HomeScreen()),);}}
} on FirebaseAuthException catch(ex){print(ex.code.toString());}}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
automaticallyImplyLeading: false,
title: Text('Login', style: appbarStyle, ), elevation: 0, backgroundColor: Colors.white, ),
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset("assets/images/Logo.png", height: 121,width: 135),
Align(alignment: Alignment.center,
child: Text('Welcome back!', style: TextStyle(fontSize: 16,
fontWeight: FontWeight.w300,
color: Colors.black,),),),
SizedBox(height: 20,),
Container(
margin: EdgeInsets.symmetric(vertical: 20,),
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(
44
borderRadius: BorderRadius.circular(20),),
child: TextFormField(
cursorColor: buttonColor,
controller: emailController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 10,),
border: OutlineInputBorder(borderSide: BorderSide.none, ),
hintText: 'Email',
hintStyle: textFieldStyle,),),),),
SizedBox(height: 20, ),
Container(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),),
child: TextFormField(
obscureText: _obscureText,
cursorColor: buttonColor,
controller: passwordController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), borderSide: BorderSide(
color: buttonColor,),),
suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});},
child: Icon(
_obscureText
? Icons.visibility_off
: Icons.visibility,
color: buttonColor,),
contentPadding: EdgeInsets.only(left: 15, top: 15, right: 15, bottom: 15),
alignLabelWithHint: true,
labelStyle: TextStyle(color: Colors.blue),
hintText: 'Password', hintStyle: textFieldStyle,
46
import 'package:flutter/material.dart';
import 'Log in Screen.dart';
import 'VerificationScreen.dart';
import 'colors.dart';
class Signup extends StatefulWidget {
const Signup({Key? key}) : super(key: key);
@override
State<Signup> createState() => _SignupState();
}
bool _passwordVisible = false;
bool obscureText = true;
bool _obscureText = true;
class _SignupState extends State<Signup> {
TextEditingController nameController =TextEditingController();
TextEditingController lNameController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController cPasswordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 80,),
Image.asset("assets/images/Logo.png", height: 121, width: 135),
Align(alignment: Alignment.center,
child: Text("Let’s Get It Started!", style: TextStyle(fontSize: 16,
fontWeight: FontWeight.w300, color: Colors.black,),),),
Container(margin: EdgeInsets.symmetric(vertical: 20, ),
width: MediaQuery.of(context).size. Width / 1.30,
47
child: Card(elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),),
child: TextFormField(
cursorColor: buttonColor,
controller: nameController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(
color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 10,),
border: OutlineInputBorder(borderSide: BorderSide.none,),
hintText: 'First Name', hintStyle: textFieldStyle, ),
validator: (value) {
if (value!.isEmpty) {
return "First Name Required";
} else
return null;
},
),
),
),
Container(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20),),
child: TextFormField(cursorColor: buttonColor,
controller: lNameController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), borderSide: BorderSide(color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 10, ),
border: OutlineInputBorder(borderSide: BorderSide.none,),
hintText: 'Last Name', hintStyle: textFieldStyle,),
48
validator: (value) {
if (value!.isEmpty) {
return "Last Name Required";
} else
return null;
},
),
),
),
Container(
margin: EdgeInsets.symmetric(vertical: 20,),
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),),
child: TextFormField(
cursorColor: buttonColor,
controller: emailController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 10,),
border: OutlineInputBorder(borderSide: BorderSide.none,),
hintText: 'Email',
hintStyle: textFieldStyle,),
validator: (value) {
if (value!.isEmpty) {
return "Email Required";
} else
return null;
},
),
),
),
49
Container(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20), ),
child: TextFormField(
cursorColor: buttonColor,
controller: passwordController,
obscureText: obscureText,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: buttonColor,),),
hintText: 'Password',
hintStyle: textFieldStyle,
suffixIcon: GestureDetector(
onTap: () {
setState(() {
obscureText = !obscureText;
});
},
child: Icon(
obscureText
? Icons.visibility_off
: Icons.visibility, color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 15, top: 15, right: 15, bottom: 15),
alignLabelWithHint: true,
labelStyle: TextStyle(color: Colors.blue),
border: OutlineInputBorder(borderSide: BorderSide.none),),
textAlign: TextAlign.left, textAlignVertical: TextAlignVertical.center,),),),),
Container(
margin: EdgeInsets.symmetric(vertical: 20,),
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20), ),
50
child: TextFormField(cursorColor: buttonColor,
controller: cPasswordController,
obscureText: _obscureText,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color: buttonColor,),),
hintText: 'Confirm Password',
hintStyle: textFieldStyle,
suffixIcon: GestureDetector(
onTap: () {
setState(() {
_obscureText = !_obscureText;
});
},
child: Icon(
_obscureText
? Icons.visibility_off
: Icons.visibility, color: buttonColor,),),
contentPadding: EdgeInsets.only(left: 15, top: 15, right: 15, bottom: 15),
alignLabelWithHint: true,
labelStyle: TextStyle(color: Colors.blue),
border: OutlineInputBorder(borderSide: BorderSide.none),),
textAlign: TextAlign.left, textAlignVertical: TextAlignVertical.center,),),),
Container(
alignment: Alignment.center, padding: const EdgeInsets.only(top: 30,right: 5,left: 5),
child: Center(child:TextButton(
style: TextButton.styleFrom(backgroundColor: Color(0xff3F48CC),
minimumSize: Size(264, 44),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(25),),),
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (_){
return VerificationSacreeen(
FirstName : nameController.text,
LastName : lNameController.text,
51
Email : emailController.text,
Password : passwordController.text,
CPassword : cPasswordController.text,
); })); },
child: Text("SignUp", style: TextStyle(color: Colors.white,
fontWeight: FontWeight.w700, fontSize: 18,),),),),),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [Padding(padding: const EdgeInsets.only(),
child: Text("Already have an account?"),),
TextButton( onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (_){
return Login();
}));},
child: Text("Login",style: TextStyle(color: Color(0xff3F48CC),
fontSize: 16,
),),),]),],))));}
52
import 'package:flutter/material.dart';
import 'Log in Screen.dart';
import 'VerificationScreen.dart';
import 'colors.dart';
class Signup extends StatefulWidget {
const Signup({Key? key}) : super(key: key);
@override
State<Signup> createState() => _SignupState();
}
bool _passwordVisible = false;
bool obscureText = true; bool _obscureText = true;
class _SignupState extends State<Signup> {
TextEditingController nameController =TextEditingController();
TextEditingController lNameController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController cPasswordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 80,),
Image.asset("assets/images/Logo.png", height: 121, width: 135),
Align(alignment: Alignment.center,
child: Text("Let’s Get It Started!", style: TextStyle(fontSize: 16,
import 'dart:convert';
import 'dart:io';
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:intl/intl.dart';
import 'package:psysch_admin/HomeScreen.dart';
class ScreenPsychCompleteProfile extends StatefulWidget {
58
String uid;
ScreenPsychCompleteProfile({required this.uid});
@override
State<ScreenPsychCompleteProfile> createState() =>
_ScreenPsychCompleteProfileState();
}
class _ScreenPsychCompleteProfileState
extends State<ScreenPsychCompleteProfile> {
bool _isLoading = false;
final _signUpFormKey = GlobalKey<FormState>();
File? selectedImage;
var base64Image = "";
Future<void> chooseImage(type) async {
var image;
if (type == "camera") { image = await ImagePicker().pickImage( source: ImageSource.camera,); }
else {
image = await ImagePicker().pickImage(source: ImageSource.gallery,);}
if (image != null) {
setState(() {
selectedImage = File(image.path);
base64Image = base64Encode(selectedImage!.readAsBytesSync());
});}}
var dateinput = TextEditingController();
String? material;
var items = [
'Married',
'Single',
'Living with Someone',
'Widowed',
'Separated',
'Divorced',
'Never Married',
];
String? sex;
var sexItem = [
'Male', 59
'Female',
'Other',
];
String? race;
var raceItem = [
'White',
'Black',
'Hispanic',
'Asian',
'Portuguese',
'Other',
];
String? education;
var eduItems = [
'Matriculation',
'Intermediate',
'Graduation',
'M Phil',
'Phd',
'Other',
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(backgroundColor: Colors.white, elevation: 0,
leading: IconButton(onPressed: () { Navigator.pop(context);},
icon: Icon(Icons.arrow_back_ios, color: Colors.black,),),),
body: Form(
key: _signUpFormKey,
child: Align(
alignment: Alignment.topCenter,
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 10,), 60
SizedBox(
width: MediaQuery.of(context).size. Width / 1.10,
child: Align(alignment: Alignment.centerLeft,
child: Text('Let’s Complete Profile', style: TextStyle(fontWeight: FontWeight.w600,
fontSize: 25, fontFamily: 'Segoe UI',)),),),
SizedBox(height: 6,),
Container(height: 115, width: 100,
child: Stack(
children: [
Container(height: 100, width: 100,
padding: EdgeInsets.all(10), decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle,
border: Border.all(color: Colors.black, width: 1.5,),),
child: CircleAvatar(radius: 50, backgroundColor: Colors.black,
backgroundImage: selectedImage == null
? AssetImage('assets/images/Asif.jpg')
as ImageProvider
: FileImage(selectedImage!),),),
Positioned(
top: 60,
bottom: 0,
right: 0,
child: IconButton(
onPressed: () {
_choiseShowDialog(context);
},
icon: Image.asset(
'assets/images/plus.png', height: 36, width: 36,
),
),
),
],
),
),
SizedBox(height: 10,), 61
SizedBox(width: MediaQuery.of(context).size. Width / 1.30,
child: Card(shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),),
elevation: 3,
child: DropdownButtonFormField(decoration: InputDecoration(
focusedBorder: OutlineInputBorder(decoration: InputDecoration(
borderSide: BorderSide(color: Colors.black,),),
contentPadding: EdgeInsets.symmetric(horizontal: 10,),
border: UnderlineInputBorder(borderSide: BorderSide.none,),),
value: material,
hint: Text('Marital Status',),
isExpanded: true,
onChanged: (value) {
setState(() {
material = value as String?;
});
},
onSaved: (value) {
setState(() {
material = value as String?;
});
},
items: items.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(
items,
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w500),
),);
}).toList(),
),),),
SizedBox(height: 10,),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20),),
elevation: 3, 62
child: DropdownButtonFormField(
decoration: InputDecoration(focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20), borderSide: BorderSide(color: Colors.black),),
contentPadding: EdgeInsets.symmetric(horizontal: 10,),
border: UnderlineInputBorder(borderSide: BorderSide.none,),),
value: sex,
hint: Text(
'Sex',
),
isExpanded: true,
onChanged: (value) {
setState(() {
sex = value as String?;
});
},
onSaved: (value) {
setState(() {
sex = value as String?;
});
},
items: sexItem.map((String sexItem) {
return DropdownMenuItem(
value: sexItem,
child: Text(
sexItem,
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w500),
),
);
}).toList(),
),),),
SizedBox(height: 10,),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20),),
elevation: 3, 63
child: DropdownButtonFormField(decoration: InputDecoration(
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular (20),
borderSide: BorderSide(color: Colors.black),),
contentPadding: EdgeInsets.symmetric(horizontal: 10,),
border: UnderlineInputBorder(borderSide: BorderSide.none,),),
value: race,
hint: Text('Race',),
isExpanded: true,
onChanged: (value) {
setState(() {
race = value as String?;
});
},
onSaved: (value) {
setState(() {
race = value as String?;
});
},
items: raceItem.map((String raceItem) {
return DropdownMenuItem(
value: raceItem,
child: Text(
raceItem,
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w500),
),);
}).toList(),
),),),
SizedBox(height: 10,),
SizedBox(width: MediaQuery.of(context).size. Width / 1.30,
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20),
),
elevation: 3,
child: DropdownButtonFormField(
decoration: InputDecoration(focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
64 borderSide: BorderSide(
color: Colors.black,),),
contentPadding: EdgeInsets.symmetric(horizontal: 10,),
border: UnderlineInputBorder(borderSide: BorderSide.none,),),
value: education,
hint: Text(
'Education'
),
isExpanded: true,
onChanged: (value) {
setState(() {
education = value as String?;
});
},
onSaved: (value) {
setState(() {
education = value as String?;
});
},
items: eduItems.map((String eduItems) {
return DropdownMenuItem(
value: eduItems,
child: Text(
eduItems,
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w500),
),
);
}).toList(),
),
),
),
SizedBox(
height: 10,
), 65
SizedBox(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 3,
child: TextField(
controller: dateinput,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(
color: Colors.black,
),
),
border: OutlineInputBorder(
borderSide: BorderSide.none,
),
hintText: "Date of birth",
//hintStyle: textFieldStyle,
),
readOnly: true,
onTap: () async {
DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime(1900),
lastDate: DateTime(5000),
builder: (context, child) {
return Theme(
data: Theme.of(context).copyWith(
colorScheme: ColorScheme.light(
primary: Colors.black,
onPrimary: Colors.white,
onSurface: Colors.black, 66
),
textButtonTheme: TextButtonThemeData(
style: TextButton.styleFrom(
// foregroundColor: buttonColor,
),
),
),
child: child!,
);
},
);
if (pickedDate != null) {
print(
pickedDate); //pickedDate output format => 2021-03-10 00:00:00.000
String formattedDate =
DateFormat('yyyy-MM-dd').format(pickedDate);
print(
formattedDate); //formatted date output using intl package => 2021-03-16
setState(() {
dateinput.text =
formattedDate; //set output date to TextField value.
});
} else {
print("Date is not selected");
}
},
),
),
),
SizedBox(height: 10, ),
Container(
margin: EdgeInsets.symmetric(vertical: 20,),
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(
elevation: 3, 67
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
child: TextFormField(
cursorColor:Colors.black,
controller: about,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(20),
borderSide: BorderSide(color:Colors.black,
),
),
contentPadding: EdgeInsets.only(left: 10, ),
border: OutlineInputBorder(borderSide: BorderSide.none, ),
hintText: 'About',
validator: (value) {
if (value!.isEmpty) {
return "Write Something for About Your";
} else
return null;
},
),
),
),
SizedBox(height: 10, ),
SizedBox(
height: 43,
width: MediaQuery.of(context).size. Width / 1.30,
child: MaterialButton(
onPressed: () => uplodedata(),
color: Color(0xff3F48CC),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
child: _isLoading
? CircularProgressIndicator(
valueColor: 68
AlwaysStoppedAnimation<Color>(Colors.white),
)
: Text(
'Finish',style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
),
SizedBox(height: 10,),
],
),
),
),
),
);
}
Future<void> _choiseShowDialog(BuildContext context) async {
return showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text("Select Image From"),
actions: [
GestureDetector(
child: Text("Gallery",
style: TextStyle(color: Colors.black),
),
onTap: () {
chooseImage("Gallery");
Navigator.pop(context);
},
),
SizedBox(height: 20,), 69
Container(
margin: EdgeInsets.all(10),
child: GestureDetector(
child: Text("camera",
style: TextStyle(color: Colors.black),
),
onTap: () {
chooseImage("camera");
Navigator.pop(context);
},
),
),
],
);
}
);
}
var about = TextEditingController();
void uplodedata() async {
try {
if (base64Image.isEmpty) { print('Please Select Image');
} else if (material == null) { print('Please Select Material Status');
} else if (sex == null) { print('Please Select Gender');
} else if (raceItem == '' || raceItem.toString().trim().isEmpty) {
print('Please Choose the Race');
} else if (eduItems == '' || eduItems.toString().trim().isEmpty) {
print('Please Choose the Education');
} else if (dateinput.text.isEmpty) {
print('Please Choose the Date of Birth');
} else if (about.text.isEmpty) { print('Please Enter something for yourself');}
if (widget.uid.isEmpty) {
throw Exception('Widget UID is null or empty');}
else { setState(() {_isLoading = true; });
final ref = FirebaseStorage.instance.ref()
.child('userImages') .child(widget.uid + '.jpg'); await ref.putFile(selectedImage!);
base64Image = await ref.getDownloadURL(); 70
FirebaseFirestore.instance.collection('admin').doc(widget.uid).update({
'Birth': dateinput.text.trim(),
'Race': raceItem.toString().trim(),
'Sex': sex.toString().trim(),
'status': material.toString().trim(),
'About': about.text.trim(),
'education': eduItems.toString().trim(),
'profile': base64Image,
});
print('Profile Created Successfully');
Navigator.push(context, MaterialPageRoute(builder: (_){
return HomeScreen();
}));
setState(() {_isLoading = false;
});
}
} catch (error) { print(error.toString());
} finally { setState(() {_isLoading = false; });}}
import 'package:flutter/material.dart';
import 'package:psysch_admin/Disease.dart';
import 'package:psysch_admin/Help.dart';
import 'package:psysch_admin/MyProfile.dart';
import 'package:psysch_admin/UserHelp.dart';
import 'package:psysch_admin/Users.dart';
import 'Notification.dart';
class HomeScreen extends StatefulWidget {
const HomeScreen({Key? key}) : super(key: key);
@override
State<HomeScreen> createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 5, 71
automaticallyImplyLeading: false,
elevation: 0,
backgroundColor: Color(0xff3F48CC),
title: Text(
"Dashboard",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w700,
fontFamily: "Rufina",
color: Colors.white,
),
),
actions: [
],
leading: IconButton(
icon: Image.asset("assets/images/Drawer.png", height: 20, width: 20,
),
onPressed: () {},
),
),
body: SingleChildScrollView(
child: Stack(
children: [
Container(
height: 50,
width: MediaQuery.of(context).size. Width,
color: Color(0xff3F48CC),
),
Column(
children: [
Padding(padding: const EdgeInsets.all(25),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () { 72
Navigator.push(context, MaterialPageRoute(builder: (_) {
return Users();
}));
},
child: Container(width: 135, height: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xffFFFFFF),
boxShadow: [
BoxShadow(
blurRadius: 6,
spreadRadius: 4,
color: Colors.grey.withOpacity(0.22),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/images/User.png", height: 30, width: 30,),
SizedBox(height: 10,),
Text(
"Users",
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
fontSize: 18,
fontFamily: 'Roboto',
),
),
],
),
),
),
GestureDetector( 73
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return ScreenDiseases();
}));
},
child: Container(
height: 140,
width: 135,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xffFFFFFF),
boxShadow: [
BoxShadow(
blurRadius: 6,
spreadRadius: 4,
color: Colors.grey.withOpacity(0.22),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/images/Disease.png",
width: 30,
height: 30,
),
SizedBox(height: 10,),
Text(
"Diseases",
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
fontSize: 18,
fontFamily: 'Roboto',
), 74
),
],
),
),
),
],
),
),
Padding(padding: const EdgeInsets.all(20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return ProfilePsychProfile();
}));
},
child: Container(
height: 140,
width: 135,
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4),
color: Color(0xffFFFFFF),
boxShadow: [
BoxShadow(
blurRadius: 6,
spreadRadius: 8,
color: Colors.grey.withOpacity(0.22),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset("assets/images/Person.png",
width: 30, 75
height: 30,
),
SizedBox(height: 10,),
Text(
"Profile",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
fontSize: 18,
fontFamily: 'Roboto',
),
),
],
),
),
),
GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_) {
return UserHelp();
}));
},
child: Container(
height: 140,
width: 135,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Color(0xffFFFFFF),
boxShadow: [
BoxShadow(
blurRadius: 6,
spreadRadius: 8,
color: Colors.grey.withOpacity(0.22),
), 76
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/images/Question.png",
width: 30,
height: 30,
),
SizedBox(height: 10,),
Text("Help",
textAlign: TextAlign.center,
style: TextStyle(
color: Color(0xff000000),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
fontSize: 18,
fontFamily: 'Roboto',
),
),
],
),
),
),
],
),
),
],
)
],
),
),
);
}
} 77
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'ScreenSection1.dart';
import 'colors.dart';
class LayoutPsychHome extends StatefulWidget {
final String disease;
final minimumYes;
final String diseaseId;
final String adminId;
final int sectionCount;
const LayoutPsychHome({
Key? key,
required this.disease,
required this.minimumYes,
required this.diseaseId,
required this.adminId,
required this.sectionCount,
}) : super(key: key);
@override
State<LayoutPsychHome> createState() => _LayoutPsychHomeState();
}
class _LayoutPsychHomeState extends State<LayoutPsychHome> {
int totalYes = 0;
int totalNo = 0;
Widget _calculateIcon(int totalAnswer, int totalYes, int totalNo) {
if (totalAnswer == 0 || (totalYes == 0 && totalNo == 0)) {
return Container();
} else if (totalNo > totalYes) {
return Image.asset(
'assets/logo/img_16.png',
height: 15,
width: 15,
); 78
} else {
return Container(
height: 15,
width: 15,
);
}
}
@override
Widget build(BuildContext context) {
return SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('user_answers')
.where('adminId',
isEqualTo: FirebaseAuth.instance.currentUser!.uid)
.where('diseaseId', isEqualTo: widget.diseaseId)
.snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Container(
height: 10,
width: 10,
child: CircularProgressIndicator(
backgroundColor: buttonColor,
),
);
}
totalYes = 0;
totalNo = 0;
// int totalAnswer = snapshot.data!.docs.length;
79
for (var document in snapshot.data!.docs) {
String answer = document.get('answer') as String;
if (answer == 'Yes') {
totalYes++;
print("Yes $totalYes");
} else if (answer == 'No') {
totalNo++;
print("No $totalNo");
}
}
return ListTile(
title: RichText(
text: TextSpan(
text: 'Section ${widget.sectionCount}',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.black,
),
children: [
TextSpan(
text: ' ($totalAnswer questions)',
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Color(0xffA5A5A5),
),
),
],
),
),
onTap: () {
openScreen(
context,
ScreenPsychSection1(
sectionCount: widget.sectionCount, 80
diseaseId: widget.diseaseId,
adminId: widget.adminId,
),
);
},
trailing: Container(
width: 50,
height: 50,
child: _calculateIcon(totalAnswer, totalYes, totalNo),
),
);
},
),
),
);
}
int totalAnswer = 0;
StreamSubscription<QuerySnapshot>? _subscription;
@override
void initState() {
super.initState();
_subscription = FirebaseFirestore.instance
.collection('user_answers')
.where('diseaseId', isEqualTo: widget.diseaseId)
.snapshots()
.listen((snapshot) {
setState(() {
totalAnswer = snapshot.docs.length;
});
});
}
@override
void dispose() {
_subscription?.cancel();
super.dispose();
} 81
}
import 'package:flutter/material.dart';
import 'colors.dart';
class LayoutPsychSection extends StatefulWidget {
final String question;
final answer;
const LayoutPsychSection({
Key? key,
required this.question,
required this.answer,
}) : super(key: key);
@override
State<LayoutPsychSection> createState() => _LayoutPsychSectionState();
}
class _LayoutPsychSectionState extends State<LayoutPsychSection> {
@override
Widget build(BuildContext context) {
return SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
), elevation: 2,
child: Column(
children: [
Padding(padding: EdgeInsets.all(8.0),
child: Text(
textAlign: TextAlign.center,
'${widget.question}',
style: questionStyle,
),),
SizedBox(height: 10,),
Center( 82
child: Text(widget.answer,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600,
color: widget.answer == 'Yes'
? Color(0xff14A44D) : Color(0xffFF031B),
),
),)],),),);}
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'LayoutPsychSection.dart';
import 'colors.dart';
int totalQuestion = 0;
class ScreenPsychSection1 extends StatefulWidget {
final String diseaseId;
final String adminId;
final sectionCount;
const ScreenPsychSection1({
required this.diseaseId,
required this.adminId,
required this.sectionCount,
});
@override
State<ScreenPsychSection1> createState() => _ScreenPsychSection1State();
}
class _ScreenPsychSection1State extends State<ScreenPsychSection1> {
@override
void initState() {
totalQuestion = 0;
super.initState();
}
bool isloading = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 1, 83
centerTitle: true,
backgroundColor: Colors.white,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black,
),
),
title: Text(
'Section ${widget.sectionCount}',
style: appbarStyle,
),
),
body: Column(
children: [
Expanded(
child: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('user_answers')
.where('diseaseId', isEqualTo: widget.diseaseId)
.snapshots(),
builder: (context,
AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if (!snapshot.hasData) {
return Center(
child: Text("Question Answers Doesn't Exist"),
);
} else if (snapshot.connectionState ==
ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(
color: buttonColor,
), 84
);
}
totalQuestion = snapshot.data!.docs.length;
return snapshot.data?.size == 0
? Center(
child: Text("Question Answers Doesn't Exist"),
)
: ListView.builder(
itemCount: snapshot.data?.docs.length ?? 0,
scrollDirection: Axis.vertical,
itemBuilder: (BuildContext context, int index) {
return LayoutPsychSection(
question: snapshot.data?.docs[index]['question'],
answer: snapshot.data?.docs[index]['answer'],
);
},
);
},
),
),
SizedBox(height: 10,),
],
),
);
}
}
85
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';
class ScreenMajorDepressive extends StatefulWidget {
final String text;
final String uid;
const ScreenMajorDepressive({Key? key, required this.text, required this.uid})
: super(key: key);
@override
State<ScreenMajorDepressive> createState() => _ScreenMajorDepressiveState();
}
class _ScreenMajorDepressiveState extends State<ScreenMajorDepressive> {
bool isloading = false;
TextEditingController questionController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 1,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.black,
),
),
title: Align(
alignment: Alignment.centerLeft,
child: Text(
'${widget.text}',
86
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 20,
color: Colors.black,
),
),
),
),
body: StreamBuilder(
stream: FirebaseFirestore.instance.collection('question')
.where('diseaseId', isEqualTo: widget.uid) .snapshots(),
builder: (context,
AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if (!snapshot.hasData) {
return Center(
child: Text("Question Doesn't Exist"),
);
} else if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child: CircularProgressIndicator(
color: Color(0xff3F48CC),
),
);
} else {}
return snapshot.data?.size == 0 ? Center(
child: Text('No data Found', style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600, color:
Colors.black,),),
):
ListView.builder(
shrinkWrap: true,
itemCount: snapshot.data?.docs.length ?? 0,
itemBuilder: (BuildContext context, int index) {
var data = snapshot.data!.docs[index];
var _uid = snapshot.data!.docs[index]['questionId'];
return Column(
87
children: [
SizedBox(height: 10,),
ListTile(
title: Text(
maxLines: 4,
'${data['question']}',
style: TextStyle(fontSize: 14,),),
trailing: Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return SimpleDialog(
title: Text(
textAlign: TextAlign.center,
'Add New Question',
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.w600,
color: Colors.black,),
),
children: [
SizedBox(height: 5,),
Padding(padding: EdgeInsets.symmetric(horizontal: 8.0),
child: SizedBox(
width: MediaQuery.of(context).size.width / 1.30,
child: TextFormField(
cursorColor:Colors.black,
maxLines: 8,
controller: questionController..text = data['question'],
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
88
borderSide: BorderSide(
color: Colors.black,
),
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
),
hintText: 'Disease name',
hintStyle: TextStyle(
fontSize: 15,
),
),
),
),
),
SizedBox(
height: 20,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: SizedBox(
height: 43,
width: MediaQuery.of(context).size.width / 1.30,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
side: BorderSide(
color: Colors.black,
),
backgroundColor: Color(0xff3F48CC),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
onPressed: () {
try {
89
setState(() {
isloading = true;
});
if (questionController.text.isEmpty) {
print('Please Enter the question');
} else {
FirebaseFirestore.instance
.collection('question')
.doc(_uid)
.update({
'question': questionController.text.toString().trim(),
}).whenComplete(() {
print('Disease update Successfully');
Navigator.pop(context);
});
}
setState(() {
isloading = false;
});
} catch (error) {
print(error.toString());
}
},
child: isloading
? CircularProgressIndicator(
color: Color(0xff3F48CC),
)
: Text(
'Request Update',
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w700,
),
),
90
),
),
),
],
);
},
);
},
child: Icon(
Icons.edit,
color:Color(0xff3F48CC),
),
),
SizedBox(
width: 10,
),
GestureDetector(
onTap: () {
FirebaseFirestore.instance.collection('question') .doc(_uid) .delete()
.whenComplete(() {
print('Question Delete Successfully');
Navigator.pop(context);
});
},
child: Icon(
Icons.delete_forever_outlined,
color: Color(0xff3F48CC),
),
),
],
),
),
SizedBox(
height: 10,
),
91
Divider(
thickness: 1,
color: Colors.grey,
),
],
);
},
);
}),
floatingActionButton: FloatingActionButton(
backgroundColor: Color(0xff3F48CC),
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return MyDialog(
uid: widget.uid,
);
},
);
},
child: Icon(
Icons.add,
color: Colors.white,
size: 14,
),
),
);
}
}
92
@override
State createState() => new MyDialogState();
}
93
),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(5),
),
hintText: 'Disease name',
hintStyle: TextStyle(),
),
),
),
),
SizedBox(
height: 20,
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 8.0),
child: SizedBox(
height: 43,
width: MediaQuery.of(context).size.width / 1.30,
child: OutlinedButton(
style: OutlinedButton.styleFrom(
side: BorderSide(
color:Colors.black,
),
backgroundColor: Color(0xff3F48CC),
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
onPressed: () {
try {
setState(() {
isloading = true;
});
if (disease.text.isEmpty) {
print('Please Enter the Disease Name');
94
} else {
FirebaseFirestore.instance. collection('question')
.doc(_uid) .set({
'questionId': _uid,
'diseaseId': widget.uid,
'status': '',
"doctorid": FirebaseAuth.instance.currentUser!.uid,
'question': disease.text.trim(),
}).whenComplete(() {
print('Question Added Successfully');
Navigator.pop(context);
});
}
setState(() { isloading = false;});
} catch (error) {
print(error.toString());
}},
child: isloading
? CircularProgressIndicator(
color: Color(0xff3F48CC),
)
: Text('Request Publish',
style: TextStyle(fontWeight: FontWeight.w700, fontFamily: 'Aref Ruqaa', fontSize: 18,
color: Colors.white,
),
),
),
),
),
],
);
}
95
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:psysch_admin/About.dart';
import 'package:psysch_admin/EditProfile.dart';
import 'package:psysch_admin/Log%20in%20Screen.dart';
import 'package:psysch_admin/UserHelp.dart';
import 'package:psysch_admin/profile_psysch%20help.dart';
import 'ChangePassword.dart';
import 'Help.dart';
import 'colors.dart';
class ProfilePsychProfile extends StatefulWidget {
@override
State<ProfilePsychProfile> createState() => _ProfilePsychProfileState();
}
class _ProfilePsychProfileState extends State<ProfilePsychProfile> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
elevation: 0,
backgroundColor: buttonColor,
leading: IconButton(
onPressed: () {
Navigator.pop(context);
},
icon: Icon(
Icons.arrow_back_ios,
color: Colors.white,
),
),
title: Text(
'Profile Setting',
style: buttonText,
96
),
),
backgroundColor: Colors.white,
body: StreamBuilder(
stream: FirebaseFirestore.instance
.collection('admin')
.where('userid', isEqualTo: FirebaseAuth.instance.currentUser!.uid)
.snapshots(),
builder: (context,
AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if(!snapshot.hasData){
return Text("No Data found");
97
width: MediaQuery.of(context).size. Width,
height: MediaQuery.of(context).size.height / 5,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.vertical(
top: Radius.circular(250),
),
),
),
),
Positioned (
left: 0,
right: 0,
bottom: 20,
child: Column(
children: [
Align(
alignment: Alignment.center,
child: CircleAvatar(
backgroundColor: Colors.grey,
radius: 50,
backgroundImage: NetworkImage(
snapshot.data!.docs[index]['profile'],
),
),
),
SizedBox(
height: 20,
),
Text(
textAlign: TextAlign.center,
'${snapshot.data!.docs[index]['firstName'] + ' ' + snapshot.data!.docs[index]
['LastName']}',
style: appbarStyle,
),
98
SizedBox(
height: 20,
),
Text(
textAlign: TextAlign.center,
'${snapshot.data!.docs[index]['email']}',
style: questionStyle,
),
],
),
),
],
),
SizedBox(
height: 10,
),
Container(
height: 30,
alignment: Alignment.centerLeft,
// margin: EdgeInsets.only(left: 10),
width: MediaQuery.of(context).size. Width,
decoration: BoxDecoration(
color: Color(0xffC4C4C4).withOpacity(0.33),
),
child: Text(
' Preferences',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Color(0xff7B8471),
),
)),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
99
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: ListTile(
leading: Image.asset(
'assets/images/Person.png',
height: 20,
width: 20,
),
title: Text(
"Edit Account",
style: questionStyle,
),
trailing: Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.black,
size: 18,
),
onTap: () {
openScreen(
context,
EditProfile(
profile: snapshot.data?.docs[index]['profile'],
firstName: snapshot.data?.docs[index]['firstName'],
lastName: snapshot.data?.docs[index]['LastName'],
email: snapshot.data?.docs[index]['email'],
material: snapshot.data?.docs[index]['status'],
sex: snapshot.data?.docs[index]['Sex'],
birth: snapshot.data?.docs[index]['Birth'],
race: snapshot.data?.docs[index]['Race'],
About: snapshot.data?.docs[index]['About'],
education: snapshot.data?.docs[index]['education'],
uid: snapshot.data?.docs[index]['userid'],
),
10
0
);
},
),
),
),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: ListTile(
leading: Image.asset(
'assets/images/Question.png',
height: 20,
width: 20,
),
title: Text(
"Help",
style: questionStyle,
),
trailing: Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.black,
size: 18,
),
onTap: () {
openScreen(context, ProfilePsychHelp());
},
),
),
),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
10
1
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: ListTile(
leading: Image.asset(
'assets/images/Password.png',
height: 20,
width: 20,
),
title: Text(
"Change Password",
style: questionStyle,
),
trailing: Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.black,
size: 18,
),
onTap: () {
openScreen(context, ChangePassword());
},
),
),
),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: ListTile(
leading: Image.asset(
10
2
'assets/images/33.png',
height: 20,
width: 20,
),
title: Text(
"About",
style: questionStyle,
),
trailing: Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.black,
size: 18,
),
onTap: () {
openScreen(context, About());
},
),
),
),
SizedBox(
width: MediaQuery.of(context).size. Width / 1.02,
child: Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
elevation: 1,
child: ListTile(
leading: Image.asset(
'assets/images/Logout.png', width: 20, height: 20,),
title: Text("Logout",
style: questionStyle,
),
trailing: Icon(
Icons.arrow_forward_ios_outlined,
color: Colors.black, size: 18,
10
3
),
onTap: () {
showDialog(
context: context,
builder: (BuildContext? context) {
return AlertDialog(
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(),
IconButton(
onPressed: () {
Navigator.pop(context!);
},
icon: Image.asset(
'assets/images/cross.png', height: 36, width: 36,
),
),
],
),
SizedBox(height: 10,),
Image.asset(
'assets/images/Logout.png', height: 55, width: 55,),
SizedBox(height: 50,),
Text('Are you sure you want to Logout?',
style: questionStyle,
),
SizedBox(height: 15, ),
SizedBox(
width:
MediaQuery.of(context!).size. Width / 1.30,
child: MaterialButton(
10
4
onPressed: () async {
setState(() {
_isLoading = true;
});
final FirebaseAuth _auth =
FirebaseAuth.instance;
await _auth
.signOut()
.whenComplete(() {
openScreen(
context, Login());
});
setState(() {
_isLoading = false;
});
},
color: buttonColor,
elevation: 4,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(15)),
child: _isLoading
? CircularProgressIndicator(
valueColor:
AlwaysStoppedAnimation<
Color>(Colors.white),
)
: Text('Logout now', style: buttonText,
),
),
),
],
),
);
},
10
5
);
},
),
),
),
],
),
);
},
);
},
),
);}
bool _isLoading = false;}
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'colors.dart';
class ProfilePsychHelp extends StatefulWidget {
@override
State<ProfilePsychHelp> createState() => _ProfilePsychHelpState();
}
class _ProfilePsychHelpState extends State<ProfilePsychHelp> {
var nameController = TextEditingController();
var emailController = TextEditingController();
var feedController = TextEditingController();
Future<void> help() async {
setState(() {
loading = true;
});
if (nameController.text.isEmpty) {
print('Please Enter Your name');
} else if (emailController.text.isEmpty) {
print('Please Enter Your email');
} else if (feedController.text.isEmpty) {
print('Please Enter Your Feedback');
10
6
} else {
CollectionReference products =
FirebaseFirestore.instance.collection('help');
products.doc().set({
'name': nameController.text,
'email': emailController.text,
'feed': feedController.text,
}).whenComplete(() {
print('FeedBack Successfully Sent');
});
return print('hello');
}
setState(() {
loading = false;
});
}
bool loading = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_sharp,
color: Colors.black,
),
onPressed: () {
Navigator.pop(context);
},
),
title: Text( "Help",
style:TextStyle(color: Colors.black,
),
),
centerTitle: true,
10
7
elevation: 1,
backgroundColor: Colors.white,
),
body: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.all(20),
height: MediaQuery.of(context).size.height / 1.97,
width: MediaQuery.of(context).size. Width * 0.90,
decoration: BoxDecoration(color: Colors.white,
boxShadow: [BoxShadow(blurRadius: 3, color: Colors.grey)]),
child: Column(
children: [
Container(
height: 43,
width: MediaQuery.of(context).size. Width * 0.90,
margin: EdgeInsets.all(10),
child: TextField(
cursorColor: buttonColor,
controller: nameController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(0),
borderSide: BorderSide(color: buttonColor),
),
border: OutlineInputBorder(),
hintText: "Your Name",
hintStyle: TextStyle(),
),
),
),
Container(height: 43,
width: MediaQuery.of(context).size. Width * 0.90,
margin: EdgeInsets.all(10),
10
8
child: TextField(
cursorColor: buttonColor,
controller: emailController,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(0),
borderSide: BorderSide(color: buttonColor),
),
border: OutlineInputBorder(borderSide: BorderSide(
color: buttonColor,
),
),
hintText: "Your Email",
hintStyle:TextStyle(),
),
),
),
Container(
width: MediaQuery.of(context).size. Width * 0.90,
margin: EdgeInsets.all(10),
child: TextField(
cursorColor: buttonColor,
controller: feedController,
maxLines: 5,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(0),
borderSide: BorderSide(color: buttonColor),
),
border: OutlineInputBorder(),
hintText: "Your feedback is important to us.",
hintStyle:TextStyle(),
),
),
),
10
9
Container(
margin: EdgeInsets.only(top: 10),
height: MediaQuery.of(context).size.height * 0.06,
width: MediaQuery.of(context).size. Width * 0.50,
decoration: BoxDecoration(color: buttonColor,
borderRadius: BorderRadius.circular(25)),
child: InkWell(
onTap: () => help(),
child: loading
? Container(height: 5, width: 5,
child: CircularProgressIndicator(
color: Colors.white,),)
: Center(
child: Text('Send', style: buttonText,
),
),
),
),
],
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Text(
"We Are Available On",
style: questionStyle,
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
Container(margin: EdgeInsets.only(right: 10),
child: Image.asset('assets/images/web.png', width: 20, height: 20, color: buttonColor,),),),
11
0
Text("www.user-app.com"; style:TextStyle(),),],),),
Container(
margin: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Row(
children: [
Container(
margin: EdgeInsets.only(right: 10),
child: Icon(Icons.mail_outline,
color: buttonColor,),),
Text(
"Contact@sharebottle.com",
style: TextStyle(),),
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 20),
child: Row(
children: [
Container(
margin: EdgeInsets.only(right: 10),
child: Icon(Icons.apps, color: buttonColor, ), ),
Text("123456",
style: TextStyle(),),
],
),),
],
),),
);
}}
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'LayoutBubble.dart';
11
1
import 'colors.dart';
final firestoreInstance = FirebaseFirestore.instance;
class ProviderChatScreen extends StatefulWidget {
final String userId;
final String name;
final String image;
final String email;
final String reply;
final String issueTitle;
ProviderChatScreen(
{required this.userId,
required this.name,
required this.email,
required this.image,
required this.reply,
required this.issueTitle});
@override
_ProviderChatScreenState createState() => _ProviderChatScreenState();
}
class _ProviderChatScreenState extends State<ProviderChatScreen>
with WidgetsBindingObserver {
final _firestore = FirebaseFirestore.instance;
final _textController = TextEditingController();
bool _isOnline = false;
StreamSubscription<DocumentSnapshot>? _subscription;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
_updateUserStatus(true);
_listenForUserStatus();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
11
2
_updateUserStatus(false);
_subscription?.cancel();
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
super.didChangeAppLifecycleState(state);
switch (state) {
case AppLifecycleState.resumed:
_updateUserStatus(true);
break;
case AppLifecycleState.inactive:
case AppLifecycleState.paused:
case AppLifecycleState.detached:
_updateUserStatus(false);
break;
}
}
void _updateUserStatus(bool isOnline) {
final user = FirebaseAuth.instance.currentUser;
if (user != null) {
firestoreInstance.collection('user').doc(user.uid).update(
{'isOnline': isOnline, 'lastSeen': FieldValue.serverTimestamp()});
}
}
void _listenForUserStatus() {
final user = FirebaseAuth.instance.currentUser;
if (user != null) {
_subscription = firestoreInstance
.collection('user')
.doc(user.uid)
.snapshots()
.listen((snapshot) {
final isOnline = snapshot.data()?['isOnline'] ?? false;
11
3
setState(() {
_isOnline = isOnline;
});
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Colors.white,
elevation: 1,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
),
),
centerTitle: false,
title: ListTile(
contentPadding: EdgeInsets.only(left: 0),
leading: CircleAvatar(
backgroundImage: NetworkImage(widget.image),
radius: 20,
),
title: Text(widget.name),
subtitle: Text(
_isOnline ? 'Online' : 'Offline',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
11
4
color: Color(0xff808080)),
),
),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Container(
margin: EdgeInsets.all(10),
child: Card(
elevation: 3,
child: ListTile(
title: Text(
'Issue Title',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: buttonColor),
),
subtitle: Text(
widget.issueTitle,
style: TextStyle(fontSize: 15, fontWeight: FontWeight.w400, color: Colors.black,
),
),
trailing: Image.asset('assets/images/55.png', height: 25, width: 25, ),
),
),
),
StreamBuilder<QuerySnapshot>(
stream: _firestore.collection('messages').snapshots(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(
11
5
color: buttonColor,
),
);
}
final messages = snapshot.data!.docs
.where((doc) =>
(doc.get('sender') ==
FirebaseAuth.instance.currentUser!.uid &&
doc.get('recipient') == widget.userId) ||
(doc.get('sender') == widget.userId &&
doc.get('recipient') ==
FirebaseAuth.instance.currentUser!.uid))
.toList();
messages.sort(
(a, b) => a.get('timestamp').compareTo(b.get('timestamp')));
return Expanded(
child: SizedBox(
11
6
width: MediaQuery.of(context).size. Width,
child: ListView(
reverse: false,
padding: EdgeInsets.symmetric(horizontal: 10.0, vertical: 20.0),
children: messageBubbles,
),
),
);
},
),
Container(
decoration: kMessageContainerDecoration,
child: Padding(padding: EdgeInsets.all(13),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: TextField(
controller: _textController,
decoration: kMessageTextFieldDecoration,
),
),
SizedBox(width: 10,),
OutlinedButton(
style: OutlinedButton.styleFrom(
backgroundColor: buttonColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(17),
),
),
onPressed: () async {
var _auth = await FirebaseAuth.instance;
_firestore.collection('messages').add({
'sender': FirebaseAuth.instance.currentUser!.uid,
'recipient': widget.userId,
11
7
'text': _textController.text,
'timestamp': Timestamp.now(),
}).whenComplete(
() {
final User? user = _auth.currentUser;
final userid = user!.uid;
FirebaseFirestore.instance.collection('user')
.doc(userid)
.update(
{
'help': 'help',
},
);
print('FeedBack Successfully Sent');
},
);
_textController.clear();
},
child: Text('Send',
style: buttonText,
),
),
],
),
),
),
],
),
);
}
}
var kMessageContainerDecoration = BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
11
8
blurRadius: 3,
spreadRadius: 1,
color: Colors.grey,
),
],
border: Border(
top: BorderSide(color: Colors.grey, width: 2.0),
),
);
var kMessageTextFieldDecoration = InputDecoration(
filled: true,
fillColor: Color(0xffE1DFDF),
contentPadding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
hintText: 'Write your message here....',
border: OutlineInputBorder(borderSide: BorderSide.none, borderRadius: BorderRadius.circular(25),
),
);
var kSendButtonTextStyle = TextStyle(color: Colors.grey,
fontWeight: FontWeight.bold, fontSize: 18.0,);
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'answer_help.dart';
import 'colors.dart';
class UserHelp extends StatefulWidget {
@override
State<UserHelp> createState() => _UserHelpState();
}
class _UserHelpState extends State<UserHelp> {
String name = "";
@override
Widget build(BuildContext context) {
return Scaffold(
11
9
backgroundColor: Colors.white,
appBar:AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios_sharp, color: Colors.black,),
onPressed: () {
Navigator.pop(context);
},
),
title: Text("Help",
style:TextStyle(color: Colors.black,),
),
centerTitle: true,
elevation: 1,
backgroundColor: Colors.white,
),
body: StreamBuilder(
stream: FirebaseFirestore.instance.collection('help') .where('doctorId',
isEqualTo: FirebaseAuth.instance.currentUser!.uid) .snapshots(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.hasError) {
return Center(
child: Text("An error occurred",
style: TextStyle(color: Colors.black,),
),
);
}
if (!snapshot.hasData || snapshot.data.docs.isEmpty) {
return Center(
child: Text('No User Found'),
);
}
var userId = snapshot.data.docs[0]['userId'];
return StreamBuilder(
stream: (name != "" && name != "")
? FirebaseFirestore.instance.collection('user')
12
0
.where("firstName", isGreaterThanOrEqualTo: name)
.where('userid', isEqualTo: userId) .snapshots()
: FirebaseFirestore.instance.collection('user')
.where('userid', isEqualTo: userId) .snapshots(),
builder: (context,
AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if (!snapshot.hasData) {
Center(child: Text('user not Found'), );
}
return (snapshot.connectionState == ConnectionState.waiting)
? Center(
child: Text('User not Found', style: TextStyle(fontSize: 14,
fontWeight: FontWeight.w600, color: Colors.black,
),
),
)
: ListView.builder(
shrinkWrap: true,
itemCount: snapshot.data?.docs.length ?? 0,
itemBuilder: (BuildContext context, int index) {
var data = snapshot.data!.docs[index];
return ListTile(
leading: CircleAvatar(
backgroundColor: buttonColor,
radius: 30,
backgroundImage: NetworkImage('${data['profile']}'),
),
title: Text(
'${data['firstName']} ${data['LastName']}',
style: appbarStyle,
),
subtitle: Text('${data['email']}',
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w400,
color: Colors.black.withOpacity(0.76),
),
12
1
),
onTap: () {
openScreen(
context,
AnswerHelp(
name: data['firstName'] + data['LastName'],
email: data['email'],
userId: data['userid'],
image: data['profile'],
),
);
},
trailing: Icon(Icons.arrow_forward_ios, color: Colors.black,
),
);
},
);
},
);
},
),
);
}
int totalQuestion = 0;
List<String> userIdList = [];
StreamSubscription<QuerySnapshot>? _subscription;
@override
void initState() {
super.initState();
_subscription = FirebaseFirestore.instance
.collection('user_answers')
.where('adminId', isEqualTo: FirebaseAuth.instance.currentUser!.uid) .snapshots()
.listen((snapshot) {
setState(() {
totalQuestion = snapshot.docs.length;
12
2
for (var doc in snapshot.docs) {
userIdList.add(doc.data()['userId']);
}
print("User IDs: $userIdList");
});
});
}
@override
void dispose() {
_subscription?.cancel();
super.dispose();
}
}
12
3
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'answer_help.dart';
import 'colors.dart';
class UserHelp extends StatefulWidget {
@override
State<UserHelp> createState() => _UserHelpState();}
class _UserHelpState extends State<UserHelp> {
String name = "";
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar:AppBar(
leading: IconButton(
icon: Icon(
Icons.arrow_back_ios_sharp,
color: Colors.black),
onPressed: () {
Navigator.pop(context);
},
),
title: Text("Help" style:TextStyle(color: Colors.black,),),
centerTitle: true, elevation: 1,
backgroundColor: Colors.white,),
body: StreamBuilder(stream: FirebaseFirestore.instance.collection('help') .where('doctorId',
isEqualTo: FirebaseAuth.instance.currentUser!.uid) .snapshots(),
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
if (snapshot.hasError) {
return Center(
child: Text("An error occurred",
style: TextStyle(
color: Colors.black, ), ), );}
12
4
if (!snapshot.hasData || snapshot.data.docs.isEmpty) {
return Center(
child: Text('No User Found'), );
var userId = snapshot.data.docs[0]['userId'];
return StreamBuilder(
stream: (name != "" && name != "")
? FirebaseFirestore.instance.collection('user') .where("firstName", isGreaterThanOrEqualTo:
name) .where('userid', isEqualTo: userId) .snapshots()
: FirebaseFirestore.instance .collection('user')
.where('userid', isEqualTo: userId) .snapshots(),
builder: (context,
AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if (!snapshot.hasData) {
Center(
child: Text('user not Found'), ); }
return (snapshot.connectionState == ConnectionState.waiting)
? Center(
child: Text('User not Found', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w60
: ListView.builder(
shrinkWrap: true,
itemCount: snapshot.data?.docs.length ?? 0,
itemBuilder: (BuildContext context, int index) {
var data = snapshot.data!.docs[index];
return ListTile(
leading: CircleAvatar(
backgroundColor: buttonColor,
radius: 30,
backgroundImage: NetworkImage('${data['profile']}'),
),
title: Text(
'${data['firstName']} ${data['LastName']}',
style: appbarStyle,
),
subtitle: Text(
'${data['email']}',
12
5
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w400,
color: Colors.black.withOpacity(0.76),
),
),
onTap: () {
openScreen(
context,
AnswerHelp(
name: data['firstName'] + data['LastName'],
email: data['email'],
userId: data['userid'],
image: data['profile'],
), );},
trailing: Icon( Icons.arrow_forward_ios,
color: Colors.black,
),);}, ); },),);
int totalQuestion = 0;
List<String> userIdList = [];
StreamSubscription<QuerySnapshot>? _subscription;
@override
void initState() {
super.initState();
_subscription = FirebaseFirestore.instance.collection('user_answers')
.where('adminId', isEqualTo: FirebaseAuth.instance.currentUser!.uid) .snapshots()
.listen((snapshot) { setState(() {
totalQuestion = snapshot.docs.length;
for (var doc in snapshot.docs) {
userIdList.add(doc.data()['userId']);
}
print("User IDs: $userIdList");
});
});
}
12
6
@override
void dispose() {
_subscription?.cancel();
super.dispose();
}
}
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:psysch_admin/UsersDetails.dart';
class Users extends StatefulWidget {
@override
State<Users> createState() => _UsersState();
}
class _UsersState extends State<Users> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
centerTitle: true,
backgroundColor: Colors.transparent,
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: Colors.black,
),
onPressed: () {
Navigator.pop(context);
},
),
title: Text(
"Users",
style: TextStyle(
color: Colors.black,
fontFamily: "Segoe UI",
12
7
fontWeight: FontWeight.w600,
fontSize: 20,
),
),
),
body: SingleChildScrollView(
child: Column(
children: [
StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('user').snapshots(),
builder: (context, snapshot) {
if (snapshot.hasError) {
return Text('Something went wrong');
}
if (snapshot.connectionState == ConnectionState.waiting) {
return Align(
alignment: Alignment.center,
child: Container(
height: 30,
width: 30,
child: CircularProgressIndicator(),
),
);
}
return Container(
height: 700,
child: ListView.builder(
itemCount: snapshot.data?.docs.length,
itemBuilder: (BuildContext context, int index) {
final documentData = snapshot.data?.docs[index].data() as Map<String, dynamic>?;
if (documentData == null) {
return SizedBox.shrink();
}
final firstName = documentData['firstName'] as String?;
final lastName = documentData['LastName'] as String?;
12
8
final email = documentData['email'] as String?;
final profileImageUrl = documentData['profile'] as String?;
return Column(
children: [
Container(height: 60,
child: ListTile(
title: Text(
'$firstName $lastName',
style: TextStyle(fontWeight: FontWeight.w600, ), ),
subtitle: Text('$email',
style: TextStyle(fontWeight: FontWeight.w600,),),
leading: CircleAvatar(
backgroundImage: NetworkImage(profileImageUrl ?? ''),),
trailing: GestureDetector(
child: Text("View Details >>"),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (_) {
return UserDetail(
name: documentData['firstName'] + documentData['LastName'],
email: documentData['email'],
profile: documentData['profile'],
about: documentData['About'],
race: documentData['Race'],
sex: documentData['Sex'],
status: documentData['status'],
birth: documentData['Birth'],
useId: documentData['uid'],
availability: documentData['availability'],
);
},
),
);
12
9
},
),
),
),
SizedBox(height: 10, ),
Divider(thickness: 0.5, color: Colors.black,
),
],
);
},
),
);
},
),
],
),
),
);
}
}
13
0
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'LayoutPsyschHome.dart';
import 'colors.dart';
const UserDetail(
{Key? key,
this.name,
this.firstname,
this.LastName,
this.profile,
this.email,
this.race,
this.birth,
this.sex,
this.status,
this.about,
this.useId,
this.education,
13
1
this.availability})
: super(key: key);
@override
State<UserDetail> createState() => _UserDetailState();
}
13
2
backgroundImage: NetworkImage(widget.profile),
),
),
SizedBox(height: 10, ),
Center(
child: Text(
widget.name,
style: appbarStyle,
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.all(20),
child: Text('Info', style: appbarStyle,
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10,
),
child: Row(
children: [
Icon(Icons.email,,
color: color, size: 16,),
SizedBox(width: 10,),
Text(
widget.email,
style: TextStyle( fontSize: 14, fontWeight: FontWeight.w400, color: color,
),
),
],
),
),
SizedBox(height: 20,),
Divider(color: color, height: 0.5, endIndent: 30, indent: 30,),
13
3
Container(
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 30,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: MediaQuery.of(context).size. Width / 2.4,
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/images/male.png', color: color, height: 16, width: 16,),
SizedBox(width: 10,),
Text(
widget.sex,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: color,
),
),
],
),
SizedBox(height: 30,),
Divider(height: 0.5, color: color, endIndent: 30,
),
],
),
),
],
),
),
Container(
margin: EdgeInsets.symmetric(horizontal: 30, vertical: 10,),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
13
4
Container(
width: MediaQuery.of(context).size. Width / 2.4,
child: Column(
children: [
Row(
children: [
Image.asset(
'assets/images/birth.png', width: 16, height: 16,
color: color,
),
SizedBox(width: 10,),
Text(
widget.birth,
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400, color: color,
),
),
],
),
SizedBox(height: 30,),
Divider(height: 0.5, endIndent: 30,
color: color,
),
],
),
),
],
),
),
SizedBox(height: 10,),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.symmetric(horizontal: 20),
child: Text(
'About',
style: TextStyle(fontSize: 16, fontWeight: FontWeight.w800, color: Colors.black,
13
5
),
),
),
Container(
alignment: Alignment.centerLeft, margin: EdgeInsets.symmetric(horizontal: 20),
child: Text(widget.about, style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400,
color: color,
),
),
),
SizedBox(height: 30, ),
Center(
child: Container(height: 43,
width: MediaQuery.of(context).size. Width / 2.4,
decoration: BoxDecoration(border: Border.all(
color: Color(0xffFF031B),
),
borderRadius: BorderRadius.circular(4),
),
child: Center(
child: GestureDetector(
onTap: () {
showDialog(context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Blocked User',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: Colors.black,
),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Are you sure you want to Block this User?',
style: TextStyle(color: Colors.black, fontWeight: FontWeight.w400, fontSize: 14,
),
13
6
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
OutlinedButton(style: OutlinedButton.styleFrom(
backgroundColor: Color(0xffD4D4D4), shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
),
onPressed: () {
Navigator.pop(context);
},
child: Text('Cancel', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w400,
color: Colors.black,
),
),
),
SizedBox(width: 20,),
OutlinedButton(
style: OutlinedButton.styleFrom(backgroundColor: Color(0xffFF031B),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24),
),
),
onPressed: () async {
setState(() {
_availability = !_availability;
});
await FirebaseFirestore.instance.collection('user') .doc(widget.useId) .update({
'availability': true,
});
print('User blocked successfully');
Navigator.pop(context);
},
child: Text('Block', style: TextStyle(fontSize: 17, fontWeight: FontWeight.w400,
color: Colors.white,),),),
13
7
],),
],
),
);
},
);
},
child: Center(
child: Text('Block User',
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w700, color: Color(0xffFF031B),
),
),
),
),
),
),
),
SizedBox(height: 20, ),
Container(alignment: Alignment.centerLeft, margin: EdgeInsets.symmetric(horizontal: 20),
child: Text('Attempted Sections', style: appbarStyle,),),
Container(height: 300,
child: StreamBuilder(stream: FirebaseFirestore.instance. collection('disease') .where('admin',
isEqualTo: FirebaseAuth.instance.currentUser!.uid) .snapshots(),
builder: (context, AsyncSnapshot<QuerySnapshot<Map<String, dynamic>>> snapshot) {
if (!snapshot.hasData) {
return Center(child: Text("Data doesn't Exist"),);
} else if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator(color: buttonColor,),);}
return snapshot.data?.size == 0
? Center(child: Text('No data Found',
style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600, color: Colors.black,),),),
: ListView.builder(
scrollDirection: Axis.vertical,
itemCount: snapshot.data?.docs.length ?? 0,
shrinkWrap: true,
13
8
itemBuilder: (BuildContext context, int index) {
final sectionCount = index + 1;
return LayoutPsychHome(
disease: snapshot.data?.docs[index]['disease'],
minimumYes: snapshot.data?.docs[index]['mini'],
diseaseId: snapshot.data?.docs[index]['uid'],
adminId: snapshot.data?.docs[index]['admin'],
sectionCount: sectionCount,
);},);
},
),
),
],
),
),
);
}
13
9
switch (item.getItemId())
{
case R.id.Share:
Intent share = new Intent();
share.setAction(Intent.ACTION_SEND);
String shareLink ="https://play.google.com/store/apps/details?id=" + getPackageName();
share.putExtra(Intent.EXTRA_TEXT,shareLink);
share.setType("text/plain");
startActivity(Intent.createChooser(share, "Choose One"));
break;
case R.id.RateUS:
Intent rate = new Intent(Intent.ACTION_VIEW);
String linkRate ="https://play.google.com/store/apps/details?id=" + getPackageName();
rate.setData(Uri.parse(linkRate));
startActivity(Intent.createChooser(rate, "Choose One"));
break;
case R.id.Terms:
Intent terms = new Intent(Intent.ACTION_VIEW);
terms.setData(Uri.parse(term));
startActivity(Intent.createChooser(terms, "Choose
One")); break;
case R.id.Privacy:
Intent privacy = new Intent(Intent.ACTION_VIEW);
privacy.setData(Uri.parse(privacyPociy));
startActivity(Intent.createChooser(privacy, "Choose One"));
break;
}
drawerLayout.closeDrawer(GravityCompat.START);
return true;
}
public void FirstLaunch()
14
0
14
1