flutter: Print when config changed

This commit is contained in:
Calcitem 2021-05-16 12:18:08 +08:00
parent 9fc2f4b0cc
commit bd65f9226e
5 changed files with 52 additions and 1 deletions

View File

@ -48,7 +48,7 @@ class Settings {
final contents = jsonEncode(_values);
await _file.writeAsString(contents);
print("Settings is committed.");
//print("Settings is committed.");
return true;
}

View File

@ -587,6 +587,7 @@ class _GamePageState extends State<GamePage> with RouteAware {
onPressed: () {
if (!isTopLevel) Config.skillLevel++;
Config.save();
print("[config] skillLevel: ${Config.skillLevel}");
Navigator.of(context).pop();
}),
TextButton(

View File

@ -365,6 +365,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.aiMovesFirst = !value;
});
print("[config] aiMovesFirst: ${Config.aiMovesFirst}");
Config.save();
}
@ -373,6 +375,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.aiIsLazy = value;
});
print("[config] aiMovesFirst: $value");
Config.save();
}
@ -381,6 +385,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.isAutoRestart = value;
});
print("[config] isAutoRestart: $value");
Config.save();
}
@ -389,6 +395,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.isAutoChangeFirstMove = value;
});
print("[config] isAutoChangeFirstMove: $value");
Config.save();
}
@ -397,6 +405,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.resignIfMostLose = value;
});
print("[config] resignIfMostLose: $value");
Config.save();
}
@ -405,6 +415,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.shufflingEnabled = value;
});
print("[config] shufflingEnabled: $value");
Config.save();
}
@ -413,6 +425,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.learnEndgame = value;
});
print("[config] learnEndgame: $value");
Config.save();
}
@ -421,6 +435,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.idsEnabled = value;
});
print("[config] idsEnabled: $value");
Config.save();
}
@ -429,6 +445,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.depthExtension = value;
});
print("[config] depthExtension: $value");
Config.save();
}
@ -437,6 +455,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.openingBook = value;
});
print("[config] openingBook: $value");
Config.save();
}
@ -445,6 +465,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.toneEnabled = value;
});
print("[config] toneEnabled: $value");
Config.save();
}
@ -458,6 +480,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.developerMode = value;
});
print("[config] developerMode: $value");
Config.save();
}
@ -468,6 +492,8 @@ class _GameSettingsPageState extends State<GameSettingsPage> {
Config.isPieceCountInHandShown = value;
});
print("[config] isPieceCountInHandShown: $value");
Config.save();
}
}

View File

@ -73,6 +73,8 @@ class _PersonalizationSettingsPageState
onPressed: () {
setState(() => currentColor = pickerColor);
print("[config] pickerColor.value: ${pickerColor.value}");
if (colorString == S.of(context).boardColor) {
Config.boardBackgroundColor = pickerColor.value;
} else if (colorString == S.of(context).backgroudColor) {

View File

@ -179,6 +179,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.piecesCount = Config.piecesCount = piecesCount ?? 9;
});
print("[config] rule.piecesCount: ${rule.piecesCount}");
Config.save();
}
@ -213,6 +215,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.hasDiagonalLines = Config.hasDiagonalLines = value;
});
print("[config] rule.hasDiagonalLines: $value");
Config.save();
}
@ -221,6 +225,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.mayFly = Config.mayFly = value;
});
print("[config] rule.mayFly: $value");
Config.save();
}
@ -231,6 +237,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.hasBannedLocations = Config.hasBannedLocations = value;
});
print("[config] rule.hasBannedLocations: $value");
Config.save();
}
@ -240,6 +248,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
Config.isWhiteLoseButNotDrawWhenBoardFull = value;
});
print("[config] rule.isWhiteLoseButNotDrawWhenBoardFull: $value");
Config.save();
}
@ -250,6 +260,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.isDefenderMoveFirst = Config.isDefenderMoveFirst = value;
});
print("[config] rule.isDefenderMoveFirst: $value");
Config.save();
}
@ -259,6 +271,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
Config.isLoseButNotChangeSideWhenNoWay = value;
});
print("[config] rule.isLoseButNotChangeSideWhenNoWay: $value");
Config.save();
}
@ -269,6 +283,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.mayRemoveFromMillsAlways = Config.mayRemoveFromMillsAlways = value;
});
print("[config] rule.mayRemoveFromMillsAlways: $value");
Config.save();
}
@ -277,6 +293,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.mayRemoveMultiple = Config.mayRemoveMultiple = value;
});
print("[config] rule.mayRemoveMultiple: $value");
Config.save();
}
@ -287,6 +305,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.maxStepsLedToDraw = Config.maxStepsLedToDraw = value;
});
print("[config] rule.maxStepsLedToDraw: $value");
Config.save();
}
@ -295,6 +315,8 @@ class _RuleSettingsPageState extends State<RuleSettingsPage> {
rule.piecesAtLeastCount = Config.piecesAtLeastCount = value;
});
print("[config] rule.piecesAtLeastCount: $value");
Config.save();
}
}