From 8600263061794c891c381b40cba9814f2788cf33 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 27 Feb 2021 20:47:53 +0800 Subject: [PATCH] flutter: Fix warnings --- src/ui/flutter_app/lib/mill/position.dart | 12 ++++++------ src/ui/flutter_app/lib/widgets/game_page.dart | 8 ++++---- .../flutter_app/lib/widgets/rule_settings_page.dart | 2 -- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/ui/flutter_app/lib/mill/position.dart b/src/ui/flutter_app/lib/mill/position.dart index 27769664..1116b2c1 100644 --- a/src/ui/flutter_app/lib/mill/position.dart +++ b/src/ui/flutter_app/lib/mill/position.dart @@ -41,8 +41,8 @@ class StateInfo { class Position { GameResult result = GameResult.pending; - List board = List(sqNumber); - List _grid = List(7 * 7); + List board = List.filled(sqNumber, ""); + List _grid = List.filled(7 * 7, ""); GameRecorder recorder; @@ -90,24 +90,24 @@ class Position { Move move; Position.boardToGrid() { - _grid = List(); + _grid = []; for (int sq = 0; sq < board.length; sq++) { _grid[squareToIndex[sq]] = board[sq]; } } Position.gridToBoard() { - board = List(); + board = []; for (int i = 0; i < _grid.length; i++) { board[indexToSquare[i]] = _grid[i]; } } Position.clone(Position other) { - _grid = List(); + _grid = []; other._grid.forEach((piece) => _grid.add(piece)); - board = List(); + board = []; other.board.forEach((piece) => board.add(piece)); recorder = other.recorder; diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index 441879f6..e85a561a 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -526,8 +526,8 @@ class _GamePageState extends State with RouteAware { ); } - void showSnackbar(String message) { - var currentScaffold = globalScaffoldKey.currentState; + void showSnackBar(String message) { + //var currentScaffold = globalScaffoldKey.currentState; ScaffoldMessenger.of(context).hideCurrentSnackBar(); ScaffoldMessenger.of(context) .showSnackBar(SnackBar(content: Text(message))); @@ -535,7 +535,7 @@ class _GamePageState extends State with RouteAware { Widget createOperatorBar() { // - final buttonStyle = TextStyle(color: UIColors.primaryColor, fontSize: 20); + //final buttonStyle = TextStyle(color: UIColors.primaryColor, fontSize: 20); final text = Game.shared.position.manualText; final manualStyle = @@ -579,7 +579,7 @@ class _GamePageState extends State with RouteAware { child: Text(S.of(context).copy, style: manualStyle), onPressed: () => Clipboard.setData(ClipboardData(text: text)).then((_) { - showSnackbar(S.of(context).moveHistoryCopied); + showSnackBar(S.of(context).moveHistoryCopied); }), ), TextButton( diff --git a/src/ui/flutter_app/lib/widgets/rule_settings_page.dart b/src/ui/flutter_app/lib/widgets/rule_settings_page.dart index 520747c0..ee9a8880 100644 --- a/src/ui/flutter_app/lib/widgets/rule_settings_page.dart +++ b/src/ui/flutter_app/lib/widgets/rule_settings_page.dart @@ -28,8 +28,6 @@ class RuleSettingsPage extends StatefulWidget { } class _RuleSettingsPageState extends State { - String _version = ""; - @override void initState() { super.initState();