flutter: Fix warnings

This commit is contained in:
Calcitem 2021-02-27 20:47:53 +08:00
parent 36b422634c
commit 8600263061
3 changed files with 10 additions and 12 deletions

View File

@ -41,8 +41,8 @@ class StateInfo {
class Position {
GameResult result = GameResult.pending;
List<String> board = List<String>(sqNumber);
List<String> _grid = List<String>(7 * 7);
List<String> board = List.filled(sqNumber, "");
List<String> _grid = List.filled(7 * 7, "");
GameRecorder recorder;
@ -90,24 +90,24 @@ class Position {
Move move;
Position.boardToGrid() {
_grid = List<String>();
_grid = [];
for (int sq = 0; sq < board.length; sq++) {
_grid[squareToIndex[sq]] = board[sq];
}
}
Position.gridToBoard() {
board = List<String>();
board = [];
for (int i = 0; i < _grid.length; i++) {
board[indexToSquare[i]] = _grid[i];
}
}
Position.clone(Position other) {
_grid = List<String>();
_grid = [];
other._grid.forEach((piece) => _grid.add(piece));
board = List<String>();
board = [];
other.board.forEach((piece) => board.add(piece));
recorder = other.recorder;

View File

@ -526,8 +526,8 @@ class _GamePageState extends State<GamePage> 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<GamePage> 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<GamePage> 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(

View File

@ -28,8 +28,6 @@ class RuleSettingsPage extends StatefulWidget {
}
class _RuleSettingsPageState extends State<RuleSettingsPage> {
String _version = "";
@override
void initState() {
super.initState();