flutter: theme: Add settingsHeaderStyle and switchListTileTitleStyle

This commit is contained in:
Calcitem 2021-03-28 12:18:05 +08:00
parent c565c214d0
commit a442c5fe1d
4 changed files with 75 additions and 56 deletions

View File

@ -100,5 +100,10 @@ class AppTheme {
static const cardMargin =
const EdgeInsets.symmetric(vertical: 4.0, horizontal: 0);
static const settingsHeaderStyle =
TextStyle(color: UIColors.crusoeColor, fontSize: 20.0);
static const switchListTileActiveColor = UIColors.primaryColor;
static const switchListTileTitleStyle =
TextStyle(color: UIColors.crusoeColor);
}

View File

@ -69,7 +69,8 @@ class _AboutPageState extends State<AboutPage> {
child: Column(
children: <Widget>[
ListTile(
title: Text(S.of(context).versionInfo, style: itemStyle),
title: Text(S.of(context).versionInfo,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text("Sanmill " + "$_version" + " " + mode,
style: TextStyle(color: UIColors.secondaryColor)),
onTap: _showVersionInfo,
@ -78,20 +79,22 @@ class _AboutPageState extends State<AboutPage> {
/*
ListTile(
title:
Text(S.of(context).viewInGooglePlayStore, style: itemStyle),
Text(S.of(context).viewInGooglePlayStore, style: AppTheme.switchListTileTitleStyle),
onTap: () => _launchURL(
'https://play.google.com/store/apps/details?id=com.calcitem.sanmill'),
),
ListItemDivider(),
*/
ListTile(
title: Text(S.of(context).feedback, style: itemStyle),
title: Text(S.of(context).feedback,
style: AppTheme.switchListTileTitleStyle),
onTap: () =>
_launchURL('https://github.com/calcitem/Sanmill/issues'),
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).license, style: itemStyle),
title: Text(S.of(context).license,
style: AppTheme.switchListTileTitleStyle),
onTap: () {
Navigator.push(
context,
@ -102,24 +105,28 @@ class _AboutPageState extends State<AboutPage> {
}),
ListItemDivider(),
ListTile(
title: Text(S.of(context).sourceCode, style: itemStyle),
title: Text(S.of(context).sourceCode,
style: AppTheme.switchListTileTitleStyle),
onTap: () => _launchURL('https://github.com/calcitem/Sanmill'),
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).privacyPolicy, style: itemStyle),
title: Text(S.of(context).privacyPolicy,
style: AppTheme.switchListTileTitleStyle),
onTap: () => _launchURL(
'https://github.com/calcitem/Sanmill/wiki/privacy_policy'),
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).thirdPartyNotices, style: itemStyle),
title: Text(S.of(context).thirdPartyNotices,
style: AppTheme.switchListTileTitleStyle),
onTap: () => _launchURL(
'https://github.com/calcitem/Sanmill/wiki/third-party_notices'),
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).thanks, style: itemStyle),
title: Text(S.of(context).thanks,
style: AppTheme.switchListTileTitleStyle),
onTap: () =>
_launchURL('https://github.com/calcitem/Sanmill/wiki/thanks'),
),

View File

@ -541,7 +541,7 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(S.of(context).difficulty, style: headerStyle),
Text(S.of(context).difficulty, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
elevation: 0.5,
@ -549,7 +549,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
child: Column(
children: <Widget>[
ListTile(
title: Text(S.of(context).skillLevel, style: itemStyle),
title: Text(S.of(context).skillLevel,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(""), // TODO
@ -562,7 +563,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
),
AppTheme.sizedBox,
Text(S.of(context).aisPlayStyle, style: headerStyle),
Text(S.of(context).aisPlayStyle,
style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -571,22 +573,23 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.aiIsLazy,
title: Text(S.of(context).passive, style: itemStyle),
title: Text(S.of(context).passive,
style: AppTheme.switchListTileTitleStyle),
onChanged: setAiIsLazy,
),
ListItemDivider(),
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.shufflingEnabled,
title:
Text(S.of(context).shufflingEnabled, style: itemStyle),
title: Text(S.of(context).shufflingEnabled,
style: AppTheme.switchListTileTitleStyle),
onChanged: setShufflingEnabled,
),
],
),
),
AppTheme.sizedBox,
Text(S.of(context).playSounds, style: headerStyle),
Text(S.of(context).playSounds, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -596,14 +599,15 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.toneEnabled,
title: Text(S.of(context).playSoundsInTheGame,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
onChanged: setTone,
),
],
),
),
AppTheme.sizedBox,
Text(S.of(context).whoMovesFirst, style: headerStyle),
Text(S.of(context).whoMovesFirst,
style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -616,14 +620,15 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.aiMovesFirst
? S.of(context).ai
: S.of(context).human,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
onChanged: setWhoMovesFirst,
),
],
),
),
AppTheme.sizedBox,
Text(S.of(context).automaticBehavior, style: headerStyle),
Text(S.of(context).automaticBehavior,
style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -632,14 +637,15 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.isAutoRestart,
title: Text(S.of(context).isAutoRestart, style: itemStyle),
title: Text(S.of(context).isAutoRestart,
style: AppTheme.switchListTileTitleStyle),
onChanged: setIsAutoRestart,
),
],
),
),
AppTheme.sizedBox,
Text(S.of(context).display, style: headerStyle),
Text(S.of(context).display, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -649,13 +655,13 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.isPieceCountInHandShown,
title: Text(S.of(context).isPieceCountInHandShown,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
onChanged: setIsPieceCountInHandShown,
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).boardBorderLineWidth,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(""), // TODO
@ -667,7 +673,7 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
ListItemDivider(),
ListTile(
title: Text(S.of(context).boardInnerLineWidth,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(""), // TODO
@ -680,14 +686,15 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
),
AppTheme.sizedBox,
Text(S.of(context).color, style: headerStyle),
Text(S.of(context).color, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
child: Column(
children: <Widget>[
ListTile(
title: Text(S.of(context).boardColor, style: itemStyle),
title: Text(S.of(context).boardColor,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(Config.boardBackgroundColor.toRadixString(16),
@ -701,7 +708,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).backgroudColor, style: itemStyle),
title: Text(S.of(context).backgroudColor,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(Config.darkBackgroundColor.toRadixString(16),
@ -715,7 +723,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
ListItemDivider(),
ListTile(
title: Text(S.of(context).lineColor, style: itemStyle),
title: Text(S.of(context).lineColor,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(Config.boardLineColor.toRadixString(16),
@ -728,8 +737,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
ListItemDivider(),
ListTile(
title:
Text(S.of(context).blackPieceColor, style: itemStyle),
title: Text(S.of(context).blackPieceColor,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(Config.blackPieceColor.toRadixString(16),
@ -742,8 +751,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
ListItemDivider(),
ListTile(
title:
Text(S.of(context).whitePieceColor, style: itemStyle),
title: Text(S.of(context).whitePieceColor,
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Text(Config.whitePieceColor.toRadixString(16),
@ -758,7 +767,7 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
),
),
AppTheme.sizedBox,
Text(S.of(context).restore, style: headerStyle),
Text(S.of(context).restore, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -766,7 +775,7 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
children: <Widget>[
ListTile(
title: Text(S.of(context).restoreDefaultSettings,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
trailing:
Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
Icon(Icons.keyboard_arrow_right,

View File

@ -178,10 +178,6 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
@override
Widget build(BuildContext context) {
final TextStyle headerStyle =
TextStyle(color: UIColors.crusoeColor, fontSize: 20.0);
final TextStyle itemStyle = TextStyle(color: UIColors.crusoeColor);
return Scaffold(
backgroundColor: UIColors.lightBackgroundColor,
appBar:
@ -191,14 +187,15 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(S.of(context).general, style: headerStyle),
Text(S.of(context).general, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
child: Column(
children: <Widget>[
ListTile(
title: Text(S.of(context).piecesCount, style: itemStyle),
title: Text(S.of(context).piecesCount,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).piecesCount_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
trailing:
@ -217,8 +214,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.hasDiagonalLines,
title:
Text(S.of(context).hasDiagonalLines, style: itemStyle),
title: Text(S.of(context).hasDiagonalLines,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).hasDiagonalLines_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setHasDiagonalLines,
@ -227,7 +224,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.mayFly,
title: Text(S.of(context).mayFly, style: itemStyle),
title: Text(S.of(context).mayFly,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).mayFly_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setAllowFlyingAllowed,
@ -239,7 +237,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.maxStepsLedToDraw,
title:
Text(S.of(context).maxStepsLedToDraw, style: itemStyle),
Text(S.of(context).maxStepsLedToDraw, style: AppTheme.switchListTileTitleStyle),
onChanged: setMaxStepsLedToDraw,
),
ListItemDivider(),
@ -248,7 +246,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
),
),
AppTheme.sizedBox,
Text(S.of(context).placing, style: headerStyle),
Text(S.of(context).placing, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -256,8 +254,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.hasBannedLocations,
title:
Text(S.of(context).hasBannedLocations, style: itemStyle),
title: Text(S.of(context).hasBannedLocations,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).hasBannedLocations_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setHasBannedLocations,
@ -267,7 +265,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.isBlackLoseButNotDrawWhenBoardFull,
title: Text(S.of(context).isBlackLoseButNotDrawWhenBoardFull,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(
S.of(context).isBlackLoseButNotDrawWhenBoardFull_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
@ -276,7 +274,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
]),
),
AppTheme.sizedBox,
Text(S.of(context).moving, style: headerStyle),
Text(S.of(context).moving, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -284,8 +282,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.isDefenderMoveFirst,
title:
Text(S.of(context).isDefenderMoveFirst, style: itemStyle),
title: Text(S.of(context).isDefenderMoveFirst,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).isDefenderMoveFirst_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setIsDefenderMoveFirst,
@ -295,7 +293,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.isLoseButNotChangeSideWhenNoWay,
title: Text(S.of(context).isLoseButNotChangeSideWhenNoWay,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(
S.of(context).isLoseButNotChangeSideWhenNoWay_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
@ -304,7 +302,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
]),
),
AppTheme.sizedBox,
Text(S.of(context).removing, style: headerStyle),
Text(S.of(context).removing, style: AppTheme.settingsHeaderStyle),
Card(
color: AppTheme.cardColor,
margin: AppTheme.cardMargin,
@ -313,7 +311,7 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
activeColor: AppTheme.switchListTileActiveColor,
value: Config.mayRemoveFromMillsAlways,
title: Text(S.of(context).mayRemoveFromMillsAlways,
style: itemStyle),
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).mayRemoveFromMillsAlways_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setAllowRemovePieceInMill,
@ -322,8 +320,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
SwitchListTile(
activeColor: AppTheme.switchListTileActiveColor,
value: Config.mayRemoveMultiple,
title:
Text(S.of(context).mayRemoveMultiple, style: itemStyle),
title: Text(S.of(context).mayRemoveMultiple,
style: AppTheme.switchListTileTitleStyle),
subtitle: Text(S.of(context).mayRemoveMultiple_Detail,
style: TextStyle(color: UIColors.secondaryColor)),
onChanged: setAllowRemoveMultiPiecesWhenCloseMultiMill,