Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/question_screens/question10.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';


class QuestionAnswer10Page extends StatefulWidget {
Expand Down Expand Up @@ -36,6 +37,9 @@ class _QuestionAnswerPage10State extends State<QuestionAnswer10Page> {
}

void loadQuestions() async {

enableForwardNavigation = false;

// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand Down Expand Up @@ -126,6 +130,7 @@ class _QuestionAnswerPage10State extends State<QuestionAnswer10Page> {
selectedArea = answer;
habitat = answer;
widget.onHabitatSelected(habitat);
enableForwardNavigation = true;
});
},
child: Container(
Expand Down
5 changes: 5 additions & 0 deletions lib/question_screens/question11.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';


class QuestionAnswer11Page extends StatefulWidget {
Expand Down Expand Up @@ -34,6 +35,9 @@ class _QuestionAnswerPage11State extends State<QuestionAnswer11Page> {
}

void loadQuestions() async {

enableForwardNavigation = false;

// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand Down Expand Up @@ -116,6 +120,7 @@ class _QuestionAnswerPage11State extends State<QuestionAnswer11Page> {
selectedArea = answer;
state = answer;
widget.onStateSelected(state);
enableForwardNavigation = true;
});
},
child: Container(
Expand Down
3 changes: 3 additions & 0 deletions lib/question_screens/question12.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';
import 'package:remar_flutter_app/question_screens/questions_utils.dart';

class QuestionAnswer12Page extends StatefulWidget {
Expand Down Expand Up @@ -40,6 +41,7 @@ class _QuestionAnswerPage12State extends State<QuestionAnswer12Page> {

void loadQuestions() async {

enableForwardNavigation = false;

// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
Expand Down Expand Up @@ -122,6 +124,7 @@ class _QuestionAnswerPage12State extends State<QuestionAnswer12Page> {
selectedArea = answer;
county = answer;
widget.onCountySelected(county);
enableForwardNavigation = true;
});
},
child: Container(
Expand Down
32 changes: 20 additions & 12 deletions lib/question_screens/question13.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';
import 'package:remar_flutter_app/question_screens/questions_utils.dart';


Expand Down Expand Up @@ -42,6 +43,9 @@ class _QuestionAnswerPage13State extends State<QuestionAnswer13Page> {
}

void loadQuestions() async {

enableForwardNavigation = false;

// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand Down Expand Up @@ -78,49 +82,52 @@ class _QuestionAnswerPage13State extends State<QuestionAnswer13Page> {

return Scaffold(
body: ListView(
padding: EdgeInsets.all(16.0),
padding: const EdgeInsets.all(16.0),
children: [
Text(
questionText,
style: TextStyle(
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 20.0,
),
),
SizedBox(height: 10.0),
const SizedBox(height: 10.0),
Row(
children: [
buildCheckbox("Yes", selectedAnswer == "Yes"),
SizedBox(width: 10.0),
const SizedBox(width: 10.0),
buildCheckbox("No", selectedAnswer == "No"),
SizedBox(width: 10.0),
const SizedBox(width: 10.0),
buildCheckbox("I don't know", selectedAnswer == "I don't know"),
],
),
SizedBox(height: 20.0),
const SizedBox(height: 20.0),
Text(
extraDetailText,
style: TextStyle(
style: const TextStyle(
fontSize: 16.0,
),
),
SizedBox(height: 20.0),
// Display answers only if "Yes" is selected
if (displayAnswers)

for (var area in displayedAreas) buildAnswerButton(area),
if (!isExpanded &&
displayAnswers) // Hide "Name not in list" until "Yes" is selected
displayAnswers)
// Hide "Name not in list" until "Yes" is selected
GestureDetector(
onTap: () {
setState(() {
isExpanded = true;
enableForwardNavigation = false;
});
},
child: Container(
color: Colors.green,
padding: EdgeInsets.all(12.0),
padding: const EdgeInsets.all(12.0),
margin: EdgeInsets.symmetric(vertical: 8.0),
child: Text(
child: const Text(
"Name not in list",
style: TextStyle(
color: Colors.white,
Expand All @@ -141,6 +148,7 @@ class _QuestionAnswerPage13State extends State<QuestionAnswer13Page> {
selectedAnswer = title;
// Update the flag based on the selected answer
displayAnswers = selectedAnswer == "Yes";
enableForwardNavigation = true;
});
},
child: Row(
Expand Down Expand Up @@ -176,8 +184,8 @@ class _QuestionAnswerPage13State extends State<QuestionAnswer13Page> {
},
child: Container(
color: isSelected ? Colors.green : null,
padding: EdgeInsets.all(12.0),
margin: EdgeInsets.symmetric(vertical: 8.0),
padding: const EdgeInsets.all(12.0),
margin: const EdgeInsets.symmetric(vertical: 8.0),
child: Text(
answer,
style: TextStyle(
Expand Down
2 changes: 1 addition & 1 deletion lib/question_screens/question14.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class _QuestionAnswerPage14State extends State<QuestionAnswer14Page> {
),
),
);
if(isMonthValid == true);

});

},
Expand Down
5 changes: 5 additions & 0 deletions lib/question_screens/question15.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';

class QuestionAnswer15Page extends StatefulWidget {
final String name;
Expand Down Expand Up @@ -34,6 +35,9 @@ class _QuestionAnswerPage15State extends State<QuestionAnswer15Page> {
}

void loadQuestions() async {

// enableForwardNavigation = false;

// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand Down Expand Up @@ -124,6 +128,7 @@ class _QuestionAnswerPage15State extends State<QuestionAnswer15Page> {
selectedAnswer = answer;
additionalInfo = answer;
widget.onAdditionalInfoSelected(additionalInfo);
// enableForwardNavigation = true;
});
},
child: Container(
Expand Down
6 changes: 5 additions & 1 deletion lib/question_screens/question16.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';
import 'package:url_launcher/url_launcher.dart';

class QuestionAnswer16Page extends StatefulWidget {
Expand Down Expand Up @@ -29,6 +30,9 @@ class _QuestionAnswer16Page extends State<QuestionAnswer16Page> {
}

void loadQuestionData() async {

enableForwardNavigation = false;

// Load JSON data from asset file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand All @@ -43,10 +47,10 @@ class _QuestionAnswer16Page extends State<QuestionAnswer16Page> {
// Assign values to variables
setState(() {
description = questionData['description'];

choiceOneText = questionData['choiceOneText'];
choiceTwoText = questionData['choiceTwoText'];
choiceThreeText = questionData['choiceThreeText'];
// enableForwardNavigation = true;
});
}

Expand Down
3 changes: 1 addition & 2 deletions lib/question_screens/question3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'global.dart';

List<String> yearList = []; // Declaration of yearList


class QuestionAnswer3Page extends StatefulWidget {

final String name;
Expand All @@ -30,8 +31,6 @@ class _QuestionAnswerPage3State extends State<QuestionAnswer3Page> {
String questionText = '';
String year='';

final ScrollController _controller = ScrollController();


@override
void initState() {
Expand Down
80 changes: 39 additions & 41 deletions lib/question_screens/question4.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,24 +142,24 @@ class _QuestionAnswerPage4State extends State<QuestionAnswer4Page> {
}

Container(
color: isSelected ? Colors.white : null,
padding: const EdgeInsets.all(1.0),
margin: const EdgeInsets.symmetric(vertical: 1.0),
child: Text(
answer,
style: TextStyle(
color: isSelected ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
color: isSelected ? Colors.white : null,
padding: const EdgeInsets.all(1.0),
margin: const EdgeInsets.symmetric(vertical: 1.0),
child: Text(
answer,
style: TextStyle(
color: isSelected ? Colors.white : Colors.black,
fontWeight: FontWeight.bold,
),
);
if(isMonthValid == true);
),
);

});

},

child: Container(
color: isSelected ? Colors.green : null,
child: Container(
color: isSelected ? Colors.green : null,
padding: const EdgeInsets.all(1.0),
margin: const EdgeInsets.symmetric(vertical: 1.0),
child: Text(
Expand All @@ -175,34 +175,32 @@ class _QuestionAnswerPage4State extends State<QuestionAnswer4Page> {
}

void validateMonth(String month) {
var currentDate = DateTime.now();
var currentMonth = currentDate.month;
var selectedMonth =0;

switch (month) {
case "January" : (selectedMonth=1);
case "February" : (selectedMonth=2);
case "March" : (selectedMonth=3);
case "April" : (selectedMonth=4);
case "May" : (selectedMonth=5);
case "June" : (selectedMonth=6);
case "July" : (selectedMonth=7);
case "August" : (selectedMonth=8);
case "September" : (selectedMonth=9);
case "October" : (selectedMonth=10);
case "November" : (selectedMonth=11);
case "December" : (selectedMonth=12);
}



if(selectedMonth > currentMonth) {
isMonthValid = false;
}
else {
isMonthValid = true;
}
var currentDate = DateTime.now();
var currentMonth = currentDate.month;
var selectedMonth =0;

switch (month) {
case "January" : (selectedMonth=1);
case "February" : (selectedMonth=2);
case "March" : (selectedMonth=3);
case "April" : (selectedMonth=4);
case "May" : (selectedMonth=5);
case "June" : (selectedMonth=6);
case "July" : (selectedMonth=7);
case "August" : (selectedMonth=8);
case "September" : (selectedMonth=9);
case "October" : (selectedMonth=10);
case "November" : (selectedMonth=11);
case "December" : (selectedMonth=12);
}

}


if(selectedMonth > currentMonth) {
isMonthValid = false;
}
else {
isMonthValid = true;
}

}
5 changes: 4 additions & 1 deletion lib/question_screens/question7.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:remar_flutter_app/question_screens/global.dart';
import 'package:shared_preferences/shared_preferences.dart';


Expand Down Expand Up @@ -34,6 +35,8 @@ class _QuestionAnswerPage7State extends State<QuestionAnswer7Page> {
}

void loadQuestions() async {

enableForwardNavigation = false;
// Load the JSON data from the file
String jsonString = await DefaultAssetBundle.of(context)
.loadString('assets/raw_eng/questions2Modified.json');
Expand Down Expand Up @@ -114,7 +117,7 @@ class _QuestionAnswerPage7State extends State<QuestionAnswer7Page> {
selectedArea = answer;
intensity = answer;
widget.onIntensitySelected(intensity);

enableForwardNavigation = true;
});
},
child: Container(
Expand Down
Loading