Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 152

PSYSCH DIAGNOSIS MOBILE APP

By

Muhammad Asif Raza


Registration#: 2019-GCUF-86326
Muhammad Afaq
Registration#: 2018-GCUF-
Summar Abbass
Registration#: 2019-GCUF-

Project submitted in partial fulfillment

of the requirements for the degree of

BACHELOR OF SCIENEC

IN

COMPUTER SCIENCE

DEPARTMENT OF COMPUTER SCIENCE

GOVERNMENT COLLEGE UNIVERSITY, FAISALABAD


DECLARATION
This project, a die-hard work, is productried out by under the
supervision of Mr. Asif Aziz (Co-coordinator, Computer Department) and
(Lecturer, Computer Department) GC University, Faisalabad Layyah Campus,
Pakistan. We feel please to declare that the project and contents of this project is the productive
result of our hardworking, studies and research and no part of this is copied from any published
source. This work has been conducted under the practical atmosphere of our studies not for the
award of any other degree / diploma. The University may take action if the information provided
is found guilty at any stage.

Signatures of User

Muhammad Asif Raza


Registration#: 2019-GCUF-86326
Muhammad Afaq
Registration#: 2018-GCUF-077
Dedication
At this Moment of joy, we dedicate our hardworking to our beloved Parents, other family
members and friends who encourage us and give us timely support in different ways. We further
dedicate it to our honorable teachers, who played an important role in entire period of learning in
the University, especially to Mr. Asif Aziz, and Mr. M.Tayyiab Naqvi , who encourage us with
their broadness in the field and gave us innovative ideas for successful completion of our project.
ACKNOWLEDGEMENTS
Bowing our head to almighty ALLAH, who is the most merciful and giving all honor to
the HOLY Prophet (PBUH) as the model and beacon light for all the mankind. Prior to anyone
Else, all gratitude and praises are due to the almighty Allah, who gave us health and capacitance
to achieve this goal.

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.

Finally, we hope that inadvertent errors will be forgiven by readers.

M. Asif Raza

M. Afaq

Summar Abbass
To

The Controller of Examinations,


Government College
University, Faisalabad

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

Chapter No 1: Introduction to the Problem.....................................................................................1

1.1 Introduction............................................................................................................................1

1.2 Background............................................................................................................................1

1.3 Purpose..................................................................................................................................1

1.4 Scope......................................................................................................................................2

1.5 Objective................................................................................................................................2

1.6 Intended Audience and Reading Suggestions........................................................................2

1.6.1 Stakeholders....................................................................................................................2

1.6.2 Users of the application..................................................................................................2

1.7 Document Convention...........................................................................................................2

2.1 Overall Description................................................................................................................5

2.1.1 Product Perspectives.......................................................................................................5

2.1.2 Product Features.............................................................................................................5

2.1.3 Design and Implementation Constraints.........................................................................5

2.1.4 Assumption and Dependencies.......................................................................................6

2.2 Application Features..............................................................................................................6

2.2.1 Application Feature 1.....................................................................................................6

2.2.2 Application Feature 2.....................................................................................................6

2.2.3 Application Feature 3.....................................................................................................6

2.2.4 Application Feature 4.....................................................................................................6

2.3 External Interface requirements.............................................................................................7

2.3.1 User Interfaces................................................................................................................7

2.3.2 Hardware Interfaces........................................................................................................7


2.3.3 Software Interfaces.........................................................................................................7

2.3.4 Communication Interfaces..............................................................................................7

2.4 Other Non-functional requirements.......................................................................................7

2.4.1 Performance Requirements.............................................................................................7

2.4.2 Safety Requirements.......................................................................................................8

2.4.3 Security Requirements....................................................................................................8

3.1 Identifying Actors and Use Cases using Textual Analysis....................................................9

3.1.1 Use Case Name: Admin addition....................................................................................9

3.1.2 Use Case Name: Add a new Patient.............................................................................10

3.1.3 Use Case Name: View Patient List...............................................................................11

3.1.4 Use Case Name: Patient Result....................................................................................12

3.2 Forming Use Case Diagram with Candidate and Use Cases...............................................14

3.2.1 Use Case diagram: User................................................................................................14

3.2.2 Use Case diagram: Admin............................................................................................14

3.3 Describe the Events Flow for Use Case..............................................................................15

3.3.1 Addition of admin.........................................................................................................15

3.3.2 Add a new Patient.........................................................................................................15

3.3.3 View Patient List..........................................................................................................15

3.3.4 Check Patient Question.................................................................................................16

4.1 Architecture Diagram..........................................................................................................17

4.1.1 Definition:.....................................................................................................................17

4.2 ERD Diagram with data dictionary.....................................................................................18

4.2.1 Definition:.....................................................................................................................18

4.2.2 Diagram:.......................................................................................................................19

4.3 Data Flow Diagram..............................................................................................................19


4.3.1 Definition:.....................................................................................................................19

4.3.2 Diagram:.......................................................................................................................20

4.4 Class Diagram......................................................................................................................20

4.4.1 Definition:.....................................................................................................................20

4.4.2 Diagram:.......................................................................................................................21

4.5 Object Diagram....................................................................................................................21

4.5.1 Definition:.....................................................................................................................21

4.5.2 Diagram:.......................................................................................................................22

4.6 Sequence Diagram...............................................................................................................22

4.6.1 Definition:.....................................................................................................................22

4.6.2 Diagram:.......................................................................................................................23

4.7 Activity Diagram.................................................................................................................23

4.7.1 Definition:.....................................................................................................................23

4.7.2 Diagram:.......................................................................................................................24

4.8 Collaboration Diagram........................................................................................................24

4.8.1 Definition:.....................................................................................................................24

4.8.2 Diagram:.......................................................................................................................25

4.9 State Transition Diagram.....................................................................................................25

4.9.1 Definition:.....................................................................................................................25

4.9.2 Diagram:.......................................................................................................................26

5.1 Component Diagram............................................................................................................27

5.1.1 Defination.....................................................................................................................27

5.1.2 Diagram........................................................................................................................27

5.2 Deployment Diagram...........................................................................................................28

5.2.1 Definition......................................................................................................................28
5.2.2 Diagram........................................................................................................................28

5.3 Database Architecture (1- Tier, 2-Tier, 3- Tier Architecture).............................................28

5.3.1 Definition......................................................................................................................28

5.3.2 Diagram........................................................................................................................29

6.1 Test Case Specification........................................................................................................31

6.2 Black Box Test Case............................................................................................................31

6.2.1 BVA or Boundary Value Analysis...............................................................................31

6.2.2 Equivalence Class Partitioning.....................................................................................31

6.2.3 State Transition Testing................................................................................................31

6.2.4 Decision Table Testing.................................................................................................31

6.2.5 Graph Base Testing.......................................................................................................32

6.3 White Box Testing...............................................................................................................32

6.3.1 Statement Coverage......................................................................................................32

6.3.2 Branch Coverage..........................................................................................................32

6.3.3 Path Coverage...................................................................................................................32

Test Cases..................................................................................................................................33

Testing Results...........................................................................................................................35

7.1 Programming Languages.....................................................................................................37

7.2 Operating Environment.......................................................................................................37

Appendix A: User documentation.............................................................................................38

What exactly is user manuals?...............................................................................................38

Benefits of user documentation.............................................................................................38

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

Chapter No 1: Introduction to the Problem


1.1 Introduction
"Psysch Diagnosis" is frequently the most expensive part of an organization. Patients may easily
scam the system by filling out incorrect information on paper-based patient attendance systems,
which are inefficient. One of various automated and flexible methods should be employed as the
suggested solution to stop the aforementioned issues.

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

1.6 Intended Audience and Reading Suggestions


1.6.1 Stakeholders

• Doctor (Admin)

• General Public (patient)

• Owner of Appp

1.6.2 Users of the application

• Doctor(Admin)

• General office public (Patient)

• Patient Report

1.7 Document Convention


This section explains the convention used in this document to define the requirements shell. Each
criterion is made up of a selection of elements that were gathered from all recently released
applications for managing Psych diagnoses and patient records.

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:

High: Necessary for the upcoming release.


Medium: Essential, but may wait till the following release.
Low: Can be postponed till resources allow.
Status:

Deleted: Component is no longer necessary to fulfil this criterion.


Proposed: Requirement has been put up by a source.
Approved: The requirement has been given the go-ahead by the Change Review Board (CRB) or
another organisation with the necessary power (such as a working group), but it hasn't been put into
practice.
Implemented: Code that makes it possible to satisfy the need has been created, put into use, and
tested.
Rationale:

Why is this need seen to be crucial or required?

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

2.1 Overall Description


2.1.1 Product Perspectives
It is basically a psych diagnosis mobile app which will manage the Psych Diagnoses of patients
working in an organization or a clinic based on their symptoms and clinical history.

2.1.2 Product Features


Following are the features of our developed application of psych diagnosis mobile app:

 Psych Diagnosis Processing and management


 Attendance management
 List view of attendance on daily basis
 Addition of New Patient
 List view of all Patients
 Admin Control View
 Admin Profile
 Patient profiles

2.1.3 Design and Implementation Constraints


 Expect difficulties and limitations with system upgrades and improvements since salary
management systems that demand ongoing functioning call for collaboration.
 Must have a capability to handle a sizeable number of attendance at any given moment.
 Even while seeking contemporaneous consultation, always confirm the accuracy of the
material.
 Always check the accuracy of the data, especially when many people are present.
 By presenting the list of employees and their daily attendance, information is always
made available.
 Assure quick data presentation, regardless of the volume of information being searched
for across several databases.

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.

2.2 Application Features


2.2.1 Application Feature 1
Simplicity:

Salary Management system has very simple and easy interface and it is very easy to use.

2.2.2 Application Feature 2


Customization

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.

2.2.3 Application Feature 3


Advanced Analytics

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.

2.2.4 Application Feature 4


Security

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.

2.3.2 Hardware Interfaces


We have describe each interaction between the application and the hardware parts of this Flutter
application, including its logical and physical properties. The available device types, the type of
data, and the way the application and hardware interact in terms of control are some examples.

2.3.3 Software Interfaces


Describe how this programme is related to other specialized application components, such as
databases, operating systems, tools, libraries, and integrated commercial components (name and
version). Identify the data or messages entering and leaving the system, and explain the function
of each.

2.3.4 Communication Interfaces


The services required and the type of communications should be described. Consult the
documentation that details the application programming interface protocols in depth. Decide
which data will be used by various programme components. Indicate this as an implementation
restriction if the data sharing mechanism must be implemented in a certain manner (for instance,
by using a global data area in a multitasking operating system).

2.4 Other Non-functional requirements


2.4.1 Performance Requirements
 Response Time
After saving the Patient details and attendance data, the programme will respond in
one second.
 Capacity

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.

2.4.2 Safety Requirements


 Bugs Avoidance
Any types of bugs simply cannot exist because of how the application is set up.
 Hazard detection and removal
Any types of hazards are identified by the application and eliminated before they cause
an accident.
 Damage limitation
This application has safety measures in place to reduce potential harm from accidents.

2.4.3 Security Requirements


 Patient Identification
All registred Patient will be viewable in an Patient list.
 Modification
Only the ward administrator may make changes (insert, remove, or update) to the
database after synchronizing it.
 Admin Rights
Admin can change and view all data and records of patient and attendance.

9
CHAPTER-3
Analysis (Use case Model)

3.1 Identifying Actors and Use Cases using Textual Analysis


3.1.1 Use Case Name: Admin addition

UC # 1 Ref: Req. #1

UC Name Addition of admin

Level (Abstract or Detailed)

Description This requirement enables admin to login into application.

Actor (s) Admin

Stakeholders Admin

Admin must know his Doctor Name, designation, full name,


Preconditions
mobile no and email.

Success Guarantee Admin is successfully login.

Action Response

Admin will directly


add into the application
Main Success
only once a time.
Scenario
2. Admin is successfully
logged in the
successfully loged in
Psysch Diagnosis
Mobile App.

3. Application shows the


contents to be changed to the

10
Admin.

Extensions No extension

Admin should remember his Doctor name, designation, full


Special requirements
name, mobile number and email.

Frequency of
Always login to the Admin panel.
Occurrence

3.1.2 Use Case Name: Add a new Patient

UC # 2 Ref: Req. #2

Admin can add new Patient


UC Name

Level (Abstract or Detailed)

Description The admin can Add a new Patient

Actor (s) Admin

Stakeholders Admin

Preconditions Admin should be added in the application.

Success Guarantee Add successfully.

Action Response

Main Success 1. Add first name


Scenario 2. Add last name
3. Add data of birth
4. Add mobile number

11
5. Add email

2-Add a new Patients.

Extensions If not add Patient .No error massage will appear.

Special requirements Admin must be login before this.

Frequency of
Update any time
Occurrence

3.1.3 Use Case Name: View Patients List

UC # 3 Ref: Req. #3

UC Name View Patient List

Level (Abstract or Detailed)

Description This requirement enables to the complete details of Patients.

Actor (s) Patients, Doctor

Stakeholders Admin/Citizen

Preconditions Doctor and Patient must be added.

Success Guarantee If Doctor and Patients are added in the system

Action Response
Main Success Scenario
1. Click on Patient list and

12
view list of all the Patients.

2. Application will show all


the Disease records of
Patient.

Extensions If something went wrong, system respond accordingly.

Special requirements Application should be running

Frequency of Admin Panel check Multiple times in a day and can check
Occurrence the records of Patients.

3.1.4 Use Case Name: Mark Attendance

UC # 4 Ref: Req. #4

UC Name Mark attendance of employees

Level (Abstract or Detailed)

Description This requirement enables to mark attendance on working basis.

Actor (s) Admin

Stakeholders Admin

Preconditions Admin and employee must be added.

Success Guarantee If admin and employees are added in the system

13
Action Response

1. Click on today’s attendance


option and mark the
attendance of added
Main Success Scenario
employees.

2. Application will update the


attendance status of
employee.

Extensions If something went wrong, system respond accordingly.

Special requirements Application should be running

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 check his


Disease

Can review on
Doctor opinion

Can request for


add
in the app

Figure : Use Case Diagram (User)

3.2.2 Use Case diagram: Admin

Will add
himself
first

Add new
Patient

Mark
Patient Disease
Generate Patient
Disease report
report Edit Patient

Figure : Use Case Diagram (Admin)

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.

3.3.1 Addition of admin


 Precondition:
None
 Main Flow:
Admin will enter his name, designation, full name, mobile no and email and after
adding it. He will be added in the application.

3.3.2 Add a new Patient


 Precondition:
Admin should be added in the system.
 Main Flow:
Admin have to enter these formalities for the addition of new Patient:
 Add first name
 Add last name
 Add data of birth
 Add mobile number
 Add email

3.3.3 View Patient List


 Precondition:
Admin and patient must be added.
 Main Flow:
Click on Patient list and view list of all the patients. Four function can also be
performed there like call, edit Patient, report view and generation.

3.3.4 Mark Patient attendance


 Precondition:

Admin and Patiente must be added.


16
CHAPTER-4

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

4.2 ERD Diagram with data dictionary


4.2.1 Definition:
An Entity Relationship (ER) Diagram is a form of flowchart that shows the relationships
between "entities" like people, things, or concepts inside a system. ER Diagrams are most
frequently used in the disciplines of software engineering, business information systems,
education, and research to build or troubleshoot relational databases. They are also known as
ERDs or ER Models, and they employ a predetermined collection of symbols to represent the
interconnectivity of entities, connections, and their qualities. These symbols include rectangles,
diamonds, ovals, and connecting lines.

18
4.2.2 Diagram:

Fig 4.2.2 ERD DIAGRAM

4.3 Data Flow Diagram


4.3.1 Definition:
A data flow diagram is the standard graphical representation of how information flows through a
system (DFD). The right amount of the system demand may be graphically represented by a
clear and intelligible DFD. Either manually, mechanically, or both can carry it out.

19
4.3.2 Diagram:

Fig 4.3.2 Data Flow Diagram

4.4 Class Diagram


4.4.1 Definition:
A class diagram in the Unified Modeling Language (UML) is a sort of static structural diagram
used in software engineering that illustrates the classes, attributes, operations (or methods), and
interactions between objects in a system to explain the system's structure.

20
4.4.2 Diagram:

Fig 4.4.2 Class Diagram

4.5 Object Diagram


4.5.1 Definition:
A runtime instance of a class that can have its own state and data values is referred to as an
object. An object diagram includes objects and their relationships, which may be regarded a
specific case of a class diagram or a communication diagram. A static UML object diagram is an
example of a class diagram; it displays a snapshot of the detailed state of a system at a moment

21
in time.

22
4.5.2 Diagram:

Fig 4.5.2 Object Diagram

4.6 Sequence Diagram


4.6.1 Definition:
A sequence diagram is a diagram created using the Unified Modeling Language (UML) that
shows the flow of messages sent and received by objects during an interaction. A set of objects
that are represented by lifelines and the messages they exchange over the course of an interaction
make up a sequence diagram.

23
4.6.2 Diagram:

Fig 4.6.2 Sequence Diagram

4.7 Activity Diagram


4.7.1 Definition:
An activity diagram displays business and software processes as a succession of actions. These
functions can be carried out by individuals, hardware, or software. Activity diagrams are used to
define business processes and use cases, as well as to track the execution of system operations.

24
4.7.2 Diagram:

Fig 4.7.2 Sequence Diagram

4.8 Collaboration Diagram


4.8.1 Definition:
In the Unified Modeling Language, a collaboration diagram—also called a communication
diagram—illustrates the connections and interactions between software elements. These
diagrams may be used to define each object's function as well as the dynamic behaviour of a
specific use case.

25
4.8.2 Diagram:

Fig 4.8.2 Collaboration Diagram

4.9 State Transition Diagram


4.9.1 Definition:
State-transition diagrams show the states that an object can be in, the circumstances under which
it can change states, the guards that must be in place before the transition can occur, and the
activities that are performed during an object's existence (actions). State-transition diagrams are
incredibly useful for describing how various things behave throughout the whole spectrum of use
cases that affect those objects. State-transition diagrams are useless for demonstrating the
collaboration between elements that causes the transitions.

26
4.9.2 Diagram:

Fig 4.9.2 State Transition 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

Fig 5.1.2 Component 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

Fig 5.2.2 Deployment Diagram

5.3 Database Architecture (1- Tier, 2-Tier, 3- Tier Architecture)


5.3.1 Definition
A DBMS design is represented by a database architecture. It aids in the creation, growth, use,
and maintenance of the database management system. The database system may be divided into

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

Fig 5.3.2 Single tier Architecture

30
Fig 5.3.2 2 tier Architecture

Fig 5.3.2 3 tier Architecture

31
CHAPTER-6

Testing (Software Quality Attributes)


6.1 Test Case Specification
In this portion, we will discuss the testing phase of developed application “Salary
Management system” in different manner to know that how much efficient and effective
application is?

6.2 Black Box Test Case


6.2.1 BVA or Boundary Value Analysis:
BA or Boundary value anaysis allows the software developers to integrate all of the components/
units of the application within a program and then test them in a group. Basically, this testing
level is used to catch the defects in the user interface between the functions/ modules. It is useful
to determine how logically and efficiently all the units/ components are running together.

6.2.2 Equivalence Class Partitioning


Here the all module and encoding module options are partitioned equally and tested. This testing
provides the assurance that the application is well equally functional unit with smooth transition
of data.

6.2.3 State Transition Testing


Here the all output of each modules and encoding modules options are partitioned equally and
tested. This testing provides the assurance that the output of application is well equally
functional unit with smooth transition of data. In another words you can say that, tests are
designed to execute valid and invalid state transitions.

6.2.4 Decision Table Testing


In Decision Table Testing we will test the application testing methodology used to test
application behavior for various input combinations. Because it is the key factor for the success
of any application.

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,

6.3 White Box Testing


6.3.1 Statement Coverage

A process of performing as application or program with the intention of finding errors


and whether the application is fulfilling user needs. It can also be defined as the ability of
a program in meeting the required or desired results.

In many methodologies of software engineering, a separate phase is called phase of


testing which is performed after the completion of the implementation. There is a benefit
in using this approach that it is hard to see one's own mistakes, and a fresh eye can find
observable errors much faster than the person who has read the material many times.

6.3.2 Branch Coverage


Every time a component of the program is changed, it can be run for testing that is the
biggest and famous benefit of this testing phase. Issues that are arise during this phase,
allowing to be resolved as quickly as possible. Branch coverage is familiar by application
developers. It allows them to test their application units before move them to testers for
formal testing

6.3.3 Path Coverage


To test the complete application as a whole, path coverage has been used. It is beneficial
to check whether the application meets its requirements and fulfill Quality Standards.

33
Test Cases
Test Cases Objectives

1 To make sure that user can easily


understand and can use the application

2 Make sure that user can easily add in

3 Make sure that user can easily moveout

4 Make sure that admin can easily view


status of attendance.

5 Make sure that admin can add new


employee.

6
Make sure that the application run at
android successfully.

Font size, style, and color for headline,


7
description text, labels, infield data,
and grid info should be standard.

34
Check if the correct data is getting
8
saved in the database upon a successful
page addition.

9 Check employee is successfully adding in


an attendance list.

10 Check admin can easily mark the


attendance?

11
Check admin can generate the report.

35
Testing Results
Table 0-1: Testing Result

CRITERIA Test Status REMARKS

All the graphical user


interface options display
Test successful None
successfully.

Make sure that user can easily add


in.
Test successful None

Make sure that user can easily


Test successful None
moveout.

Make sure that admin can easily Test successful None


view status of attendance.

Make sure that admin can add new Test successful None

employee.

36
Make sure that the application run
Test successful None
at android successfully.

Font size, style, and color for


headline, description text, labels,
Test successful None
infield data, and grid info are
according to the standards.

Correct data is getting saving in


the database upon a successful Test successful None
addition.

Check employee is successfully


Test successful None
adding in an attendance list.

Check admin can easily mark the


Test successful None
attendance?

Check admin can generate the


Test successful None
report.

37
CHAPTER-7

Tools and Technologies


7.1 Programming Languages
The programming language use in this application are:
 Java:
The most common language for mobile app development is Java, one of only a few few that
may be used to create applications for Android and iOS devices. Java's advantages over other
programming languages include: It is focused on objects. Its syntax is comparable to C++,
C#, and other languages.

7.2 Operating Environment


The operating environment for our application will be:

 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.

Benefits of user documentation


 Facilitate new user onboarding:
When a new user first utilises a product, there is typically a learning curve. No product is
so user-friendly that consumers can immediately understand all of its features and use
cases.
Giving new customers useful user documentation will greatly increase their likelihood of
successfully integrating with your solution. They can go through the manual to learn
more about the features of the product.
After the transaction, everything is focused on giving the client a positive experience.
Clients claimed that if a business invested in onboarding materials that welcomed and
instructed customers after they had purchased the product, they would be more inclined
to stay loyal to them (86 percent)

 Lower the cost of customer assistance:


When users can rely on user guides, they are less likely to contact your customer support
team by phone or email. Two advantages of reducing the strain on the customer support
team are decreased expenses and enhanced customer service capability.

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.

 Boost client satisfaction:


User documentation that makes your product easier to use results in happier customers.
The customer experience is greatly enhanced by providing consumers with a mechanism
to get themselves out of difficult situations.
Instead of forcing customers to call customer care or abandoning them, you provide
them the tools to handle problems on their own. Customers expect user documentation as
the most basic kind of assistance, and they will become unsatisfied if it is missing or of
poor quality.

 Documented user guides will reduce liability against wrong usage:


If you don't warn customers about inappropriate usage, they can get hurt or use your
products in harmful ways. Legally, your company is required to provide warnings to
safeguard consumers' health and safety.
You could stop customers from abusing your goods if you properly capture it. If you
effectively warn clients against using your items improperly, your organisation is less
likely to be sued.

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,

border: OutlineInputBorder(borderSide: BorderSide.none),),


textAlign: TextAlign.left, textAlignVertical: TextAlignVertical.center,),),),
SizedBox(height: 10,),
SizedBox(width: MediaQuery.of(context).size. Width / 1.30,
child: Align(alignment: Alignment.centerRight,
child: GestureDetector(
onTap: () {
Navigator.push(context, MaterialPageRoute(builder: (_){
return ForgotPassword();
}));
},
child: Text(
45
'Forgot Password?', style: TextStyle(fontSize: 12, fontWeight: FontWeight.w400,
color: Colors.black,),),),),),
Container(
alignment: Alignment.center,
padding: const EdgeInsets.only(top: 40,right: 5,left: 5),
child: Center(
child:TextButton(
style: TextButton.styleFrom(backgroundColor: Color(0xff3F48CC),
minimumSize: Size(264, 43),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(25),),),
onPressed: () { login();},
child: Text("Log in", style: TextStyle(color: Colors.white,
fontWeight: FontWeight.w700, fontSize: 18,),),),),),
SizedBox(height: 30, ),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(padding: const EdgeInsets.only(),
child: Text("Do not have an account?"), ),
TextButton( onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (_){
return Signup();}),);},
child: Text("Sign UP",style: TextStyle(color: Color(0xff3F48CC), fontSize: 16,
),),),]),],),),);}}
bool _obscureText = true;

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,

fontWeight: FontWeight.w300, color: Colors.black,),),),


Container(margin: EdgeInsets.symmetric(vertical: 20,),
width: MediaQuery.of(context).size.
53 Width / 1.30,
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, ),
validator: (value) { 54
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;
},
),
),
),
Container(
width: MediaQuery.of(context).size. Width / 1.30,
child: Card(elevation: 3,
shape: RoundedRectangleBorder(borderRadius:
55 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),),
child: TextFormField(
cursorColor: buttonColor,
controller: cPasswordController,
56
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: (){ 57
Navigator.push(context, MaterialPageRoute(builder: (_){
return VerificationSacreeen(
FirstName : nameController.text,
LastName : lNameController.text,
Email : emailController.text,
Password : passwordController.text,
CPassword : cPasswordController.text,
);
}));
},
child: Text("SignUp", style: TextStyle(color: Colors.white,
fontSize: 18, fontWeight: FontWeight.w700,),),),),),
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,
),),),]),],),),),),

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,
),
),
);
}
}

class MyDialog extends StatefulWidget {


final String uid;

const MyDialog({super.key, required this.uid});

92
@override
State createState() => new MyDialogState();
}

class MyDialogState extends State<MyDialog> {


TextEditingController disease = TextEditingController();
var _uid = Uuid().v1();
Widget build(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: disease,
decoration: InputDecoration(
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black,
),

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,
),
),
),
),
),
],
);
}

bool isloading = false;


}

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");

}else if ( snapshot.connectionState == ConnectionState.waiting){


return Center(child: CircularProgressIndicator());
}
return ListView.builder(
itemCount: snapshot.data?.docs.length ?? 0,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
return SingleChildScrollView(
child: Column(
children: [
Stack(
children: [
Container(
width: MediaQuery.of(context).size. Width,
height: MediaQuery.of(context).size.height / 3,
decoration: BoxDecoration(
color: buttonColor,
),
),
Positioned(
bottom: 0,
child: Container(

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')));

List<MessageBubble> messageBubbles = [];


for (var message in messages) {
final messageText = message.get('text');
final messageSender = message.get('sender');
final messageTimestamp = message.get('timestamp');
final isSent =
messageSender == FirebaseAuth.instance.currentUser!.uid;
final messageBubble = MessageBubble(
reply: widget.reply,
text: messageText,
time: messageTimestamp.toDate(),
isSent: isSent,
);
messageBubbles.add(messageBubble);
}

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';

class UserDetail extends StatefulWidget {


final firstname;
final name;
final profile;
final email;
final race;
final birth;
final sex;
final status;
final about;
final useId;
final availability;
final education;
final LastName;

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();
}

class _UserDetailState extends State<UserDetail> {


bool _availability = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
elevation: 1,
backgroundColor: Colors.white,
leading: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: Icon(Icons.arrow_back,
color: Colors.black,
),
),
title: Text('User Details',
style: appbarStyle,
),
),
body: SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 10,),
Center(
child: CircleAvatar(radius: 40,
backgroundColor: buttonColor.withOpacity(0.10),

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,
);},);
},
),
),
],
),
),
);
}

public boolean onNavigationItemSelected(@NonNull MenuItem item) {

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

You might also like