Skip to content

Commit

Permalink
Initial app startup fixes
Browse files Browse the repository at this point in the history
* Default tabs properly add
* The bottom bar displays "Team Unkown" instead of "Team 9999"
* Team number in settings dialog doesn't have any "null" text
  • Loading branch information
Gold872 committed Dec 23, 2023
1 parent 9cc3244 commit c233961
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions lib/pages/dashboard_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -441,10 +441,11 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
setState(() => loadLayoutFromJsonData(jsonString));
}

void loadLayout() async {
void loadLayout() {
String? jsonString = _preferences.getString(PrefKeys.layout);

if (jsonString == null) {
createDefaultTabs();
return;
}

Expand Down Expand Up @@ -1326,7 +1327,7 @@ class _DashboardPageState extends State<DashboardPage> with WindowListener {
),
Expanded(
child: Text(
'Team ${_preferences.getInt(PrefKeys.teamNumber)?.toString() ?? '9999'}',
'Team ${_preferences.getInt(PrefKeys.teamNumber)?.toString() ?? 'Unknown'}',
textAlign: TextAlign.center,
),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/services/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ class Settings {
static IPAddressMode ipAddressMode = IPAddressMode.driverStation;

static String ipAddress = '127.0.0.1';
static int teamNumber = 353;
static int teamNumber = 9999;
static int gridSize = 128;
static double cornerRadius = 15.0;
static bool showGrid = false;
static bool showGrid = true;
static bool autoResizeToDS = false;

// window_manager doesn't support drag disable/maximize
// disable on some platforms, this is a dumb workaround for it
static bool isWindowDraggable = true;
static bool isWindowMaximizable = true;

static double defaultPeriod = 0.1;
static double defaultPeriod = 0.06;
static double defaultGraphPeriod = 0.033;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/settings_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class _SettingsDialogState extends State<SettingsDialog> {
Flexible(
child: DialogTextInput(
initialText:
widget.preferences.getInt(PrefKeys.teamNumber).toString(),
widget.preferences.getInt(PrefKeys.teamNumber)?.toString(),
label: 'Team Number',
onSubmit: (data) {
setState(() {
Expand Down

0 comments on commit c233961

Please sign in to comment.