Skip to content

Commit 73bb115

Browse files
committed
Merge branch 'master' of http://github.com/masterashu/Heutagogy
2 parents fa0eb19 + e760877 commit 73bb115

5 files changed

Lines changed: 111 additions & 24 deletions

File tree

lib/lesson_3_tests.dart

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import 'package:flutter/cupertino.dart';
22
import 'package:flutter/material.dart';
33
import 'package:flutter/widgets.dart';
44
import 'package:heutagogy/data_models.dart';
5+
import 'package:heutagogy/my_stepper.dart';
6+
import 'package:heutagogy/tests/star_rating.dart';
57
import 'package:heutagogy/tests/test1.dart';
68
import 'package:heutagogy/tests/test2.dart';
79
import 'package:heutagogy/tests/test3.dart';
@@ -45,7 +47,13 @@ class Lesson1TestsState extends State<MyLesson3Tests> {
4547
isActive: true,
4648
state: StepState.indexed,
4749
));
48-
50+
mySteps.add(Step(
51+
title: Text(''),
52+
content: StarTest(
53+
"Put a bowl of water for birds everyday in your school and give yourself 3 stars.",
54+
key: ObjectKey(1),
55+
),
56+
isActive: true));
4957
for (int z = 0; z < maxLength; z++) {
5058
if (lessonData.test1 != null && z < lessonData.test1.length) {
5159
mySteps.add(Step(
@@ -104,14 +112,23 @@ class Lesson1TestsState extends State<MyLesson3Tests> {
104112
));
105113
}
106114
}
115+
116+
mySteps.add(Step(
117+
title: Text(''),
118+
content: StarTest(
119+
"Does the air and water have weight? Prove it and give yourself 3 stars.",
120+
key: ObjectKey(2),
121+
),
122+
isActive: true));
107123
mySteps.add(Step(
108124
title: Text(''),
109125
content:
110126
Test8Page([100, 200, 300, 400, 500, 600, 700, 800, 900, 1000], [200, 300, 600, 800, 900]),
111127
isActive: true,
112128
state: StepState.indexed,
113129
));
114-
mySteps.add(Step(title: Text(''), content: WellDonePage(), isActive: true, state: StepState.indexed));
130+
mySteps.add(
131+
Step(title: Text(''), content: WellDonePage(), isActive: true, state: StepState.indexed));
115132
}
116133

117134
LessonData lessonData;
@@ -148,10 +165,10 @@ class Lesson1TestsState extends State<MyLesson3Tests> {
148165
data: ThemeData(
149166
canvasColor: Colors.white,
150167
),
151-
child: Stepper(
152-
type: StepperType.horizontal,
153-
currentStep: this.currentStep,
154-
onStepTapped: onStepTapped,
168+
child: MyStepper(
169+
type: MyStepperType.horizontal,
170+
currentMyStep: this.currentStep,
171+
onMyStepTapped: onStepTapped,
155172
steps: mySteps,
156173
controlsBuilder: (BuildContext context,
157174
{VoidCallback onStepContinue, VoidCallback onStepCancel}) {

lib/summative_assesment.dart

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ class Lesson1TestsState extends State<SummativeTests> {
4141
List<String> subjects = ["english", "maths", "evs", "telegu", "biology"];
4242

4343
for (String sub in subjects) {
44+
mySteps.add(
45+
Step(
46+
content: TransitionPage(subject: sub),
47+
isActive: true,
48+
title: Text(sub.toUpperCase()),
49+
state: StepState.indexed,
50+
),
51+
);
4452

45-
mySteps.add(Step(
46-
title: Text(''),
47-
content:TransitionPage(subject: sub),isActive: true));
4853
if (sub == "maths") {
4954
mySteps.add(Step(
5055
title: Text(''),
@@ -169,11 +174,8 @@ class Lesson1TestsState extends State<SummativeTests> {
169174
}
170175
}
171176

172-
mySteps.add(Step(
173-
title: Text(''),
174-
content: WellDonePage(),
175-
isActive: true,
176-
state: StepState.indexed));
177+
mySteps.add(
178+
Step(title: Text(''), content: WellDonePage(), isActive: true, state: StepState.indexed));
177179
}
178180

179181
LessonData lessonData;
@@ -245,8 +247,11 @@ class Lesson1TestsState extends State<SummativeTests> {
245247
child: Padding(
246248
padding: EdgeInsets.fromLTRB(0, 0, 20, 0),
247249
child: FloatingActionButton.extended(
248-
backgroundColor: Colors.white,
249-
splashColor: Colors.lightBlueAccent,
250+
backgroundColor:
251+
(currentStep == mySteps.length - 1) ? Colors.blueAccent : Colors.white,
252+
splashColor: (currentStep == mySteps.length - 1)
253+
? Colors.white54
254+
: Colors.lightBlueAccent,
250255
heroTag: 'NextStep',
251256
onPressed: () {
252257
if (currentStep < mySteps.length - 1) {
@@ -258,19 +263,21 @@ class Lesson1TestsState extends State<SummativeTests> {
258263
}
259264
},
260265
label: Text(
261-
"Next",
266+
(currentStep == mySteps.length - 1) ? "Finish" : "Next",
262267
style: TextStyle(
263-
color: Colors.blue,
268+
color: (currentStep == mySteps.length - 1) ? Colors.white : Colors.blue,
264269
fontSize: 16,
265270
fontWeight: FontWeight.bold),
266271
),
267272
shape: RoundedRectangleBorder(
268273
side: BorderSide(color: Colors.blue, width: 1),
269274
borderRadius: BorderRadius.circular(40)),
270-
icon: Icon(
271-
Icons.navigate_next,
272-
color: Colors.blue,
273-
),
275+
icon: (currentStep == mySteps.length - 1)
276+
? null
277+
: Icon(
278+
Icons.navigate_next,
279+
color: Colors.blue,
280+
),
274281
),
275282
),
276283
),
@@ -291,8 +298,7 @@ class Lesson1TestsState extends State<SummativeTests> {
291298
Navigator.pop(context);
292299
}
293300
},
294-
shape: CircleBorder(
295-
side: BorderSide(color: Colors.blue, width: 1)),
301+
shape: CircleBorder(side: BorderSide(color: Colors.blue, width: 1)),
296302
child: Icon(
297303
Icons.arrow_back,
298304
color: Colors.blue,

lib/tests/star_rating.dart

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:smooth_star_rating/smooth_star_rating.dart';
3+
4+
class StarTest extends StatefulWidget {
5+
final String heading;
6+
7+
StarTest(this.heading, {Key key}) : super(key: key);
8+
9+
@override
10+
_StarTestState createState() => _StarTestState(heading);
11+
}
12+
13+
class _StarTestState extends State<StarTest> {
14+
String heading;
15+
double rating;
16+
17+
_StarTestState(this.heading);
18+
19+
@override
20+
void initState() {
21+
super.initState();
22+
rating = 0;
23+
}
24+
25+
@override
26+
Widget build(BuildContext context) {
27+
return Container(
28+
child: Column(
29+
mainAxisAlignment: MainAxisAlignment.center,
30+
children: <Widget>[
31+
Padding(
32+
child: Center(
33+
child: Text(
34+
heading,
35+
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20),
36+
),
37+
),
38+
padding: EdgeInsets.only(top: 10, bottom: 20),
39+
),
40+
SmoothStarRating(
41+
allowHalfRating: false,
42+
onRatingChanged: (v) {
43+
rating = v;
44+
setState(() {});
45+
},
46+
starCount: 3,
47+
rating: rating,
48+
size: 40.0,
49+
color: Colors.green,
50+
borderColor: Colors.green,
51+
spacing: 0.0)
52+
],
53+
),
54+
);
55+
}
56+
}

pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,13 @@ packages:
205205
description: flutter
206206
source: sdk
207207
version: "0.0.99"
208+
smooth_star_rating:
209+
dependency: "direct main"
210+
description:
211+
name: smooth_star_rating
212+
url: "https://pub.dartlang.org"
213+
source: hosted
214+
version: "1.0.3"
208215
source_span:
209216
dependency: transitive
210217
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ dependencies:
3030
path_provider: ^1.4.4
3131
cached_network_image: ^1.1.3
3232
youtube_player: ^3.5.0
33+
smooth_star_rating: 1.0.3
3334

3435

3536

0 commit comments

Comments
 (0)