From d82ebdc006e45dceb99f4024a440307ee875d254 Mon Sep 17 00:00:00 2001 From: Sveinbjorn Thordarson Date: Tue, 23 May 2023 15:36:24 +0000 Subject: [PATCH] Abbreviate server selection presets so they fit horizontally, don't show server selection unless in debug mode --- lib/common.dart | 8 ++++---- lib/settings.dart | 34 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/lib/common.dart b/lib/common.dart index 0cbcf18..6722624 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -57,16 +57,16 @@ const String kPrivacyURL = 'https://embla.is/privacy.html'; // Ratatoskur server preset options (for debugging purposes) const List> kRatatoskurServerPresetOptions = [ ['API', kDefaultRatatoskurServer], - ['Staging', "https://staging.api.greynir.is"], - ['Brand', 'http://brandur.mideind.is:8080'], + ['Stg.', "https://staging.api.greynir.is"], + ['Br.', 'http://brandur.mideind.is:8080'], ['Lókal', 'http://192.168.1.8:8080'] ]; // Query server preset options (for debugging purposes) const List> kQueryServerPresetOptions = [ ['Greynir', kDefaultQueryServer], - ['Stag', "https://staging.greynir.is"], - ['Brand', 'http://brandur.mideind.is:5000'], + ['Stg.', "https://staging.greynir.is"], + ['Br.', 'http://brandur.mideind.is:5000'], ['Lókal', 'http://192.168.1.8:5000'] ]; diff --git a/lib/settings.dart b/lib/settings.dart index 12f0223..27ca724 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -22,6 +22,7 @@ import 'dart:async'; // import 'dart:io'; // import 'package:flutter/foundation.dart' show kDebugMode; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; @@ -585,22 +586,23 @@ List _settings(BuildContext context, void Function() refreshCallback) { ]; // Only include query server selection widget in debug builds - // if (kDebugMode) { - settingsWidgets.addAll([ - // ASR engine selection - const SettingsASRSelectionWidget(label: 'Talgreining'), - divider, - // Ratatoskur server selection - const SettingsFullTextLabelWidget('Ratatoskur:'), - const SettingsServerSelectionWidget( - items: kRatatoskurServerPresetOptions, prefKey: 'ratatoskur_server'), - divider, - // Query server selection - const SettingsFullTextLabelWidget('Fyrirspurnaþjónn:'), - const SettingsServerSelectionWidget(items: kQueryServerPresetOptions, prefKey: 'query_server'), - const Padding(padding: EdgeInsets.only(top: 0, bottom: 0), child: Text('')) - ]); - // } + if (kDebugMode) { + settingsWidgets.addAll([ + // ASR engine selection + const SettingsASRSelectionWidget(label: 'Talgreining'), + divider, + // Ratatoskur server selection + const SettingsFullTextLabelWidget('Ratatoskur:'), + const SettingsServerSelectionWidget( + items: kRatatoskurServerPresetOptions, prefKey: 'ratatoskur_server'), + divider, + // Query server selection + const SettingsFullTextLabelWidget('Fyrirspurnaþjónn:'), + const SettingsServerSelectionWidget( + items: kQueryServerPresetOptions, prefKey: 'query_server'), + const Padding(padding: EdgeInsets.only(top: 0, bottom: 0), child: Text('')) + ]); + } /// Make API call to clear user data void clearData({bool all = false}) async {