-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1d982e2
commit f3dd545
Showing
3 changed files
with
166 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
136 changes: 136 additions & 0 deletions
136
lib/categories/Math/math14@kamal-kaur04/math14HomePage.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:riddleworld/universal/result.dart'; | ||
import 'package:riddleworld/universal/riddleAppbar.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:riddleworld/main.dart'; | ||
|
||
class Math14HomeScreen extends StatefulWidget { | ||
@override | ||
_Math14HomeScreenState createState() => _Math14HomeScreenState(); | ||
} | ||
|
||
class _Math14HomeScreenState extends State<Math14HomeScreen> { | ||
int number; | ||
bool _isScore = false; | ||
int totalScore = 0; | ||
|
||
void resetHandler() { | ||
setState(() { | ||
totalScore = 0; | ||
_isScore = false; | ||
}); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return RiddleBar( | ||
title: 'Inheritance', | ||
body: _isScore | ||
? Result(totalScore, 1, resetHandler, '/mathPage', | ||
answer: totalScore != 1 | ||
? "Wrong answer! Chin up, better luck next time!" | ||
: "Amazing!!! You got it right!!!") | ||
: Center( | ||
child: ListView( | ||
children: <Widget>[ | ||
SizedBox( | ||
height: 10, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Container( | ||
padding: EdgeInsets.all(10), | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
width: 2, | ||
color: Provider.of<AppStateNotifier>(context, | ||
listen: false) | ||
.isDarkMode | ||
? Colors.white | ||
: Colors.black), | ||
color: Colors.transparent), | ||
width: MediaQuery.of(context).size.width * 0.9, | ||
child: Align( | ||
alignment: Alignment.center, | ||
child: Text( | ||
'Old Granny Adams left half her money to her granddaughter and half that amount to her grandson. She left a sixth to her brother, and the remainder, Dollar 1,000, to the dogs\' home. How much did she leave altogether?', | ||
style: TextStyle(fontSize: 15), | ||
))), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.all(8.0), | ||
child: Container( | ||
padding: EdgeInsets.all(8), | ||
width: MediaQuery.of(context).size.width * 0.9, | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
width: 2, | ||
color: Provider.of<AppStateNotifier>(context, | ||
listen: false) | ||
.isDarkMode | ||
? Colors.white | ||
: Colors.black), | ||
color: Colors.transparent), | ||
child: Column( | ||
children: [ | ||
TextField( | ||
decoration: InputDecoration( | ||
labelText: 'Answer', | ||
hintText: 'Enter answer in numbers!!'), | ||
keyboardType: TextInputType.number, | ||
onChanged: (value) => number = int.parse(value), | ||
), | ||
SizedBox( | ||
height: 60, | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only( | ||
top: 10.0, right: 10, left: 10), | ||
child: InkWell( | ||
onTap: () { | ||
if (number == 12000) { | ||
setState(() { | ||
totalScore = 1; | ||
_isScore = true; | ||
}); | ||
} else { | ||
setState(() { | ||
totalScore = 0; | ||
_isScore = true; | ||
}); | ||
} | ||
}, | ||
child: Container( | ||
padding: EdgeInsets.all(10), | ||
decoration: BoxDecoration( | ||
border: Border.all( | ||
width: 2, | ||
color: Provider.of<AppStateNotifier>( | ||
context, | ||
listen: false) | ||
.isDarkMode | ||
? Colors.white | ||
: Colors.black), | ||
color: Colors.transparent), | ||
width: MediaQuery.of(context).size.width * 0.9, | ||
child: Text( | ||
'SUBMIT', | ||
textAlign: TextAlign.center, | ||
style: TextStyle( | ||
fontSize: 25, | ||
fontWeight: FontWeight.w500, | ||
), | ||
), | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters