Skip to content

Commit

Permalink
All Done
Browse files Browse the repository at this point in the history
  • Loading branch information
Karan authored and Karan committed Apr 19, 2021
1 parent f986ab6 commit 97c15a4
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/Assesment/Forms/Laundry/laundrypro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ import 'package:tryapp/Assesment/Forms/Formsrepo.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:avatar_glow/avatar_glow.dart';

///Frame of this page:
/// contructor function:
/// 1) this function helps to generate fields which are not needed previously
/// but will be needed to fill future fields
///
/// function which help to set and get data from the field and maps.
/// a)the set function requires value and index to work
/// b)the get fucntion requires only index of the question to get the
/// data.
///
/// fucntion which helps to control speech to text.
class LaundryPro extends ChangeNotifier {
String roomname;
var accessname;
Expand Down Expand Up @@ -46,6 +57,8 @@ class LaundryPro extends ChangeNotifier {
doorwidth = int.tryParse('$getvalue(7)');
}

/// This fucntion helps us to create such fields which will be needed to fill extra
/// data sunch as fields generated dynamically.
Future<void> setinitials() async {
if (wholelist[7][accessname]['question'][7].containsKey('doorwidth')) {
} else {
Expand All @@ -69,6 +82,8 @@ class LaundryPro extends ChangeNotifier {
}
}

/// This fucntion will help us to get role of the logged in user
Future<String> getRole() async {
final FirebaseUser useruid = await _auth.currentUser();
firestoreInstance.collection("users").document(useruid.uid).get().then(
Expand All @@ -79,6 +94,8 @@ class LaundryPro extends ChangeNotifier {
);
}

///This function is used to set data i.e to take data from thr field and feed it in
// map.
setdata(index, value) {
if (value.length == 0) {
if (wholelist[7][accessname]['question'][index]['Answer'].length == 0) {
Expand All @@ -97,15 +114,19 @@ class LaundryPro extends ChangeNotifier {
}
}

/// This function helps us to set the recommendation
setreco(index, value) {
wholelist[7][accessname]['question'][index]['Recommendation'] = value;
notifyListeners();
}

/// This function helps us to get value form the map
getvalue(index) {
return wholelist[7][accessname]['question'][index]['Answer'];
}

/// This function helps us to get recommendation value form the map
getreco(index) {
return wholelist[7][accessname]['question'][index]['Recommendation'];
}
Expand All @@ -114,12 +135,14 @@ class LaundryPro extends ChangeNotifier {
wholelist[7][accessname]['question'][index]['Recommendationthera'] = value;
notifyListeners();
}
// This fucntion helps us to set the priority of the fields.

setprio(index, value) {
wholelist[7][accessname]['question'][index]['Priority'] = value;
notifyListeners();
}

// This fucntion helps us to get the priority of the fields.
getprio(index) {
return wholelist[7][accessname]['question'][index]['Priority'];
}
Expand All @@ -128,6 +151,7 @@ class LaundryPro extends ChangeNotifier {
return wholelist[7][accessname]['question'][index]['Recommendationthera'];
}

// This fucntion helps us to set the recommendation from the therapist.
Widget getrecomain(
assesmentprovider, int index, bool isthera, String fieldlabel) {
return SingleChildScrollView(
Expand Down
24 changes: 24 additions & 0 deletions lib/Assesment/Forms/Pathway/pathwayUI.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import 'package:provider/provider.dart';
/// a)the set function requires value and index to work
/// b)the get fucntion requires only index of the question to get the
/// data.
/// UI for the whole page.
final _colorgreen = Color.fromRGBO(10, 80, 106, 1);

Expand Down Expand Up @@ -71,6 +72,8 @@ class _PathwayUIState extends State<PathwayUI> {
setinitials();
}

/// This fucntion helps us to create such fields which will be needed to fill extra
/// data sunch as fields generated dynamically.
setinitials() {
if (widget.wholelist[0][widget.accessname]['question'][8]
.containsKey('Railling')) {
Expand All @@ -96,6 +99,7 @@ class _PathwayUIState extends State<PathwayUI> {
widget.wholelist[0][widget.accessname]['question'][7]['MultipleStair']);
}

/// This fucntion will help us to get role of the logged in user
Future<String> getRole() async {
final FirebaseUser useruid = await _auth.currentUser();
firestoreInstance.collection("users").document(useruid.uid).get().then(
Expand All @@ -107,6 +111,8 @@ class _PathwayUIState extends State<PathwayUI> {
);
}

// This function is used to set data i.e to take data from thr field and feed it in
// map.
setdata(index, value) {
if (value.length == 0) {
if (widget.wholelist[0][widget.accessname]['question'][index]['Answer']
Expand Down Expand Up @@ -134,41 +140,50 @@ class _PathwayUIState extends State<PathwayUI> {
}
}

/// This function helps us to set the recommendation
setreco(index, value) {
setState(() {
widget.wholelist[0][widget.accessname]['question'][index]
['Recommendation'] = value;
});
}

/// This function helps us to get value form the map
getvalue(index) {
return widget.wholelist[0][widget.accessname]['question'][index]['Answer'];
}

/// This function helps us to get recommendation value form the map
getreco(index) {
return widget.wholelist[0][widget.accessname]['question'][index]
['Recommendation'];
}

// This fucntion helps us to set the priority of the fields.
setprio(index, value) {
setState(() {
widget.wholelist[0][widget.accessname]['question'][index]['Priority'] =
value;
});
}

// This fucntion helps us to get the priority of the fields.
getprio(index) {
return widget.wholelist[0][widget.accessname]['question'][index]
['Priority'];
}

// This fucntion helps us to set the recommendation from the therapist.
setrecothera(index, value) {
setState(() {
widget.wholelist[0][widget.accessname]['question'][index]
['Recommendationthera'] = value;
});
}

// This function is used to control and camera button
//
// Note: Image picker do not work with speech_to_text.
Future getImage(bool isCamera) async {
// File image;
// if (isCamera) {
Expand All @@ -183,6 +198,7 @@ class _PathwayUIState extends State<PathwayUI> {
// });
}

// UI
@override
Widget build(BuildContext context) {
final pathwaypro = Provider.of<PathwayPro>(context);
Expand Down Expand Up @@ -1272,6 +1288,7 @@ class _PathwayUIState extends State<PathwayUI> {
);
}

/// this fucntion helps us to listent to hte done button at the bottom
void listenbutton() {
var test = 0;
for (int i = 0;
Expand All @@ -1293,6 +1310,8 @@ class _PathwayUIState extends State<PathwayUI> {
}
}

/// This fucntion is to take care of speeck to text mic button and place the text in
/// the particular field.
void _listen(index) async {
if (!isListening['field$index']) {
bool available = await _speech.initialize(
Expand Down Expand Up @@ -1345,6 +1364,7 @@ class _PathwayUIState extends State<PathwayUI> {
_speech.stop();
}

/// This function is a helper function of the listen fucntion.
setdatalisten(index) {
setState(() {
widget.wholelist[0][widget.accessname]['question'][index]
Expand All @@ -1353,6 +1373,8 @@ class _PathwayUIState extends State<PathwayUI> {
});
}

/// This is a widget function which returns is the recommendation fields and the
/// priority field.
Widget getrecomain(int index) {
return SingleChildScrollView(
// reverse: true,
Expand Down Expand Up @@ -1490,6 +1512,8 @@ class _PathwayUIState extends State<PathwayUI> {
);
}

/// This function is specific for the pathwayui. this is used to generate the
/// steps field based on dynamic and multiple stairs to store data of each stair
Widget stepcountswid(index) {
return Container(
child: Column(
Expand Down

0 comments on commit 97c15a4

Please sign in to comment.