This file contains hidden or 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
| import 'constants.dart'; | |
| import 'package:http/http.dart' as http; | |
| import 'dart:convert'; | |
| class Brain { | |
| Future<dynamic> getCumulativeCount({String userMMR}) async { | |
| int roundedMMR1 = int.parse(userMMR); | |
| int roundedMMR2 = (roundedMMR1 / 100).round(); | |
| print(roundedMMR2); |
This file contains hidden or 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
| // Button press which will take people to the results page | |
| TextField( | |
| // User will only be inputting numbers so we want to make this easier for the user | |
| keyboardType: TextInputType.number, | |
| // No ones MMR is more than 4 digits long | |
| maxLength: 4, | |
| maxLengthEnforced: true, | |
| style: TextStyle( |
This file contains hidden or 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
| // Function to use the brain to get the percentage | |
| class _ResultsPageState extends State<ResultsPage> { | |
| // Text variable to be used to show the user their Percentage | |
| String userPercentage = '?'; | |
| void getUserPercentage () async { | |
| // Store the result of the getCumulativeCount method found in the Brain class. This method | |
| // requires an input which we get from the value that was passed from the input_page. To |
This file contains hidden or 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
| // Creating an empty variable | |
| String response; | |
| // Logic deciding what text to show the user | |
| if (double.parse(userPercentage) >= 75.0) { | |
| response = 'You are really bad, consider uninstalling'; | |
| } else if (double.parse(userPercentage) >= 50.0 && | |
| double.parse(userPercentage) < 75.0) { | |
| response = 'You\'ll be good... some day...'; | |
| } else if (double.parse(userPercentage) >= 5.0 && |
This file contains hidden or 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
| // Function to return either a spinner or some text depending on whether a result is available | |
| Widget loadingSpinner() { | |
| if (loading == true) { | |
| return SpinKitDoubleBounce( | |
| color: Colors.red, | |
| size: 50, | |
| ); | |
| } else { | |
| return Text( | |
| '$userPercentage%', |
This file contains hidden or 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
| void main() { | |
| Sample newSample = Sample(); | |
| print(newSample.counts); | |
| void setToZero () { | |
| // for (var i = 0; i < newSample.counts.length; i++) { | |
| // newSample.counts[i] = 0; | |
| // } |
This file contains hidden or 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
| abstract class Entry { | |
| String name; | |
| Entry(this.name); | |
| void something(); | |
| } |
This file contains hidden or 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
| void main() { | |
| BM newBM = BM(amount: 3, discomfort: 5, bristolScale: 3, name: 'Cool name', submittedTime: 'Thursday'); | |
| print(newBM.amount); | |
| print(newBM.name); | |
| } |
This file contains hidden or 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
| class EntryListModel extends ChangeNotifier { | |
| List<Entry2> entryList = <Entry2>[]; | |
| void addNewEntry(EntryType entryType) { | |
| entryList.add(Entry2(entryType)); | |
| notifyListeners(); | |
| } | |
| void deleteEntry(String id) { | |
| entryList.removeWhere((element) => element.id == id); |
This file contains hidden or 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
| import 'package:flutter/material.dart'; | |
| import 'package:sudoku_solver/constants/enums.dart'; | |
| import 'package:sudoku_solver/models/board_square.dart'; | |
| import 'package:sudoku_solver/models/position_model.dart'; | |
| import 'dart:async'; | |
| import 'package:flutter/foundation.dart'; | |
| class SudokuGrid extends ChangeNotifier { | |
| List<List<BoardSquare>> userBoard; | |
| int width; |