diff --git a/lib/src/models/gameInfoDialog.dart b/lib/src/models/gameInfoDialog.dart index c46bfe6..b8590bd 100644 --- a/lib/src/models/gameInfoDialog.dart +++ b/lib/src/models/gameInfoDialog.dart @@ -1,5 +1,4 @@ import 'package:flutter/cupertino.dart'; -import 'package:mathgame/src/resources/gameCategoryDataProvider.dart'; class GameInfoDialog { String title; diff --git a/lib/src/models/mathPairs/MathPairsRootQandS.dart b/lib/src/models/mathPairs/MathPairsRootQandS.dart index 495e424..4e44477 100644 --- a/lib/src/models/mathPairs/MathPairsRootQandS.dart +++ b/lib/src/models/mathPairs/MathPairsRootQandS.dart @@ -30,4 +30,7 @@ class MathPair { other is MathPair && runtimeType == other.runtimeType && text == other.text; + + @override + int get hashCode => text.hashCode; } diff --git a/lib/src/module/giffy_dialog.dart b/lib/src/module/giffy_dialog.dart deleted file mode 100644 index e8055fc..0000000 --- a/lib/src/module/giffy_dialog.dart +++ /dev/null @@ -1,6 +0,0 @@ -library giffy_dialog; - -export 'src/asset.dart'; -export 'src/flare.dart'; -export 'src/network.dart'; -export 'src/base_dialog.dart' show EntryAnimation; diff --git a/lib/src/module/src/asset.dart b/lib/src/module/src/asset.dart deleted file mode 100644 index d8d2e1f..0000000 --- a/lib/src/module/src/asset.dart +++ /dev/null @@ -1,141 +0,0 @@ -import 'package:flutter/material.dart'; - -import '../giffy_dialog.dart'; -import 'base_dialog.dart'; - -/// Widget that displays Giffy Dialog with local asset. -/// -/// You need local asset for this type of Giffy Dialog. -/// Asset can be `.gif`, `.jpg` or `.png` image file. GIF animation is supported. -/// Transparency of the image is retained. -/// Place the asset under `/assets` directory in the project root. -/// Add the asset to `pubspec.yaml` like so -/// ``` -/// assets: -/// - assets/my_awesome_image.gif -/// ``` -/// Pass the asset to [AssetGiffyDialog] via [image] prop using Flutter's `Image.asset(name)` widget. -/// ``` -/// AssetGiffyDialog( -/// title: Text('Example'), -/// description: Text('Dialog text'), -/// image: Image.asset( -/// 'assets/my_awesome_image.gif', -/// fit: BoxFit.cover, -/// ), -/// ..., -/// ); -class AssetGiffyDialog extends StatelessWidget { - AssetGiffyDialog({ - Key key, - @required this.image, - @required this.title, - this.onOkButtonPressed, - this.onCancelButtonPressed, - this.description, - this.onlyOkButton = false, - this.onlyCancelButton = false, - this.buttonOkText, - this.buttonCancelText, - this.buttonOkColor = Colors.green, - this.buttonCancelColor = Colors.grey, - this.cornerRadius = 8.0, - this.buttonRadius = 8.0, - this.entryAnimation = EntryAnimation.DEFAULT, - }) : assert(image != null), - assert(title != null), - super(key: key); - - /// Image to display in dialog. - /// - /// Pass `Image.asset(name)` widget here. - /// Preferably with `fit: BoxFit.cover` property to cover entire top part of Giffy Dialog. - /// All properties of Image widget are directly passed to Giffy Dialog so feel free to experiment. - final Image image; - - /// Title text. - final Text title; - - /// Description text. - final Text description; - - /// Sets dialog to have only OK button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonCancelText], [buttonCancelColor] and [onCancelButtonPressed] - final bool onlyOkButton; - - /// Sets dialog to have only Cancel button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonOkText], [buttonOkColor] and [onOkButtonPressed] - final bool onlyCancelButton; - - - /// Text for OK button. - /// - /// Default is `OK`. - final Text buttonOkText; - - /// Text for cancel button - /// - /// Default is `Cancel`. - final Text buttonCancelText; - - /// Color of OK button. - /// - /// Default is `Colors.green`. - final Color buttonOkColor; - - /// Color of Cancel button - /// - /// Default is `Colors.grey`. - final Color buttonCancelColor; - - /// Radius applied to the button corners. - /// - /// Default is 8. - final double buttonRadius; - - /// Radius applied to the dialog box corners. - /// - /// Default is 8. - final double cornerRadius; - - /// Callback function to be called on when OK button is pressed. - /// - /// If set to null, then the button will be disabled and by - /// default will resemble a flat button in the Theme's `disabledColor`. - final VoidCallback onOkButtonPressed; - - /// Callback function to be called on when Cancel button is pressed. - /// - /// By default (or if set to null) closes the Giffy Dialog via `Navigator.of(context).pop()`. - final VoidCallback onCancelButtonPressed; - - /// Defines how Giffy Dialog will enter the screen. - /// - /// Default is [EntryAnimation.DEFAULT] - standard Material dialog - /// entrance animation, i.e. slow fade-in in the center of the screen. - final EntryAnimation entryAnimation; - - @override - Widget build(BuildContext context) { - return BaseGiffyDialog( - imageWidget: image, - cornerRadius: cornerRadius, - title: title, - description: description, - onlyOkButton: onlyOkButton, - onlyCancelButton: onlyCancelButton, - buttonCancelColor: buttonCancelColor, - buttonRadius: buttonRadius, - buttonCancelText: buttonCancelText, - buttonOkColor: buttonOkColor, - onOkButtonPressed: onOkButtonPressed, - onCancelButtonPressed: onCancelButtonPressed, - buttonOkText: buttonOkText, - entryAnimation: entryAnimation, - ); - } -} diff --git a/lib/src/module/src/base_dialog.dart b/lib/src/module/src/base_dialog.dart deleted file mode 100644 index 68c9894..0000000 --- a/lib/src/module/src/base_dialog.dart +++ /dev/null @@ -1,268 +0,0 @@ -import 'dart:ui'; - -import 'package:flutter/material.dart'; - -/// Defines variants of entry animations -enum EntryAnimation { - /// Appears in Center, standard Material dialog entrance animation, i.e. slow fade-in in the center of the screen. - DEFAULT, - - /// Enters screen horizontally from the left - LEFT, - - /// Enters screen horizontally from the right - RIGHT, - - /// Enters screen horizontally from the top - TOP, - - /// Enters screen horizontally from the bottom - BOTTOM, - - /// Enters screen from the top left corner - TOP_LEFT, - - /// Enters screen from the top right corner - TOP_RIGHT, - - /// Enters screen from the bottom left corner - BOTTOM_LEFT, - - /// Enters screen from the bottom right corner - BOTTOM_RIGHT, -} - -class BaseGiffyDialog extends StatefulWidget { - BaseGiffyDialog({ - Key key, - @required this.imageWidget, - @required this.title, - @required this.onOkButtonPressed, - @required this.description, - @required this.onlyOkButton, - @required this.onlyCancelButton, - @required this.buttonOkText, - @required this.buttonCancelText, - @required this.buttonOkColor, - @required this.buttonCancelColor, - @required this.cornerRadius, - @required this.buttonRadius, - @required this.entryAnimation, - @required this.onCancelButtonPressed, - }) : super(key: key); - - final Widget imageWidget; - final Text title; - final Text description; - final bool onlyOkButton; - final bool onlyCancelButton; - final Text buttonOkText; - final Text buttonCancelText; - final Color buttonOkColor; - final Color buttonCancelColor; - final double buttonRadius; - final double cornerRadius; - final VoidCallback onOkButtonPressed; - final VoidCallback onCancelButtonPressed; - final EntryAnimation entryAnimation; - - @override - _BaseGiffyDialogState createState() => _BaseGiffyDialogState(); -} - -class _BaseGiffyDialogState extends State - with TickerProviderStateMixin { - AnimationController _animationController; - Animation _entryAnimation; - - get _start { - switch (widget.entryAnimation) { - case EntryAnimation.DEFAULT: - break; - case EntryAnimation.TOP: - return Offset(0.0, -1.0); - case EntryAnimation.TOP_LEFT: - return Offset(-1.0, -1.0); - case EntryAnimation.TOP_RIGHT: - return Offset(1.0, -1.0); - case EntryAnimation.LEFT: - return Offset(-1.0, 0.0); - case EntryAnimation.RIGHT: - return Offset(1.0, 0.0); - case EntryAnimation.BOTTOM: - return Offset(0.0, 1.0); - case EntryAnimation.BOTTOM_LEFT: - return Offset(-1.0, 1.0); - case EntryAnimation.BOTTOM_RIGHT: - return Offset(1.0, 1.0); - } - } - - get _isDefaultEntryAnimation => - widget.entryAnimation == EntryAnimation.DEFAULT; - - @override - void initState() { - super.initState(); - if (!_isDefaultEntryAnimation) { - _animationController = AnimationController( - vsync: this, - duration: Duration(milliseconds: 300), - ); - _entryAnimation = - Tween(begin: _start, end: Offset(0.0, 0.0)).animate( - CurvedAnimation( - parent: _animationController, - curve: Curves.easeIn, - ), - )..addListener(() => setState(() {})); - _animationController.forward(); - } - } - - @override - void dispose() { - _animationController?.dispose(); - super.dispose(); - } - - Widget _buildPortraitWidget(BuildContext context, Widget imageWidget) { - return Column( -// crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - child: Container( - padding: EdgeInsets.all(5), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - topRight: Radius.circular(widget.cornerRadius), - topLeft: Radius.circular(widget.cornerRadius)), - ), - child: imageWidget - ), - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Padding( - padding: const EdgeInsets.only(top: 16.0), - child: widget.title, - ), - Padding( - padding: const EdgeInsets.all(8.0), - child: widget.description, - ), - _buildButtonsBar(context) - ], - ), - ), - ], - ); - } - - Widget _buildLandscapeWidget(BuildContext context, Widget imageWidget) { - return Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Expanded( - child: ClipRRect( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(widget.cornerRadius), - bottomLeft: Radius.circular(widget.cornerRadius)), - child: imageWidget, - ), - ), - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - Padding( - padding: const EdgeInsets.only(top: 16.0), - child: widget.title, - ), - Padding( - padding: const EdgeInsets.all(3.0), - child: widget.description, - ), - _buildButtonsBar(context), - ], - ), - ), - ], - ); - } - - Widget _buildButtonsBar(BuildContext context) { - return Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: !widget.onlyOkButton - ? MainAxisAlignment.spaceEvenly - : MainAxisAlignment.center, - children: [ - if (!widget.onlyOkButton) ...[ - RaisedButton( - color: widget.buttonCancelColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(widget.buttonRadius)), - onPressed: widget.onCancelButtonPressed ?? - () => Navigator.of(context).pop(), - child: widget.buttonCancelText ?? - Text( - 'Cancel', - style: TextStyle(color: Colors.white), - ), - ) - ], - if (!widget.onlyCancelButton) ...[ - RaisedButton( - color: widget.buttonOkColor, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(widget.buttonRadius)), - onPressed: widget.onOkButtonPressed, - child: widget.buttonOkText ?? - Text( - 'OK', - style: TextStyle(color: Colors.white), - ), - ), - ], - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - final width = MediaQuery.of(context).size.width; - final isPortrait = - MediaQuery.of(context).orientation == Orientation.portrait; - return Dialog( - elevation: 0.0, - backgroundColor: Colors.transparent, - child: Container( - transform: !_isDefaultEntryAnimation - ? Matrix4.translationValues( - _entryAnimation.value.dx * width, - _entryAnimation.value.dy * width, - 0, - ) - : null, - height: MediaQuery.of(context).size.height * 0.7, - width: MediaQuery.of(context).size.width * (isPortrait ? 0.8 : 0.6), - child: Material( - type: MaterialType.card, - color: Color(0xFF363636), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(widget.cornerRadius)), - elevation: Theme.of(context).dialogTheme.elevation ?? 24.0, - child: isPortrait - ? _buildPortraitWidget(context, widget.imageWidget) - : _buildLandscapeWidget(context, widget.imageWidget), - ), - ), - ); - } -} diff --git a/lib/src/module/src/flare.dart b/lib/src/module/src/flare.dart deleted file mode 100644 index 79b48cf..0000000 --- a/lib/src/module/src/flare.dart +++ /dev/null @@ -1,152 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flare_flutter/flare_actor.dart'; - -import 'base_dialog.dart'; - -/// Widget that displays Giffy Dialog with flare asset. -/// -/// You need local [Flare](https://github.com/2d-inc/Flare-Flutter) `.flr` asset for this type of Giffy Dialog. -/// Place the asset under `/assets` directory in the project root. -/// Add the asset to `pubspec.yaml` like so -/// ``` -/// assets: -/// - assets/my_awesome_flare.flr -/// ``` -/// Set [FlareGiffyDialog]'s [flarePath] prop to the asset path. -/// You also must specify the name of animation sequence to apply via `flareAnimation` prop. -/// ``` -/// FlareGiffyDialog( -/// title: Text('Example'), -/// description: Text('Dialog text'), -/// flarePath: 'assets/my_awesome_flare.flr', -/// flareAnimation: 'dancing', -/// ..., -/// ); -class FlareGiffyDialog extends StatelessWidget { - FlareGiffyDialog({ - Key key, - @required this.flarePath, - @required this.flareAnimation, - @required this.title, - this.onOkButtonPressed, - this.flareFit = BoxFit.cover, - this.onCancelButtonPressed, - this.description, - this.onlyOkButton = false, - this.onlyCancelButton = false, - this.buttonOkText, - this.buttonCancelText, - this.cardBackgroundColor, - this.buttonOkColor = Colors.green, - this.buttonCancelColor = Colors.grey, - this.cornerRadius = 8.0, - this.buttonRadius = 8.0, - this.entryAnimation = EntryAnimation.DEFAULT, - }) : assert(flarePath != null), - assert(title != null), - assert(flareAnimation != null), - super(key: key); - - /// Path to the Flare asset. - final String flarePath; - - /// Name of Flare animation to apply. - final String flareAnimation; - - /// BoxFit sizing of the Flare asset. - final BoxFit flareFit; - - /// Title text. - final Text title; - - /// Description text. - final Text description; - - /// Sets dialog to have only OK button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonCancelText], [buttonCancelColor] and [onCancelButtonPressed] - final bool onlyOkButton; - - /// Sets dialog to have only Cancel button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonOkText], [buttonOkColor] and [onOkButtonPressed] - final bool onlyCancelButton; - - /// Text for OK button. - /// - /// Default is `OK`. - final Text buttonOkText; - - /// Text for cancel button - /// - /// Default is `Cancel`. - final Text buttonCancelText; - - /// Color of OK button. - /// - /// Default is `Colors.green`. - final Color buttonOkColor; - - /// Color of Cancel button - /// - /// Default is `Colors.grey`. - final Color buttonCancelColor; - - /// TODO: this props is not used at the moment. - final Color cardBackgroundColor; - - /// Radius applied to the button corners. - /// - /// Default is 8. - final double buttonRadius; - - /// Radius applied to the dialog box corners. - /// - /// Default is 8. - final double cornerRadius; - - /// Callback function to be called on when OK button is pressed. - /// - /// If set to null, then the button will be disabled and by - /// default will resemble a flat button in the Theme's `disabledColor`. - final VoidCallback onOkButtonPressed; - - /// Callback function to be called on when Cancel button is pressed. - /// - /// By default (or if set to null) closes the Giffy Dialog via `Navigator.of(context).pop()`. - final VoidCallback onCancelButtonPressed; - - /// Defines how Giffy Dialog will enter the screen. - /// - /// Default is [EntryAnimation.DEFAULT] - standard Material dialog - /// entrance animation, i.e. slow fade-in in the center of the screen. - final EntryAnimation entryAnimation; - - @override - Widget build(BuildContext context) { - final imageWidget = FlareActor( - flarePath, - alignment: Alignment.center, - fit: flareFit, - animation: flareAnimation, - ); - return BaseGiffyDialog( - imageWidget: imageWidget, - cornerRadius: cornerRadius, - title: title, - description: description, - onlyOkButton: onlyOkButton, - onlyCancelButton: onlyCancelButton, - buttonCancelColor: buttonCancelColor, - buttonRadius: buttonRadius, - buttonCancelText: buttonCancelText, - buttonOkColor: buttonOkColor, - onOkButtonPressed: onOkButtonPressed, - buttonOkText: buttonOkText, - onCancelButtonPressed: onCancelButtonPressed, - entryAnimation: entryAnimation, - ); - } -} diff --git a/lib/src/module/src/network.dart b/lib/src/module/src/network.dart deleted file mode 100644 index f5f8174..0000000 --- a/lib/src/module/src/network.dart +++ /dev/null @@ -1,130 +0,0 @@ -import 'package:flutter/material.dart'; - -import 'base_dialog.dart'; - -/// Widget that displays Giffy Dialog with image obtained from the network. -/// -/// Pass the network image URL to [NetworkGiffyDialog]'s [image] prop using Flutter's `Image.network(src)` widget. -/// ``` -/// NetworkGiffyDialog( -/// title: Text('Example'), -/// description: Text('Dialog text'), -/// image: Image.network( -/// 'https://example.com/link/to/image.gif', -/// fit: BoxFit.cover, -/// ), -/// ..., -/// ); -class NetworkGiffyDialog extends StatelessWidget { - NetworkGiffyDialog({ - Key key, - @required this.image, - @required this.title, - this.onOkButtonPressed, - this.onCancelButtonPressed, - this.description, - this.onlyOkButton = false, - this.onlyCancelButton = false, - this.buttonOkText, - this.buttonCancelText, - this.buttonOkColor = Colors.green, - this.buttonCancelColor = Colors.grey, - this.cornerRadius = 8.0, - this.buttonRadius = 8.0, - this.entryAnimation = EntryAnimation.DEFAULT, - }) : assert(image != null), - assert(title != null), - super(key: key); - - /// Image to display in dialog. - /// - /// Pass `Image.network(src)` widget here. - /// Preferably with `fit: BoxFit.cover` property to cover entire top part of Giffy Dialog. - /// All properties of Image widget are directly passed to Giffy Dialog so feel free to experiment. - final Widget image; - - /// Title text. - final Text title; - - /// Description text - final Text description; - - /// Sets dialog to have only OK button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonCancelText], [buttonCancelColor] and [onCancelButtonPressed] - final bool onlyOkButton; - - /// Sets dialog to have only Cancel button. - /// - /// Default is false. - /// If set to true there is no need to set [buttonOkText], [buttonOkColor] and [onOkButtonPressed] - final bool onlyCancelButton; - - /// Text for OK button. - /// - /// Default is `OK`. - final Text buttonOkText; - - /// Text for cancel button - /// - /// Default is `Cancel`. - final Text buttonCancelText; - - /// Color of OK button. - /// - /// Default is `Colors.green`. - final Color buttonOkColor; - - /// Color of Cancel button - /// - /// Default is `Colors.grey`. - final Color buttonCancelColor; - - /// Radius applied to the button corners. - /// - /// Default is 8. - final double buttonRadius; - - /// Radius applied to the dialog box corners. - /// - /// Default is 8. - final double cornerRadius; - - /// Callback function to be called on when OK button is pressed. - /// - /// If set to null, then the button will be disabled and by - /// default will resemble a flat button in the Theme's `disabledColor`. - final VoidCallback onOkButtonPressed; - - /// Callback function to be called on when Cancel button is pressed. - /// - /// By default (or if set to null) closes the Giffy Dialog via `Navigator.of(context).pop()`. - final VoidCallback onCancelButtonPressed; - - /// Defines how Giffy Dialog will enter the screen. - /// - /// Default is [EntryAnimation.DEFAULT] - standard Material dialog - /// entrance animation, i.e. slow fade-in in the center of the screen. - final EntryAnimation entryAnimation; - - @override - Widget build(BuildContext context) { - return BaseGiffyDialog( - imageWidget: image, - cornerRadius: cornerRadius, - title: title, - description: description, - onlyOkButton: onlyOkButton, - onlyCancelButton: onlyCancelButton, - buttonCancelColor: buttonCancelColor, - buttonRadius: buttonRadius, - buttonCancelText: buttonCancelText, - buttonOkColor: buttonOkColor, - onOkButtonPressed: onOkButtonPressed, - onCancelButtonPressed: onCancelButtonPressed, - buttonOkText: buttonOkText, - entryAnimation: entryAnimation, - ); - } -} diff --git a/lib/src/provider/MagicTriangleProvider.dart b/lib/src/provider/MagicTriangleProvider.dart index eb5f9bc..f379e2f 100644 --- a/lib/src/provider/MagicTriangleProvider.dart +++ b/lib/src/provider/MagicTriangleProvider.dart @@ -24,7 +24,7 @@ class MagicTriangleProvider with ChangeNotifier { bool _timeOut; int _time; bool _pause = false; - int currentScore = 0 ; + int currentScore = 0; bool get timeOut => _timeOut; @@ -75,7 +75,7 @@ class MagicTriangleProvider with ChangeNotifier { } } - Future checkResult(int index, MagicTriangleGrid digit) async { + Future checkResult(int index, MagicTriangleGrid digit) async { if (!timeOut) { int activeTriangelIndex = _currentState.listTriangle.indexWhere((val) => val.isActive == true); @@ -101,7 +101,7 @@ class MagicTriangleProvider with ChangeNotifier { _currentState.answer == sumOfBottomSide) { await Future.delayed(Duration(milliseconds: 300)); _index = _index + 1; - currentScore = currentScore+(ScoreUtil.magicTriangleScore ).toInt(); + currentScore = currentScore + (ScoreUtil.magicTriangleScore).toInt(); _currentState = _list[_index]; restartTimer(); notifyListeners(); @@ -146,21 +146,17 @@ class MagicTriangleProvider with ChangeNotifier { var dialogResult = await _dialogService.showDialog( type: KeyUtil.GameOverDialog, gameCategoryType: GameCategoryType.MAGIC_TRIANGLE, - score: currentScore.toDouble(), + score: currentScore.toDouble(), coin: _index * CoinUtil.magicTriangleCoin, isPause: _pause); if (dialogResult.exit) { - homeViewModel.updateScoreboard( - GameCategoryType.MAGIC_TRIANGLE, - currentScore.toDouble(), - _index * CoinUtil.magicTriangleCoin); + homeViewModel.updateScoreboard(GameCategoryType.MAGIC_TRIANGLE, + currentScore.toDouble(), _index * CoinUtil.magicTriangleCoin); GetIt.I().goBack(); } else if (dialogResult.restart) { - homeViewModel.updateScoreboard( - GameCategoryType.MAGIC_TRIANGLE, - currentScore.toDouble(), - _index * CoinUtil.magicTriangleCoin); + homeViewModel.updateScoreboard(GameCategoryType.MAGIC_TRIANGLE, + currentScore.toDouble(), _index * CoinUtil.magicTriangleCoin); timerSubscription.cancel(); startGame(); } else if (dialogResult.play) { @@ -196,6 +192,7 @@ class MagicTriangleProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/MathGridProvider.dart b/lib/src/provider/MathGridProvider.dart index 6a70f5b..9722d4a 100644 --- a/lib/src/provider/MathGridProvider.dart +++ b/lib/src/provider/MathGridProvider.dart @@ -189,6 +189,7 @@ class MathGridProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/calculatorProvider.dart b/lib/src/provider/calculatorProvider.dart index 783366b..6560676 100644 --- a/lib/src/provider/calculatorProvider.dart +++ b/lib/src/provider/calculatorProvider.dart @@ -167,6 +167,7 @@ class CalculatorProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/correctAnswerProvider.dart b/lib/src/provider/correctAnswerProvider.dart index 36ff4a0..ff1956b 100644 --- a/lib/src/provider/correctAnswerProvider.dart +++ b/lib/src/provider/correctAnswerProvider.dart @@ -166,6 +166,7 @@ class CorrectAnswerProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/mathPairsProvider.dart b/lib/src/provider/mathPairsProvider.dart index 145cbe4..c1cf09b 100644 --- a/lib/src/provider/mathPairsProvider.dart +++ b/lib/src/provider/mathPairsProvider.dart @@ -175,6 +175,7 @@ class MathPairsProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/mentalArithmeticProvider.dart b/lib/src/provider/mentalArithmeticProvider.dart index 565e81a..454a55b 100644 --- a/lib/src/provider/mentalArithmeticProvider.dart +++ b/lib/src/provider/mentalArithmeticProvider.dart @@ -191,6 +191,7 @@ class MentalArithmeticProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); this.localTimerSubscription.cancel(); } diff --git a/lib/src/provider/quickCalculationProvider.dart b/lib/src/provider/quickCalculationProvider.dart index 9890b83..5c28dc3 100644 --- a/lib/src/provider/quickCalculationProvider.dart +++ b/lib/src/provider/quickCalculationProvider.dart @@ -178,6 +178,7 @@ class QuickCalculationProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/signProvider.dart b/lib/src/provider/signProvider.dart index 5c727ae..2361383 100644 --- a/lib/src/provider/signProvider.dart +++ b/lib/src/provider/signProvider.dart @@ -164,6 +164,7 @@ class SignProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/provider/squareRootProvider.dart b/lib/src/provider/squareRootProvider.dart index dcb4cdb..09887cb 100644 --- a/lib/src/provider/squareRootProvider.dart +++ b/lib/src/provider/squareRootProvider.dart @@ -165,6 +165,7 @@ class SquareRootProvider with ChangeNotifier { } void dispose() { + super.dispose(); this.timerSubscription.cancel(); } } diff --git a/lib/src/ui/calculator/calculator.dart b/lib/src/ui/calculator/calculator.dart index 1fce644..e063ab7 100644 --- a/lib/src/ui/calculator/calculator.dart +++ b/lib/src/ui/calculator/calculator.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:mathgame/src/module/giffy_dialog.dart'; import 'package:mathgame/src/provider/calculatorProvider.dart'; import 'package:mathgame/src/resources/gameCategoryDataProvider.dart'; import 'package:mathgame/src/ui/calculator/calculator_button.dart'; diff --git a/lib/src/ui/correctAnswer/correct_answer_button.dart b/lib/src/ui/correctAnswer/correct_answer_button.dart index 2706c95..d7e9cad 100644 --- a/lib/src/ui/correctAnswer/correct_answer_button.dart +++ b/lib/src/ui/correctAnswer/correct_answer_button.dart @@ -37,6 +37,5 @@ class CorrectAnswerButton extends StatelessWidget { ), ), ); - ; } } diff --git a/lib/src/ui/dashboard.dart b/lib/src/ui/dashboard.dart index 050754c..1769ce9 100644 --- a/lib/src/ui/dashboard.dart +++ b/lib/src/ui/dashboard.dart @@ -8,9 +8,6 @@ import 'package:mathgame/src/utility/keyUtil.dart'; import 'package:mathgame/src/utility/sizeConfig.dart'; -import 'home.dart'; -import 'package:mathgame/src/ui/home.dart'; -import 'package:async/async.dart'; import 'package:provider_architecture/provider_architecture.dart'; class DashBoardPage extends StatefulWidget { diff --git a/lib/src/ui/home.dart b/lib/src/ui/home.dart index f36608e..da51b7e 100644 --- a/lib/src/ui/home.dart +++ b/lib/src/ui/home.dart @@ -1,7 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; -import 'package:mathgame/src/module/giffy_dialog.dart'; import 'package:mathgame/src/resources/gameCategoryDataProvider.dart'; import 'package:mathgame/src/resources/navigation_service.dart'; import 'package:provider_architecture/provider_architecture.dart'; diff --git a/lib/src/ui/mathPairs/math_pairs_button.dart b/lib/src/ui/mathPairs/math_pairs_button.dart index 24aecc6..6530b85 100644 --- a/lib/src/ui/mathPairs/math_pairs_button.dart +++ b/lib/src/ui/mathPairs/math_pairs_button.dart @@ -45,6 +45,5 @@ class MathPairsButton extends StatelessWidget { ), ), ); - ; } } diff --git a/lib/src/ui/mentalArithmetic/mental_arithmetic.dart b/lib/src/ui/mentalArithmetic/mental_arithmetic.dart index 5128b9d..b66ecd3 100644 --- a/lib/src/ui/mentalArithmetic/mental_arithmetic.dart +++ b/lib/src/ui/mentalArithmetic/mental_arithmetic.dart @@ -1,7 +1,6 @@ import 'package:flutter/material.dart'; import 'package:mathgame/src/provider/mentalArithmeticProvider.dart'; import 'package:mathgame/src/resources/gameCategoryDataProvider.dart'; -import 'package:mathgame/src/ui/calculator/calculator_button.dart'; import 'package:mathgame/src/ui/timer.dart'; import 'package:provider/provider.dart'; diff --git a/lib/src/ui/mentalArithmetic/mental_arithmetic_button.dart b/lib/src/ui/mentalArithmetic/mental_arithmetic_button.dart index 29b5d5c..1f9fa36 100644 --- a/lib/src/ui/mentalArithmetic/mental_arithmetic_button.dart +++ b/lib/src/ui/mentalArithmetic/mental_arithmetic_button.dart @@ -40,6 +40,5 @@ class MentalArithmeticButton extends StatelessWidget { ), ), ); - ; } } diff --git a/lib/src/ui/quickCalculation/quick_calculation_button.dart b/lib/src/ui/quickCalculation/quick_calculation_button.dart index 0aff9c7..4578f65 100644 --- a/lib/src/ui/quickCalculation/quick_calculation_button.dart +++ b/lib/src/ui/quickCalculation/quick_calculation_button.dart @@ -42,6 +42,5 @@ class QuickCalculationButton extends StatelessWidget { ), ), ); - ; } } diff --git a/lib/src/ui/squareRoot/square_root_button.dart b/lib/src/ui/squareRoot/square_root_button.dart index c72c4e6..d45740b 100644 --- a/lib/src/ui/squareRoot/square_root_button.dart +++ b/lib/src/ui/squareRoot/square_root_button.dart @@ -36,6 +36,5 @@ class SquareRootButton extends StatelessWidget { ), ), ); - ; } } diff --git a/lib/src/utility/MultiDigitCounter.dart b/lib/src/utility/MultiDigitCounter.dart index 56d04c6..228d74b 100644 --- a/lib/src/utility/MultiDigitCounter.dart +++ b/lib/src/utility/MultiDigitCounter.dart @@ -1,6 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:mathgame/src/provider/signProvider.dart'; -import 'package:provider/provider.dart'; import 'SingleDigitCounter.dart'; diff --git a/lib/src/utility/mathUtil.dart b/lib/src/utility/mathUtil.dart index bd4478d..4dcb9b6 100644 --- a/lib/src/utility/mathUtil.dart +++ b/lib/src/utility/mathUtil.dart @@ -14,6 +14,7 @@ class MathUtil { return x[result]; } + // ignore: missing_return static int evaluate(int x1, String sign, int x3) { switch (sign) { case "+": @@ -29,7 +30,8 @@ class MathUtil { } void main() { - for(int i=0;i<100;i++){ - print("${MathUtil.generateRandomAnswer(10, 30)} ${MathUtil.generateRandomAnswer(10, 30)}"); + for (int i = 0; i < 100; i++) { + print( + "${MathUtil.generateRandomAnswer(10, 30)} ${MathUtil.generateRandomAnswer(10, 30)}"); } }