From cb099d303539d9c64329964675ea7079fbab0c4b Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 1 May 2021 21:20:00 +0800 Subject: [PATCH] flutter: Clean up --- src/ui/flutter_app/lib/services/audios.dart | 6 ------ src/ui/flutter_app/lib/widgets/game_page.dart | 6 +----- src/ui/flutter_app/lib/widgets/game_settings_page.dart | 6 ------ src/ui/flutter_app/lib/widgets/home_drawer.dart | 6 ++++-- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/ui/flutter_app/lib/services/audios.dart b/src/ui/flutter_app/lib/services/audios.dart index 1f3e375e..796ac517 100644 --- a/src/ui/flutter_app/lib/services/audios.dart +++ b/src/ui/flutter_app/lib/services/audios.dart @@ -67,12 +67,6 @@ class Audios { _alarmSoundStreamId = await _soundpool!.play(await soundId); } - static Future _pauseSound() async { - if (_alarmSoundStreamId != null && _alarmSoundStreamId! > 0) { - await _soundpool!.pause(_alarmSoundStreamId!); - } - } - static Future _stopSound() async { if (_alarmSoundStreamId != null && _alarmSoundStreamId! > 0) { await _soundpool!.stop(_alarmSoundStreamId!); diff --git a/src/ui/flutter_app/lib/widgets/game_page.dart b/src/ui/flutter_app/lib/widgets/game_page.dart index 2053de16..a8efd74d 100644 --- a/src/ui/flutter_app/lib/widgets/game_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_page.dart @@ -49,9 +49,7 @@ class GamePage extends StatefulWidget { } class _GamePageState extends State with RouteAware { - // TODO: null-safety String? _status = ''; - //bool _searching = false; bool isReady = false; late Timer timer; @@ -135,7 +133,6 @@ class _GamePageState extends State with RouteAware { int? sq = indexToSquare[index]; if (sq == null) { - //print("putPiece skip index: $index"); return; } @@ -243,7 +240,7 @@ class _GamePageState extends State with RouteAware { // TODO: Need Others? // Increment ply counters. In particular, // rule50 will be reset to zero later on - // in case of a capture. + // in case of a remove. ++position.gamePly; ++position.st.rule50; ++position.st.pliesFromNull; @@ -321,7 +318,6 @@ class _GamePageState extends State with RouteAware { Move mv = response.value; final Move move = new Move(mv.move); - //Battle.instance.move = move; Game.instance.doMove(move.move); showTips(); break; diff --git a/src/ui/flutter_app/lib/widgets/game_settings_page.dart b/src/ui/flutter_app/lib/widgets/game_settings_page.dart index f29e4780..3a4f42de 100644 --- a/src/ui/flutter_app/lib/widgets/game_settings_page.dart +++ b/src/ui/flutter_app/lib/widgets/game_settings_page.dart @@ -65,12 +65,6 @@ class _GameSettingsPageState extends State { }); } - void _incrementCounter() { - setState(() { - _counter++; - }); - } - void _restore() async { final profile = await Settings.instance(); await profile.restore(); diff --git a/src/ui/flutter_app/lib/widgets/home_drawer.dart b/src/ui/flutter_app/lib/widgets/home_drawer.dart index c19ebc48..231769cf 100644 --- a/src/ui/flutter_app/lib/widgets/home_drawer.dart +++ b/src/ui/flutter_app/lib/widgets/home_drawer.dart @@ -20,8 +20,6 @@ import 'dart:async'; import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; -import 'package:sanmill/common/config.dart'; import 'package:sanmill/generated/l10n.dart'; import 'package:sanmill/style/app_theme.dart'; import 'package:sanmill/widgets/game_settings_page.dart'; @@ -180,6 +178,7 @@ class _HomeDrawerState extends State { ), ); + /* var exitListTile = ListTile( title: Text( S.of(context).exit, @@ -202,13 +201,16 @@ class _HomeDrawerState extends State { await SystemChannels.platform.invokeMethod('SystemNavigator.pop'); }, ); + */ + /* var drawFooter = Column( children: [ exitListTile, SizedBox(height: MediaQuery.of(context).padding.bottom) ], ); + */ var scaffold = Scaffold( backgroundColor: AppTheme.drawerBackgroundColor,