Skip to content

Commit

Permalink
app: togglable evaluation bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mytja committed Apr 28, 2024
1 parent ac83a10 commit 782422f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
1 change: 1 addition & 0 deletions tarok/lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ bool DISCORD_RPC = true;
bool RED_FILTER = true;
bool COUNTERCLOCKWISE_GAME = false;
bool POINTS_TOOLTIP = false;
bool SHOW_EVALUATION = true;
String THEME = "";
Locale LOCALE = Get.deviceLocale ?? const Locale("sl", "SI");

Expand Down
4 changes: 2 additions & 2 deletions tarok/lib/game/game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ class Game extends StatelessWidget {
),

// EVAL BAR
if (controller.bots)
if (controller.bots && SHOW_EVALUATION)
Positioned(
top: 0,
right: fullWidth / 5.5,
Expand Down Expand Up @@ -689,7 +689,7 @@ class Game extends StatelessWidget {
),
),

if (controller.bots)
if (controller.bots && SHOW_EVALUATION)
Positioned(
top: fullHeight / 3 + 25,
right: fullWidth / 5.5 + 20,
Expand Down
11 changes: 10 additions & 1 deletion tarok/lib/internationalization/languages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ class Messages extends Translations {
"player_plays": "Players 👤 are playing \"@game\" @times times",
"other_players_are_playing":
"Other players are currently playing following games",
"show_evaluation": "Show evaluation",
"show_evaluation_desc":
"Shows current StockŠkis evaluation in an evaluation bar in offline (bot) games.",
},
"fr_FR": {
"login": "Connexion",
Expand Down Expand Up @@ -938,7 +941,10 @@ class Messages extends Translations {
"bot_plays": "Les robots 🤖 jouent \"@game\" @times fois",
"player_plays": "Les joueurs 👤 jouent \"@game\" @times fois",
"other_players_are_playing":
"Les autres joueurs sont actuellement en train de jouer aux jeux suivants"
"Les autres joueurs sont actuellement en train de jouer aux jeux suivants",
"show_evaluation": "Show evaluation",
"show_evaluation_desc":
"Shows current StockŠkis evaluation in an evaluation bar in offline (bot) games.",
},
"sl_SI": {
"login": "Prijava",
Expand Down Expand Up @@ -1392,6 +1398,9 @@ class Messages extends Translations {
"bot_plays": "Boti 🤖 igrajo \"@game\" @times-krat",
"player_plays": "Igralci 👤 igrajo \"@game\" @times-krat",
"other_players_are_playing": "Drugi igralci igrajo naslednje igre",
"show_evaluation": "Prikaži evaluacijo",
"show_evaluation_desc":
"Prikaže trenutno StockŠkis evaluacijo v igrah brez internetne povezave (offline/z boti).",
}
};
}
1 change: 1 addition & 0 deletions tarok/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ void main() async {
CARD_CLEANUP_DELAY = prefs.getInt("card_cleanup_delay") ?? 1000;
COUNTERCLOCKWISE_GAME = prefs.getBool("counterclockwise_game") ?? false;
POINTS_TOOLTIP = prefs.getBool("points_tooltip") ?? false;
SHOW_EVALUATION = prefs.getBool("show_evaluation") ?? true;

if (kReleaseMode) {
BACKEND_URL = prefs.getString("api_url") ?? "https://palcka.si/api";
Expand Down
13 changes: 13 additions & 0 deletions tarok/lib/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,19 @@ class _SettingsState extends State<Settings> {
title: Text("premove".tr),
description: Text("premove_desc".tr),
),
SettingsTile.switchTile(
onToggle: (value) async {
final SharedPreferences prefs =
await SharedPreferences.getInstance();
await prefs.setBool("show_evaluation", value);
SHOW_EVALUATION = prefs.getBool("show_evaluation") ?? true;
setState(() {});
},
initialValue: SHOW_EVALUATION,
leading: const Icon(Icons.help),
title: Text("show_evaluation".tr),
description: Text("show_evaluation_desc".tr),
),
],
),
SettingsSection(
Expand Down

0 comments on commit 782422f

Please sign in to comment.