Skip to content

Commit d700da3

Browse files
timh1975ReduxGBfindingaadithonisetttayyabcreator
authored
Question16 (#68)
* feature-taylab-new-pages-April (#58) * Initial Commit * Implements top app bar * Layout for bottom navigation bar * Top app bar * General Page Layout * Had build error due to "const" constructor. error resolved * Added the JSON files to the repo which consists of all questions along with other information displayed in the app. * Added the JSON files to the repo which consists of all questions along with other information displayed in the app. * changed bottom navigation bar so the number of pages currently user is in gets displayed correctly. * question 10 page, uses string questions intead of directly fetching json. ongoing tasks. * fixed the images loading issue, where the image couldnt be fetched previously. * question 8 and 9 using json data. * fixed the issue with "question" being fetched from the wrong questionnaire in the json data. * fixed both json data loading as there was an error wher question 9 was loading question 8 data. fixed. * app navigation can be done now, since i have 2 pages i am working on, user can navigate back and forth between the pages now and the bottom bar will change accordingly. * first commit * first commit * basic screen working * Updated elements for sizing on screen 3 * Updated elements for sizing on screen 4 * Updated question7.dart * question8.dart pulling county list based on hard coded state * Pass state, crab name and image file to question8.dart * Pass crab name and image file to question3.dart * Pass crab name and image file to question4.dart * Data now passed to Q3, Q4, Q7, Q8 * Screens refactored to work with amended modifiedquestions JSON * Screens refactored to work with amended modified questions JSON. Bottom navigation restored to original format * Code base from Tayyab now in this feature branch. Runs with issues on first page * Code base from Tayyab now in this feature branch. Runs with issues on first page * Added all image assets from original Android app * Pass data back from page3. Returned data variables defined * Pass data back from page4. * Page 4 listbox size fixed for web * Refactored questions_utils.dart * Refactored questions_utils.dart * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * Revert "question6.dart page added and linked" This reverts commit 6dc797d. * Page 6 added * question9.dart added * added question6.dart * added question6.dart * Selected state now passed to question12 to display correct counties --------- Co-authored-by: Redux GB <alex@reduxgb.com> Co-authored-by: Adarsha Aryal <109141779+findingaadi@users.noreply.github.com> Co-authored-by: findingaadi <adarshaaryal30@gmail.com> Co-authored-by: Alex <alex@alexis.scot> Co-authored-by: Tim Honisett <40595819@live.napier.ac.uk> Co-authored-by: tayyabcreator <123637905+tayyabcreator@users.noreply.github.com> * feature-taylab-new-pages-April (#58) (#64) * Initial Commit * Implements top app bar * Layout for bottom navigation bar * Top app bar * General Page Layout * Had build error due to "const" constructor. error resolved * Added the JSON files to the repo which consists of all questions along with other information displayed in the app. * Added the JSON files to the repo which consists of all questions along with other information displayed in the app. * changed bottom navigation bar so the number of pages currently user is in gets displayed correctly. * question 10 page, uses string questions intead of directly fetching json. ongoing tasks. * fixed the images loading issue, where the image couldnt be fetched previously. * question 8 and 9 using json data. * fixed the issue with "question" being fetched from the wrong questionnaire in the json data. * fixed both json data loading as there was an error wher question 9 was loading question 8 data. fixed. * app navigation can be done now, since i have 2 pages i am working on, user can navigate back and forth between the pages now and the bottom bar will change accordingly. * first commit * first commit * basic screen working * Updated elements for sizing on screen 3 * Updated elements for sizing on screen 4 * Updated question7.dart * question8.dart pulling county list based on hard coded state * Pass state, crab name and image file to question8.dart * Pass crab name and image file to question3.dart * Pass crab name and image file to question4.dart * Data now passed to Q3, Q4, Q7, Q8 * Screens refactored to work with amended modifiedquestions JSON * Screens refactored to work with amended modified questions JSON. Bottom navigation restored to original format * Code base from Tayyab now in this feature branch. Runs with issues on first page * Code base from Tayyab now in this feature branch. Runs with issues on first page * Added all image assets from original Android app * Pass data back from page3. Returned data variables defined * Pass data back from page4. * Page 4 listbox size fixed for web * Refactored questions_utils.dart * Refactored questions_utils.dart * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * question6.dart page added and linked * Revert "question6.dart page added and linked" This reverts commit 6dc797d. * Page 6 added * question9.dart added * added question6.dart * added question6.dart * Selected state now passed to question12 to display correct counties --------- Co-authored-by: Redux GB <alex@reduxgb.com> Co-authored-by: Adarsha Aryal <109141779+findingaadi@users.noreply.github.com> Co-authored-by: findingaadi <adarshaaryal30@gmail.com> Co-authored-by: Alex <alex@alexis.scot> Co-authored-by: Tim Honisett <40595819@live.napier.ac.uk> Co-authored-by: tayyabcreator <123637905+tayyabcreator@users.noreply.github.com> * Page 16 added with required amendments --------- Co-authored-by: Redux GB <alex@reduxgb.com> Co-authored-by: Adarsha Aryal <109141779+findingaadi@users.noreply.github.com> Co-authored-by: findingaadi <adarshaaryal30@gmail.com> Co-authored-by: Alex <alex@alexis.scot> Co-authored-by: Tim Honisett <40595819@live.napier.ac.uk> Co-authored-by: tayyabcreator <123637905+tayyabcreator@users.noreply.github.com>
1 parent ecb3804 commit d700da3

File tree

5 files changed

+172
-3
lines changed

5 files changed

+172
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
34
zipStoreBase=GRADLE_USER_HOME
45
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

lib/main.dart

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:google_fonts/google_fonts.dart';
3+
import 'package:provider/provider.dart';
4+
import 'package:remar_flutter_app/Screens/splash_page.dart';
5+
import 'package:remar_flutter_app/utils/color_res.dart';
6+
import 'Screens/providers/bottom_state_provider.dart';
7+
8+
9+
void main() {
10+
runApp(const MyApp());
11+
}
12+
13+
class MyApp extends StatelessWidget {
14+
const MyApp({super.key});
15+
16+
@override
17+
Widget build(BuildContext context) {
18+
return MultiProvider(
19+
providers: [
20+
ChangeNotifierProvider(create: (context) => BottomStateProvider())
21+
],
22+
child: MaterialApp(
23+
debugShowCheckedModeBanner: false,
24+
theme: ThemeData(
25+
scaffoldBackgroundColor: Colors.white,
26+
primaryColor: ColorRes.greenColor,
27+
canvasColor: Colors.white,
28+
textTheme: GoogleFonts.latoTextTheme(),
29+
useMaterial3: true,
30+
),
31+
home: const SplashPage(),
32+
// home: QuestionAnswer3Page(image: crabImage, name: crabName),
33+
),
34+
);
35+
}
36+
}
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
import 'dart:convert';
2+
3+
import 'package:flutter/gestures.dart';
4+
import 'package:flutter/material.dart';
5+
import 'package:url_launcher/url_launcher.dart';
6+
7+
class QuestionAnswer16Page extends StatefulWidget {
8+
9+
10+
const QuestionAnswer16Page({
11+
Key? key
12+
}) : super(key: key);
13+
14+
@override
15+
_QuestionAnswer16Page createState() => _QuestionAnswer16Page();
16+
}
17+
18+
class _QuestionAnswer16Page extends State<QuestionAnswer16Page> {
19+
late String description = '';
20+
String selectedAnswer = '';
21+
late String choiceOneText = '';
22+
late String choiceTwoText = '';
23+
late String choiceThreeText = '';
24+
25+
@override
26+
void initState() {
27+
super.initState();
28+
loadQuestionData();
29+
}
30+
31+
void loadQuestionData() async {
32+
// Load JSON data from asset file
33+
String jsonString = await DefaultAssetBundle.of(context)
34+
.loadString('assets/raw_eng/questions2Modified.json');
35+
36+
// Parse JSON data
37+
List<dynamic> jsonData = jsonDecode(jsonString);
38+
39+
// Extract question data for Question16
40+
Map<String, dynamic> questionData = jsonData[15];
41+
42+
43+
// Assign values to variables
44+
setState(() {
45+
description = questionData['description'];
46+
47+
choiceOneText = questionData['choiceOneText'];
48+
choiceTwoText = questionData['choiceTwoText'];
49+
choiceThreeText = questionData['choiceThreeText'];
50+
});
51+
}
52+
53+
@override
54+
Widget build(BuildContext context) {
55+
return Scaffold(
56+
body: Center(
57+
child: Column(
58+
mainAxisAlignment: MainAxisAlignment.center,
59+
children: [
60+
const SizedBox(height: 30),
61+
buildButton(choiceOneText, selectedAnswer == choiceOneText),
62+
const SizedBox(height: 10),
63+
buildButton(choiceTwoText, selectedAnswer == choiceTwoText),
64+
const SizedBox(height: 10),
65+
buildButton(choiceThreeText, selectedAnswer == choiceThreeText),
66+
const SizedBox(height: 30),
67+
RichText(
68+
textAlign: TextAlign.center,
69+
text: TextSpan(
70+
text:
71+
'If you want to contact REMAR, find out about ways to engage more with this research, ask or suggest something, please send a message to ',
72+
style: const TextStyle(
73+
fontSize: 16,
74+
color: Colors.black,
75+
),
76+
children: [
77+
TextSpan(
78+
text: 'remar.quest@gmail.com',
79+
style: const TextStyle(
80+
color: Color.fromARGB(255, 14, 172, 51),
81+
),
82+
recognizer: TapGestureRecognizer()
83+
..onTap = () {
84+
launch(
85+
'mailto:remar.quest@gmail.com?subject=Question for REMAR');
86+
},
87+
),
88+
],
89+
),
90+
),
91+
],
92+
),
93+
),
94+
);
95+
}
96+
97+
Widget buildButton(String title, bool selected) {
98+
return SizedBox(
99+
width: double.infinity,
100+
height: 48.0,
101+
child: ElevatedButton(
102+
onPressed: () {
103+
setState(() {
104+
selectedAnswer = title;
105+
});
106+
},
107+
style: ElevatedButton.styleFrom(
108+
shape: const RoundedRectangleBorder(
109+
borderRadius: BorderRadius.zero,
110+
),
111+
backgroundColor: Colors.green, // Button color remains green
112+
),
113+
child: Text(
114+
title,
115+
style: TextStyle(
116+
color: Colors.black, // Text color remains black
117+
fontWeight: selected ? FontWeight.bold : FontWeight.normal,
118+
),
119+
),
120+
),
121+
);
122+
}
123+
}
124+

lib/question_screens/questions_utils.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import 'package:remar_flutter_app/question_screens/question3.dart';
66
import 'package:remar_flutter_app/question_screens/question4.dart';
77
import 'package:remar_flutter_app/question_screens/question7.dart';
88
import 'package:remar_flutter_app/question_screens/question9.dart';
9+
import 'package:remar_flutter_app/question_screens/question16.dart';
10+
911

1012

1113
// list of answers
@@ -92,12 +94,17 @@ Widget question12 = QuestionAnswer12Page(
9294
);
9395

9496

97+
Widget question16 = const QuestionAnswer16Page(
98+
);
99+
100+
95101
// Add question widgets to the list
96102
List<Widget> questionsPagesList = [
97103
question3,
98104
question4,
99105
question7,
100106
question11,
101107
question12,
102-
const QuestionAnswer13Page(),
108+
question16
109+
//const QuestionAnswer13Page(),
103110
];

test/widget_test.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
import 'package:flutter/material.dart';
99
import 'package:flutter_test/flutter_test.dart';
10-
import 'package:remar_flutter_app/main..dart';
10+
import 'package:remar_flutter_app/main.dart';
11+
1112

1213

1314
void main() {
1415
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
1516
// Build our app and trigger a frame.
1617
await tester.pumpWidget(MyApp());
1718

19+
1820
// Verify that our counter starts at 0.
1921
expect(find.text('0'), findsOneWidget);
2022
expect(find.text('1'), findsNothing);

0 commit comments

Comments
 (0)