flutter: color_const 改名为 properties
This commit is contained in:
parent
fa428f8332
commit
3e3be7b1b3
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../board/painter_base.dart';
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
import 'board_widget.dart';
|
||||
|
||||
class BoardPainter extends PainterBase {
|
||||
|
@ -35,7 +35,7 @@ class BoardPainter extends PainterBase {
|
|||
double offsetY,
|
||||
}) {
|
||||
//
|
||||
paint.color = ColorConst.boardLineColor;
|
||||
paint.color = Properties.boardLineColor;
|
||||
paint.style = PaintingStyle.stroke;
|
||||
|
||||
const double borderLineWidth = 2.0;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
import '../game/battle.dart';
|
||||
import 'board_painter.dart';
|
||||
import 'pieces_painter.dart';
|
||||
|
@ -28,7 +28,7 @@ class BoardWidget extends StatelessWidget {
|
|||
height: height,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(boardBorderRadius),
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
),
|
||||
child: CustomPaint(
|
||||
painter: BoardPainter(width: width),
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../board/painter_base.dart';
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
import '../mill/mill.dart';
|
||||
import '../mill/position.dart';
|
||||
import 'board_widget.dart';
|
||||
|
@ -110,8 +110,8 @@ class PiecesPainter extends PainterBase {
|
|||
|
||||
// 绘制棋子边界
|
||||
paint.color = Piece.isWhite(pps.piece)
|
||||
? ColorConst.whitePieceBorderColor
|
||||
: ColorConst.blackPieceBorderColor;
|
||||
? Properties.whitePieceBorderColor
|
||||
: Properties.blackPieceBorderColor;
|
||||
|
||||
canvas.drawCircle(pps.pos, pieceRadius, paint); // 临时调试用
|
||||
|
||||
|
@ -119,8 +119,8 @@ class PiecesPainter extends PainterBase {
|
|||
|
||||
// 棋子颜色
|
||||
paint.color = Piece.isWhite(pps.piece)
|
||||
? ColorConst.whitePieceColor
|
||||
: ColorConst.blackPieceColor;
|
||||
? Properties.whitePieceColor
|
||||
: Properties.blackPieceColor;
|
||||
//paint.color = ColorConst.WhitePieceColor;
|
||||
|
||||
canvas.drawCircle(pps.pos, pieceInnerRadius, paint);
|
||||
|
@ -149,7 +149,7 @@ class PiecesPainter extends PainterBase {
|
|||
//
|
||||
final int row = focusIndex ~/ 7, column = focusIndex % 7;
|
||||
|
||||
paint.color = ColorConst.focusPositionColor;
|
||||
paint.color = Properties.focusPositionColor;
|
||||
paint.style = PaintingStyle.stroke;
|
||||
paint.strokeWidth = 2;
|
||||
|
||||
|
@ -164,7 +164,7 @@ class PiecesPainter extends PainterBase {
|
|||
//
|
||||
final row = blurIndex ~/ 7, column = blurIndex % 7;
|
||||
|
||||
paint.color = ColorConst.blurPositionColor;
|
||||
paint.color = Properties.blurPositionColor;
|
||||
paint.style = PaintingStyle.fill;
|
||||
|
||||
canvas.drawCircle(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
|
||||
class WordsOnBoard extends StatelessWidget {
|
||||
//
|
||||
|
@ -26,7 +26,7 @@ class WordsOnBoard extends StatelessWidget {
|
|||
Row(children: rChildren),
|
||||
],
|
||||
),
|
||||
style: TextStyle(color: ColorConst.boardTipsColor),
|
||||
style: TextStyle(color: Properties.boardTipsColor),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class ColorConst {
|
||||
class Properties {
|
||||
//
|
||||
static const logoColor = Color(0xFF6D000D);
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../board/board_widget.dart';
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
import '../common/toast.dart';
|
||||
import '../engine/analysis.dart';
|
||||
import '../engine/engine.dart';
|
||||
|
@ -153,7 +153,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title:
|
||||
Text('放弃对局?', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
Text('放弃对局?', style: TextStyle(color: Properties.primaryColor)),
|
||||
content: SingleChildScrollView(child: Text('你确定要放弃当前的对局吗?')),
|
||||
actions: <Widget>[
|
||||
FlatButton(child: Text('确定'), onPressed: confirm),
|
||||
|
@ -219,7 +219,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('赢了', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
title: Text('赢了', style: TextStyle(color: Properties.primaryColor)),
|
||||
content: Text('恭喜您取得了伟大的胜利!'),
|
||||
actions: <Widget>[
|
||||
FlatButton(child: Text('再来一盘'), onPressed: newGame),
|
||||
|
@ -247,7 +247,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('输了', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
title: Text('输了', style: TextStyle(color: Properties.primaryColor)),
|
||||
content: Text('勇士!坚定战斗,虽败犹荣!'),
|
||||
actions: <Widget>[
|
||||
FlatButton(child: Text('再来一盘'), onPressed: newGame),
|
||||
|
@ -269,7 +269,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text('和<EFBFBD><EFBFBD><EFBFBD>', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
title: Text('和<EFBFBD><EFBFBD><EFBFBD>', style: TextStyle(color: Properties.primaryColor)),
|
||||
content: Text('您用自己的力量捍卫了和平!'),
|
||||
actions: <Widget>[
|
||||
FlatButton(child: Text('再来一盘'), onPressed: newGame),
|
||||
|
@ -298,9 +298,9 @@ class _BattlePageState extends State<BattlePage> {
|
|||
Widget createPageHeader() {
|
||||
//
|
||||
final titleStyle =
|
||||
TextStyle(fontSize: 28, color: ColorConst.darkTextPrimaryColor);
|
||||
TextStyle(fontSize: 28, color: Properties.darkTextPrimaryColor);
|
||||
final subTitleStyle =
|
||||
TextStyle(fontSize: 16, color: ColorConst.darkTextSecondaryColor);
|
||||
TextStyle(fontSize: 16, color: Properties.darkTextSecondaryColor);
|
||||
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: SanmillApp.StatusBarHeight),
|
||||
|
@ -310,7 +310,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
children: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(Icons.arrow_back,
|
||||
color: ColorConst.darkTextPrimaryColor),
|
||||
color: Properties.darkTextPrimaryColor),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
Expanded(child: SizedBox()),
|
||||
|
@ -321,7 +321,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
Expanded(child: SizedBox()),
|
||||
IconButton(
|
||||
icon: Icon(Icons.settings,
|
||||
color: ColorConst.darkTextPrimaryColor),
|
||||
color: Properties.darkTextPrimaryColor),
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => SettingsPage()),
|
||||
),
|
||||
|
@ -333,7 +333,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
width: 180,
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
borderRadius: BorderRadius.circular(2),
|
||||
),
|
||||
),
|
||||
|
@ -363,12 +363,12 @@ class _BattlePageState extends State<BattlePage> {
|
|||
|
||||
Widget createOperatorBar() {
|
||||
//
|
||||
final buttonStyle = TextStyle(color: ColorConst.primaryColor, fontSize: 20);
|
||||
final buttonStyle = TextStyle(color: Properties.primaryColor, fontSize: 20);
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
),
|
||||
margin: EdgeInsets.symmetric(horizontal: BattlePage.screenPaddingH),
|
||||
padding: EdgeInsets.symmetric(vertical: 2),
|
||||
|
@ -410,7 +410,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
//
|
||||
final manualStyle = TextStyle(
|
||||
fontSize: 18,
|
||||
color: ColorConst.darkTextSecondaryColor,
|
||||
color: Properties.darkTextSecondaryColor,
|
||||
height: 1.5,
|
||||
);
|
||||
|
||||
|
@ -428,14 +428,14 @@ class _BattlePageState extends State<BattlePage> {
|
|||
|
||||
return Expanded(
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.expand_less, color: ColorConst.darkTextPrimaryColor),
|
||||
icon: Icon(Icons.expand_less, color: Properties.darkTextPrimaryColor),
|
||||
onPressed: () => showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title:
|
||||
Text('棋谱', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
Text('棋谱', style: TextStyle(color: Properties.primaryColor)),
|
||||
content:
|
||||
SingleChildScrollView(child: Text(text, style: manualStyle)),
|
||||
actions: <Widget>[
|
||||
|
@ -462,7 +462,7 @@ class _BattlePageState extends State<BattlePage> {
|
|||
final footer = buildFooter();
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConst.darkBackgroundColor,
|
||||
backgroundColor: Properties.darkBackgroundColor,
|
||||
body: Column(children: <Widget>[header, board, operatorBar, footer]),
|
||||
);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
|
||||
class EditPage extends StatefulWidget {
|
||||
//
|
||||
|
@ -39,7 +39,7 @@ class _EditPageState extends State<EditPage> {
|
|||
//
|
||||
final inputBorder = OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(25),
|
||||
borderSide: BorderSide(color: ColorConst.secondaryColor),
|
||||
borderSide: BorderSide(color: Properties.secondaryColor),
|
||||
);
|
||||
|
||||
return Scaffold(
|
||||
|
@ -53,7 +53,7 @@ class _EditPageState extends State<EditPage> {
|
|||
)
|
||||
],
|
||||
),
|
||||
backgroundColor: ColorConst.lightBackgroundColor,
|
||||
backgroundColor: Properties.lightBackgroundColor,
|
||||
body: Container(
|
||||
margin: EdgeInsets.all(16),
|
||||
child: Column(
|
||||
|
@ -67,7 +67,7 @@ class _EditPageState extends State<EditPage> {
|
|||
focusedBorder: inputBorder,
|
||||
),
|
||||
style: TextStyle(
|
||||
color: ColorConst.primaryColor, fontSize: 16, fontFamily: ''),
|
||||
color: Properties.primaryColor, fontSize: 16, fontFamily: ''),
|
||||
onSubmitted: (input) => onSubmit(input),
|
||||
focusNode: _commentFocus,
|
||||
),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../common/color.dart';
|
||||
import '../common/properties.dart';
|
||||
import '../engine/engine.dart';
|
||||
import '../main.dart';
|
||||
import 'battle_page.dart';
|
||||
|
@ -89,7 +89,7 @@ class _MainMenuState extends State<MainMenu> with TickerProviderStateMixin {
|
|||
);
|
||||
final menuItemStyle = TextStyle(
|
||||
fontSize: 28,
|
||||
color: ColorConst.primaryColor,
|
||||
color: Properties.primaryColor,
|
||||
shadows: [menuItemShadow],
|
||||
);
|
||||
|
||||
|
@ -115,7 +115,7 @@ class _MainMenuState extends State<MainMenu> with TickerProviderStateMixin {
|
|||
);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConst.lightBackgroundColor,
|
||||
backgroundColor: Properties.lightBackgroundColor,
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
menuItems,
|
||||
|
@ -123,7 +123,7 @@ class _MainMenuState extends State<MainMenu> with TickerProviderStateMixin {
|
|||
top: SanmillApp.StatusBarHeight,
|
||||
left: 10,
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.settings, color: ColorConst.primaryColor),
|
||||
icon: Icon(Icons.settings, color: Properties.primaryColor),
|
||||
onPressed: () => Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => SettingsPage()),
|
||||
),
|
||||
|
|
|
@ -2,8 +2,8 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
|
||||
import '../common/color.dart';
|
||||
import '../common/config.dart';
|
||||
import '../common/properties.dart';
|
||||
import '../common/toast.dart';
|
||||
import '../services/audios.dart';
|
||||
import '../services/player.dart';
|
||||
|
@ -52,7 +52,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
children: <Widget>[
|
||||
SizedBox(height: 10),
|
||||
RadioListTile(
|
||||
activeColor: ColorConst.primaryColor,
|
||||
activeColor: Properties.primaryColor,
|
||||
title: Text('初级'),
|
||||
groupValue: Config.stepTime,
|
||||
value: 5000,
|
||||
|
@ -60,7 +60,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
),
|
||||
Divider(),
|
||||
RadioListTile(
|
||||
activeColor: ColorConst.primaryColor,
|
||||
activeColor: Properties.primaryColor,
|
||||
title: Text('中级'),
|
||||
groupValue: Config.stepTime,
|
||||
value: 15000,
|
||||
|
@ -68,7 +68,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
),
|
||||
Divider(),
|
||||
RadioListTile(
|
||||
activeColor: ColorConst.primaryColor,
|
||||
activeColor: Properties.primaryColor,
|
||||
title: Text('高级'),
|
||||
groupValue: Config.stepTime,
|
||||
value: 30000,
|
||||
|
@ -132,7 +132,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
barrierDismissible: false,
|
||||
builder: (context) => AlertDialog(
|
||||
title:
|
||||
Text('关于「直棋 」', style: TextStyle(color: ColorConst.primaryColor)),
|
||||
Text('关于「直棋 」', style: TextStyle(color: Properties.primaryColor)),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
|
@ -168,11 +168,11 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
Widget build(BuildContext context) {
|
||||
//
|
||||
final TextStyle headerStyle =
|
||||
TextStyle(color: ColorConst.secondaryColor, fontSize: 20.0);
|
||||
final TextStyle itemStyle = TextStyle(color: ColorConst.primaryColor);
|
||||
TextStyle(color: Properties.secondaryColor, fontSize: 20.0);
|
||||
final TextStyle itemStyle = TextStyle(color: Properties.primaryColor);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: ColorConst.lightBackgroundColor,
|
||||
backgroundColor: Properties.lightBackgroundColor,
|
||||
appBar: AppBar(title: Text('设置')),
|
||||
body: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
|
@ -183,7 +183,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
Text("人机难度", style: headerStyle),
|
||||
const SizedBox(height: 10.0),
|
||||
Card(
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
elevation: 0.5,
|
||||
margin: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 0),
|
||||
child: Column(
|
||||
|
@ -196,7 +196,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
? '初级'
|
||||
: Config.stepTime <= 15000 ? '中级' : '高级'),
|
||||
Icon(Icons.keyboard_arrow_right,
|
||||
color: ColorConst.secondaryColor),
|
||||
color: Properties.secondaryColor),
|
||||
]),
|
||||
onTap: changeDifficult,
|
||||
),
|
||||
|
@ -206,19 +206,19 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
const SizedBox(height: 16),
|
||||
Text("声音", style: headerStyle),
|
||||
Card(
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SwitchListTile(
|
||||
activeColor: ColorConst.primaryColor,
|
||||
activeColor: Properties.primaryColor,
|
||||
value: Config.bgmEnabled,
|
||||
title: Text("背景音乐", style: itemStyle),
|
||||
onChanged: switchMusic,
|
||||
),
|
||||
_buildDivider(),
|
||||
SwitchListTile(
|
||||
activeColor: ColorConst.primaryColor,
|
||||
activeColor: Properties.primaryColor,
|
||||
value: Config.toneEnabled,
|
||||
title: Text("提示音效", style: itemStyle),
|
||||
onChanged: switchTone,
|
||||
|
@ -229,7 +229,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
const SizedBox(height: 16),
|
||||
Text("排行榜", style: headerStyle),
|
||||
Card(
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -239,7 +239,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Text(Player.shared.name),
|
||||
Icon(Icons.keyboard_arrow_right,
|
||||
color: ColorConst.secondaryColor),
|
||||
color: Properties.secondaryColor),
|
||||
]),
|
||||
onTap: changeName,
|
||||
),
|
||||
|
@ -249,7 +249,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
const SizedBox(height: 16),
|
||||
Text("关于", style: headerStyle),
|
||||
Card(
|
||||
color: ColorConst.boardBackgroundColor,
|
||||
color: Properties.boardBackgroundColor,
|
||||
margin: const EdgeInsets.symmetric(vertical: 10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -259,7 +259,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
||||
Text(_version ?? ''),
|
||||
Icon(Icons.keyboard_arrow_right,
|
||||
color: ColorConst.secondaryColor),
|
||||
color: Properties.secondaryColor),
|
||||
]),
|
||||
onTap: showAbout,
|
||||
),
|
||||
|
@ -278,7 +278,7 @@ class _SettingsPageState extends State<SettingsPage> {
|
|||
margin: const EdgeInsets.symmetric(horizontal: 16),
|
||||
width: double.infinity,
|
||||
height: 1.0,
|
||||
color: ColorConst.lightLineColor,
|
||||
color: Properties.lightLineColor,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue