From 8479487295cc1b7781940541b50487d2c0e9fc55 Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sat, 7 Nov 2020 00:46:39 +0800 Subject: [PATCH] flutter: refactor class ColorConst --- src/ui/flutter/lib/board/board-painter.dart | 7 +-- src/ui/flutter/lib/board/board-widget.dart | 24 ++++++----- src/ui/flutter/lib/board/painter-base.dart | 5 ++- src/ui/flutter/lib/board/pieces-painter.dart | 21 ++++----- src/ui/flutter/lib/board/words-on-board.dart | 3 +- src/ui/flutter/lib/common/color-consts.dart | 38 ++++++++--------- src/ui/flutter/lib/routes/battle-page.dart | 45 +++++++++++--------- src/ui/flutter/lib/routes/edit-page.dart | 14 +++--- src/ui/flutter/lib/routes/main-menu.dart | 9 ++-- src/ui/flutter/lib/routes/settings-page.dart | 40 ++++++++--------- 10 files changed, 112 insertions(+), 94 deletions(-) diff --git a/src/ui/flutter/lib/board/board-painter.dart b/src/ui/flutter/lib/board/board-painter.dart index 45792963..bd31e42d 100644 --- a/src/ui/flutter/lib/board/board-painter.dart +++ b/src/ui/flutter/lib/board/board-painter.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../board/painter-base.dart'; import '../common/color-consts.dart'; import 'board-widget.dart'; @@ -15,8 +16,8 @@ class BoardPainter extends PainterBase { thePaint, gridWidth, squareSide, - offsetX: BoardWidget.Padding + squareSide / 2, - offsetY: BoardWidget.Padding + BoardWidget.DigitsHeight + squareSide / 2, + offsetX: BoardWidget.padding + squareSide / 2, + offsetY: BoardWidget.padding + BoardWidget.digitsHeight + squareSide / 2, ); } @@ -34,7 +35,7 @@ class BoardPainter extends PainterBase { double offsetY, }) { // - paint.color = ColorConsts.BoardLine; + paint.color = ColorConst.boardLineColor; paint.style = PaintingStyle.stroke; var left = offsetX; diff --git a/src/ui/flutter/lib/board/board-widget.dart b/src/ui/flutter/lib/board/board-widget.dart index 68dbdd35..69eab592 100644 --- a/src/ui/flutter/lib/board/board-widget.dart +++ b/src/ui/flutter/lib/board/board-widget.dart @@ -1,15 +1,18 @@ -import '../game/battle.dart'; import 'package:flutter/material.dart'; + import '../common/color-consts.dart'; +import '../game/battle.dart'; import 'board-painter.dart'; import 'pieces-painter.dart'; import 'words-on-board.dart'; class BoardWidget extends StatelessWidget { // - static const Padding = 5.0, DigitsHeight = 0.0; + static const padding = 5.0; + static const digitsHeight = 0.0; - final double width, height; + final double width; + final double height; final Function(BuildContext, int) onBoardTap; BoardWidget({@required this.width, @required this.onBoardTap}) @@ -23,7 +26,7 @@ class BoardWidget extends StatelessWidget { height: height, decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, ), child: CustomPaint( painter: BoardPainter(width: width), @@ -35,9 +38,9 @@ class BoardWidget extends StatelessWidget { ), child: Container( margin: EdgeInsets.symmetric( - vertical: Padding, - horizontal: (width - Padding * 2) / 7 / 2 + - Padding - + vertical: padding, + horizontal: (width - padding * 2) / 7 / 2 + + padding - WordsOnBoard.DigitsFontSize / 2, ), //child: WordsOnBoard(), @@ -49,14 +52,15 @@ class BoardWidget extends StatelessWidget { child: boardContainer, onTapUp: (d) { // - final gridWidth = (width - Padding * 2) * 6 / 7; + final gridWidth = (width - padding * 2) * 6 / 7; final squareSide = gridWidth / 8; final dx = d.localPosition.dx, dy = d.localPosition.dy; - final row = (dy - Padding - DigitsHeight) ~/ squareSide; - final column = (dx - Padding) ~/ squareSide; + final row = (dy - padding - digitsHeight) ~/ squareSide; + final column = (dx - padding) ~/ squareSide; if (row < 0 || row > 6) return; + if (column < 0 || column > 6) return; onBoardTap(context, row * 7 + column); diff --git a/src/ui/flutter/lib/board/painter-base.dart b/src/ui/flutter/lib/board/painter-base.dart index cd9910dc..0e74eef6 100644 --- a/src/ui/flutter/lib/board/painter-base.dart +++ b/src/ui/flutter/lib/board/painter-base.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import 'board-widget.dart'; abstract class PainterBase extends CustomPainter { @@ -9,6 +10,6 @@ abstract class PainterBase extends CustomPainter { final gridWidth, squareSide; PainterBase({@required this.width}) - : gridWidth = (width - BoardWidget.Padding * 2) , - squareSide = (width - BoardWidget.Padding * 2) / 7; + : gridWidth = (width - BoardWidget.padding * 2), + squareSide = (width - BoardWidget.padding * 2) / 7; } diff --git a/src/ui/flutter/lib/board/pieces-painter.dart b/src/ui/flutter/lib/board/pieces-painter.dart index 124a62ff..d26f5fce 100644 --- a/src/ui/flutter/lib/board/pieces-painter.dart +++ b/src/ui/flutter/lib/board/pieces-painter.dart @@ -1,7 +1,8 @@ import 'package:flutter/material.dart'; -import '../mill/mill-base.dart'; -import '../common/color-consts.dart'; + import '../board/painter-base.dart'; +import '../common/color-consts.dart'; +import '../mill/mill-base.dart'; import '../mill/position.dart'; import 'board-widget.dart'; @@ -39,8 +40,8 @@ class PiecesPainter extends PainterBase { squareSide: squareSide, pieceSide: pieceSide, // 棋子放在线上中央 - offsetX: BoardWidget.Padding + squareSide / 2, - offsetY: BoardWidget.Padding + BoardWidget.DigitsHeight + squareSide / 2, + offsetX: BoardWidget.padding + squareSide / 2, + offsetY: BoardWidget.padding + BoardWidget.digitsHeight + squareSide / 2, focusIndex: focusIndex, blurIndex: blurIndex, ); @@ -106,15 +107,15 @@ class PiecesPainter extends PainterBase { piecesToDraw.forEach((pps) { // paint.color = Piece.isWhite(pps.piece) - ? ColorConsts.WhitePieceBorderColor - : ColorConsts.BlackPieceBorderColor; + ? ColorConst.whitePieceBorderColor + : ColorConst.blackPieceBorderColor; canvas.drawCircle(pps.pos, pieceSide / 2, paint); // 临时调试用 // 棋子颜色 paint.color = Piece.isWhite(pps.piece) - ? ColorConsts.WhitePieceColor - : ColorConsts.BlackPieceColor; + ? ColorConst.whitePieceColor + : ColorConst.blackPieceColor; //paint.color = ColorConsts.WhitePieceColor; canvas.drawCircle(pps.pos, pieceSide * 0.8 / 2, paint); // 决定棋子外圈有宽 @@ -143,7 +144,7 @@ class PiecesPainter extends PainterBase { // final int row = focusIndex ~/ 7, column = focusIndex % 7; - paint.color = ColorConsts.FocusPosition; + paint.color = ColorConst.focusPositionColor; paint.style = PaintingStyle.stroke; paint.strokeWidth = 2; @@ -158,7 +159,7 @@ class PiecesPainter extends PainterBase { // final row = blurIndex ~/ 7, column = blurIndex % 7; - paint.color = ColorConsts.BlurPosition; + paint.color = ColorConst.blurPositionColor; paint.style = PaintingStyle.fill; canvas.drawCircle( diff --git a/src/ui/flutter/lib/board/words-on-board.dart b/src/ui/flutter/lib/board/words-on-board.dart index 3f34d214..7f58ce28 100644 --- a/src/ui/flutter/lib/board/words-on-board.dart +++ b/src/ui/flutter/lib/board/words-on-board.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../common/color-consts.dart'; class WordsOnBoard extends StatelessWidget { @@ -25,7 +26,7 @@ class WordsOnBoard extends StatelessWidget { Row(children: rChildren), ], ), - style: TextStyle(color: ColorConsts.BoardTips), + style: TextStyle(color: ColorConst.boardTipsColor), ); } } diff --git a/src/ui/flutter/lib/common/color-consts.dart b/src/ui/flutter/lib/common/color-consts.dart index bf8d3713..0ee37d0d 100644 --- a/src/ui/flutter/lib/common/color-consts.dart +++ b/src/ui/flutter/lib/common/color-consts.dart @@ -1,33 +1,33 @@ import 'package:flutter/material.dart'; -class ColorConsts { +class ColorConst { // - static const LogoColor = Color(0xFF6D000D); + static const logoColor = Color(0xFF6D000D); - static const Primary = Color(0xFF461220); - static const Secondary = Color(0x99461220); + static const primaryColor = Color(0xFF461220); + static const secondaryColor = Color(0x99461220); - static const DarkBackground = Colors.brown; - static const LightBackground = Color(0xFFEEE0CB); + static const darkBackgroundColor = Colors.brown; + static const lightBackgroundColor = Color(0xFFEEE0CB); - static const BoardBackground = Color(0xFFEBC38D); + static const boardBackgroundColor = Color(0xFFEBC38D); - static const DarkTextPrimary = Colors.white; - static const DarkTextSecondary = Color(0x99FFFFFF); + static const darkTextPrimaryColor = Colors.white; + static const darkTextSecondaryColor = Color(0x99FFFFFF); - static const BoardLine = Color(0x996D000D); - static const BoardTips = Color(0x666D000D); + static const boardLineColor = Color(0x996D000D); + static const boardTipsColor = Color(0x666D000D); - static const LightLine = Color(0x336D000D); + static const lightLineColor = Color(0x336D000D); - static const FocusPosition = Color(0x99FFFFFF); - static const BlurPosition = Color(0x99FFFFFF); + static const focusPositionColor = Color(0x99FFFFFF); + static const blurPositionColor = Color(0x99FFFFFF); - static const BlackPieceColor = Color.fromARGB(0xFF, 0x00, 0x00, 0x00); - static const BlackPieceBorderColor = Color.fromARGB(0xFF, 0x22, 0x22, 0x22); + static const blackPieceColor = Color.fromARGB(0xFF, 0x00, 0x00, 0x00); + static const blackPieceBorderColor = Color.fromARGB(0xFF, 0x22, 0x22, 0x22); - static const WhitePieceColor = Color.fromARGB(0xFF, 0xFF, 0xFF, 0xFF); - static const WhitePieceBorderColor = Color.fromARGB(0xFF, 0x66, 0x00, 0x00); + static const whitePieceColor = Color.fromARGB(0xFF, 0xFF, 0xFF, 0xFF); + static const whitePieceBorderColor = Color.fromARGB(0xFF, 0x66, 0x00, 0x00); - static const PieceTextColor = Color.fromARGB(0xCC, 0xFF, 0xFF, 0xFF); + static const pieceTextColor = Color.fromARGB(0xCC, 0xFF, 0xFF, 0xFF); } diff --git a/src/ui/flutter/lib/routes/battle-page.dart b/src/ui/flutter/lib/routes/battle-page.dart index ded0730a..f862b455 100644 --- a/src/ui/flutter/lib/routes/battle-page.dart +++ b/src/ui/flutter/lib/routes/battle-page.dart @@ -1,15 +1,15 @@ -import '../mill/mill-base.dart'; +import 'package:flutter/material.dart'; + +import '../board/board-widget.dart'; import '../common/color-consts.dart'; import '../common/toast.dart'; import '../engine/analysis.dart'; import '../engine/engine.dart'; import '../engine/native-engine.dart'; -//import '../services/audios.dart'; -import '../services/player.dart'; -import 'package:flutter/material.dart'; import '../game/battle.dart'; -import '../board/board-widget.dart'; import '../main.dart'; +import '../mill/mill-base.dart'; +import '../services/player.dart'; import 'settings-page.dart'; class BattlePage extends StatefulWidget { @@ -140,7 +140,8 @@ class _BattlePageState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - title: Text('放弃对局?', style: TextStyle(color: ColorConsts.Primary)), + title: + Text('放弃对局?', style: TextStyle(color: ColorConst.primaryColor)), content: SingleChildScrollView(child: Text('你确定要放弃当前的对局吗?')), actions: [ FlatButton(child: Text('确定'), onPressed: confirm), @@ -206,7 +207,7 @@ class _BattlePageState extends State { barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( - title: Text('赢了', style: TextStyle(color: ColorConsts.Primary)), + title: Text('赢了', style: TextStyle(color: ColorConst.primaryColor)), content: Text('恭喜您取得了伟大的胜利!'), actions: [ FlatButton(child: Text('再来一盘'), onPressed: newGame), @@ -234,7 +235,7 @@ class _BattlePageState extends State { barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( - title: Text('输了', style: TextStyle(color: ColorConsts.Primary)), + title: Text('输了', style: TextStyle(color: ColorConst.primaryColor)), content: Text('勇士!坚定战斗,虽败犹荣!'), actions: [ FlatButton(child: Text('再来一盘'), onPressed: newGame), @@ -256,7 +257,7 @@ class _BattlePageState extends State { barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( - title: Text('和���', style: TextStyle(color: ColorConsts.Primary)), + title: Text('和���', style: TextStyle(color: ColorConst.primaryColor)), content: Text('您用自己的力量捍卫了和平!'), actions: [ FlatButton(child: Text('再来一盘'), onPressed: newGame), @@ -285,9 +286,9 @@ class _BattlePageState extends State { Widget createPageHeader() { // final titleStyle = - TextStyle(fontSize: 28, color: ColorConsts.DarkTextPrimary); + TextStyle(fontSize: 28, color: ColorConst.darkTextPrimaryColor); final subTitleStyle = - TextStyle(fontSize: 16, color: ColorConsts.DarkTextSecondary); + TextStyle(fontSize: 16, color: ColorConst.darkTextSecondaryColor); return Container( margin: EdgeInsets.only(top: SanmillApp.StatusBarHeight), @@ -296,8 +297,8 @@ class _BattlePageState extends State { Row( children: [ IconButton( - icon: - Icon(Icons.arrow_back, color: ColorConsts.DarkTextPrimary), + icon: Icon(Icons.arrow_back, + color: ColorConst.darkTextPrimaryColor), onPressed: () => Navigator.of(context).pop(), ), Expanded(child: SizedBox()), @@ -307,7 +308,8 @@ class _BattlePageState extends State { style: titleStyle), Expanded(child: SizedBox()), IconButton( - icon: Icon(Icons.settings, color: ColorConsts.DarkTextPrimary), + icon: Icon(Icons.settings, + color: ColorConst.darkTextPrimaryColor), onPressed: () => Navigator.of(context).push( MaterialPageRoute(builder: (context) => SettingsPage()), ), @@ -319,7 +321,7 @@ class _BattlePageState extends State { width: 180, margin: EdgeInsets.only(bottom: 10), decoration: BoxDecoration( - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, borderRadius: BorderRadius.circular(2), ), ), @@ -349,12 +351,12 @@ class _BattlePageState extends State { Widget createOperatorBar() { // - final buttonStyle = TextStyle(color: ColorConsts.Primary, fontSize: 20); + final buttonStyle = TextStyle(color: ColorConst.primaryColor, fontSize: 20); return Container( decoration: BoxDecoration( borderRadius: BorderRadius.circular(5), - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, ), margin: EdgeInsets.symmetric(horizontal: BattlePage.screenPaddingH), padding: EdgeInsets.symmetric(vertical: 2), @@ -396,7 +398,7 @@ class _BattlePageState extends State { // final manualStyle = TextStyle( fontSize: 18, - color: ColorConsts.DarkTextSecondary, + color: ColorConst.darkTextSecondaryColor, height: 1.5, ); @@ -414,13 +416,14 @@ class _BattlePageState extends State { return Expanded( child: IconButton( - icon: Icon(Icons.expand_less, color: ColorConsts.DarkTextPrimary), + icon: Icon(Icons.expand_less, color: ColorConst.darkTextPrimaryColor), onPressed: () => showDialog( context: context, barrierDismissible: false, builder: (BuildContext context) { return AlertDialog( - title: Text('棋谱', style: TextStyle(color: ColorConsts.Primary)), + title: + Text('棋谱', style: TextStyle(color: ColorConst.primaryColor)), content: SingleChildScrollView(child: Text(text, style: manualStyle)), actions: [ @@ -447,7 +450,7 @@ class _BattlePageState extends State { final footer = buildFooter(); return Scaffold( - backgroundColor: ColorConsts.DarkBackground, + backgroundColor: ColorConst.darkBackgroundColor, body: Column(children: [header, board, operatorBar, footer]), ); } diff --git a/src/ui/flutter/lib/routes/edit-page.dart b/src/ui/flutter/lib/routes/edit-page.dart index 7c032b9c..8c96f022 100644 --- a/src/ui/flutter/lib/routes/edit-page.dart +++ b/src/ui/flutter/lib/routes/edit-page.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; + import '../common/color-consts.dart'; class EditPage extends StatefulWidget { @@ -38,7 +39,7 @@ class _EditPageState extends State { // final inputBorder = OutlineInputBorder( borderRadius: BorderRadius.circular(25), - borderSide: BorderSide(color: ColorConsts.Secondary), + borderSide: BorderSide(color: ColorConst.secondaryColor), ); return Scaffold( @@ -46,12 +47,13 @@ class _EditPageState extends State { title: Text(widget.title, style: TextStyle(fontFamily: '')), actions: [ FlatButton( - child: Text('确定', style: TextStyle(fontFamily: '', color: Colors.white)), + child: Text('确定', + style: TextStyle(fontFamily: '', color: Colors.white)), onPressed: () => onSubmit(_textController.text), ) ], ), - backgroundColor: ColorConsts.LightBackground, + backgroundColor: ColorConst.lightBackgroundColor, body: Container( margin: EdgeInsets.all(16), child: Column( @@ -59,11 +61,13 @@ class _EditPageState extends State { TextField( controller: _textController, decoration: InputDecoration( - contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 16), + contentPadding: + EdgeInsets.symmetric(vertical: 0, horizontal: 16), enabledBorder: inputBorder, focusedBorder: inputBorder, ), - style: TextStyle(color: ColorConsts.Primary, fontSize: 16, fontFamily: ''), + style: TextStyle( + color: ColorConst.primaryColor, fontSize: 16, fontFamily: ''), onSubmitted: (input) => onSubmit(input), focusNode: _commentFocus, ), diff --git a/src/ui/flutter/lib/routes/main-menu.dart b/src/ui/flutter/lib/routes/main-menu.dart index 9ec4a3f2..39da43c1 100644 --- a/src/ui/flutter/lib/routes/main-menu.dart +++ b/src/ui/flutter/lib/routes/main-menu.dart @@ -1,6 +1,7 @@ -import '../engine/engine.dart'; import 'package:flutter/material.dart'; + import '../common/color-consts.dart'; +import '../engine/engine.dart'; import '../main.dart'; import 'battle-page.dart'; import 'settings-page.dart'; @@ -88,7 +89,7 @@ class _MainMenuState extends State with TickerProviderStateMixin { ); final menuItemStyle = TextStyle( fontSize: 28, - color: ColorConsts.Primary, + color: ColorConst.primaryColor, shadows: [menuItemShadow], ); @@ -114,7 +115,7 @@ class _MainMenuState extends State with TickerProviderStateMixin { ); return Scaffold( - backgroundColor: ColorConsts.LightBackground, + backgroundColor: ColorConst.lightBackgroundColor, body: Stack( children: [ menuItems, @@ -122,7 +123,7 @@ class _MainMenuState extends State with TickerProviderStateMixin { top: SanmillApp.StatusBarHeight, left: 10, child: IconButton( - icon: Icon(Icons.settings, color: ColorConsts.Primary), + icon: Icon(Icons.settings, color: ColorConst.primaryColor), onPressed: () => Navigator.of(context).push( MaterialPageRoute(builder: (context) => SettingsPage()), ), diff --git a/src/ui/flutter/lib/routes/settings-page.dart b/src/ui/flutter/lib/routes/settings-page.dart index c25fc502..619b5ede 100644 --- a/src/ui/flutter/lib/routes/settings-page.dart +++ b/src/ui/flutter/lib/routes/settings-page.dart @@ -1,11 +1,12 @@ -import '../services/player.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:package_info/package_info.dart'; -import '../common/toast.dart'; + import '../common/color-consts.dart'; import '../common/config.dart'; +import '../common/toast.dart'; import '../services/audios.dart'; +import '../services/player.dart'; import 'edit-page.dart'; class SettingsPage extends StatefulWidget { @@ -51,7 +52,7 @@ class _SettingsPageState extends State { children: [ SizedBox(height: 10), RadioListTile( - activeColor: ColorConsts.Primary, + activeColor: ColorConst.primaryColor, title: Text('初级'), groupValue: Config.stepTime, value: 5000, @@ -59,7 +60,7 @@ class _SettingsPageState extends State { ), Divider(), RadioListTile( - activeColor: ColorConsts.Primary, + activeColor: ColorConst.primaryColor, title: Text('中级'), groupValue: Config.stepTime, value: 15000, @@ -67,7 +68,7 @@ class _SettingsPageState extends State { ), Divider(), RadioListTile( - activeColor: ColorConsts.Primary, + activeColor: ColorConst.primaryColor, title: Text('高级'), groupValue: Config.stepTime, value: 30000, @@ -130,7 +131,8 @@ class _SettingsPageState extends State { context: context, barrierDismissible: false, builder: (context) => AlertDialog( - title: Text('关于「直棋 」', style: TextStyle(color: ColorConsts.Primary)), + title: + Text('关于「直棋 」', style: TextStyle(color: ColorConst.primaryColor)), content: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, @@ -166,11 +168,11 @@ class _SettingsPageState extends State { Widget build(BuildContext context) { // final TextStyle headerStyle = - TextStyle(color: ColorConsts.Secondary, fontSize: 20.0); - final TextStyle itemStyle = TextStyle(color: ColorConsts.Primary); + TextStyle(color: ColorConst.secondaryColor, fontSize: 20.0); + final TextStyle itemStyle = TextStyle(color: ColorConst.primaryColor); return Scaffold( - backgroundColor: ColorConsts.LightBackground, + backgroundColor: ColorConst.lightBackgroundColor, appBar: AppBar(title: Text('设置')), body: SingleChildScrollView( padding: const EdgeInsets.all(16), @@ -181,7 +183,7 @@ class _SettingsPageState extends State { Text("人机难度", style: headerStyle), const SizedBox(height: 10.0), Card( - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, elevation: 0.5, margin: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 0), child: Column( @@ -194,7 +196,7 @@ class _SettingsPageState extends State { ? '初级' : Config.stepTime <= 15000 ? '中级' : '高级'), Icon(Icons.keyboard_arrow_right, - color: ColorConsts.Secondary), + color: ColorConst.secondaryColor), ]), onTap: changeDifficult, ), @@ -204,19 +206,19 @@ class _SettingsPageState extends State { const SizedBox(height: 16), Text("声音", style: headerStyle), Card( - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, margin: const EdgeInsets.symmetric(vertical: 10), child: Column( children: [ SwitchListTile( - activeColor: ColorConsts.Primary, + activeColor: ColorConst.primaryColor, value: Config.bgmEnabled, title: Text("背景音乐", style: itemStyle), onChanged: switchMusic, ), _buildDivider(), SwitchListTile( - activeColor: ColorConsts.Primary, + activeColor: ColorConst.primaryColor, value: Config.toneEnabled, title: Text("提示音效", style: itemStyle), onChanged: switchTone, @@ -227,7 +229,7 @@ class _SettingsPageState extends State { const SizedBox(height: 16), Text("排行榜", style: headerStyle), Card( - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, margin: const EdgeInsets.symmetric(vertical: 10), child: Column( children: [ @@ -237,7 +239,7 @@ class _SettingsPageState extends State { Row(mainAxisSize: MainAxisSize.min, children: [ Text(Player.shared.name), Icon(Icons.keyboard_arrow_right, - color: ColorConsts.Secondary), + color: ColorConst.secondaryColor), ]), onTap: changeName, ), @@ -247,7 +249,7 @@ class _SettingsPageState extends State { const SizedBox(height: 16), Text("关于", style: headerStyle), Card( - color: ColorConsts.BoardBackground, + color: ColorConst.boardBackgroundColor, margin: const EdgeInsets.symmetric(vertical: 10), child: Column( children: [ @@ -257,7 +259,7 @@ class _SettingsPageState extends State { Row(mainAxisSize: MainAxisSize.min, children: [ Text(_version ?? ''), Icon(Icons.keyboard_arrow_right, - color: ColorConsts.Secondary), + color: ColorConst.secondaryColor), ]), onTap: showAbout, ), @@ -276,7 +278,7 @@ class _SettingsPageState extends State { margin: const EdgeInsets.symmetric(horizontal: 16), width: double.infinity, height: 1.0, - color: ColorConsts.LightLine, + color: ColorConst.lightLineColor, ); } }