Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create button to open ethernet config #153

Merged
merged 7 commits into from
Sep 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved the button
  • Loading branch information
Levi-Lesches committed Sep 18, 2024
commit 711cf3073a941b1fcc2c1d87e69596cec0804b3d
40 changes: 17 additions & 23 deletions lib/src/pages/settings.dart
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@ import "package:rover_dashboard/services.dart";
import "package:rover_dashboard/widgets.dart";

/// A widget to display all the settings in a [ValueBuilder].
///
///
/// Technically this class does not need to be used with [ValueBuilder], but it provides a heading
/// and a list of children widgets to modify individual settings.
class ValueEditor<T> extends StatelessWidget {
@@ -40,7 +40,7 @@ class ValueEditor<T> extends StatelessWidget {
...children,
],
);
}
}

/// The settings page.
class SettingsPage extends ReactiveWidget<SettingsBuilder> {
@@ -62,6 +62,12 @@ class SettingsPage extends ReactiveWidget<SettingsBuilder> {
SocketEditor(name: "Autonomy socket", model: model.network.autonomySocket),
SocketEditor(name: "Tank IP address", model: model.network.tankSocket, editPort: false),
NumberEditor(name: "Heartbeats per second", model: model.network.connectionTimeout),
if (Platform.isWindows) ListTile(
title: const Text("Open Network Config"),
subtitle: const Text("Opens ethernet configuration page in settings"),
trailing: const Icon(Icons.lan_outlined),
onTap: () => launchUrl(Uri.parse("ms-settings:network-ethernet")),
),
],
),
const Divider(),
@@ -81,7 +87,7 @@ class SettingsPage extends ReactiveWidget<SettingsBuilder> {
name: "Science settings",
children: [
NumberEditor(
name: "Number of samples",
name: "Number of samples",
model: model.science.numSamples,
),
SwitchListTile(
@@ -97,13 +103,13 @@ class SettingsPage extends ReactiveWidget<SettingsBuilder> {
name: "Dashboard Settings",
children: [
NumberEditor(
name: "Frames per second",
name: "Frames per second",
subtitle: "This does not affect the rover's cameras. Useful for limiting the CPU of the dashboard",
model: model.dashboard.fps,
),
NumberEditor(
name: "Block size",
subtitle: "The precision of the GPS grid",
name: "Block size",
subtitle: "The precision of the GPS grid",
model: model.dashboard.blockSize,
),
SwitchListTile(
@@ -194,18 +200,6 @@ class SettingsPage extends ReactiveWidget<SettingsBuilder> {
),
const Divider(),
Text("Misc", style: Theme.of(context).textTheme.titleLarge),
if (Platform.isWindows)
ListTile(
title: const Text("Open Network Config"),
subtitle: const Text("Opens ethernet configuration page in settings"),
trailing: const Icon(Icons.lan_outlined),
onTap: () async {
if (!Platform.isWindows) {
return;
}
await launchUrl(Uri.parse("ms-settings:network-ethernet"));
},
),
ListTile(
title: const Text("Open session output"),
subtitle: const Text("Opens all files created by this session"),
@@ -250,21 +244,21 @@ class SettingsPage extends ReactiveWidget<SettingsBuilder> {
],
),),
Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text("Cancel"),
child: const Text("Cancel"),
),
const SizedBox(width: 4),
ElevatedButton.icon(
onPressed: !model.isValid ? null : () async {
await model.save();
if (context.mounted) Navigator.of(context).pop();
},
label: const Text("Save"),
icon: model.isLoading
? const SizedBox(height: 24, width: 24, child: CircularProgressIndicator())
label: const Text("Save"),
icon: model.isLoading
? const SizedBox(height: 24, width: 24, child: CircularProgressIndicator())
: const Icon(Icons.save),
),
const SizedBox(width: 4),