Skip to content

Commit

Permalink
Added swerve drive widget
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Oct 18, 2023
1 parent 7b1756b commit 46d7533
Show file tree
Hide file tree
Showing 3 changed files with 576 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/combo_box_choo
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/robot_preferences.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/split_button_chooser.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/subsystem_widget.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/swerve_drive.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/match_time.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/multi_color_view.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/number_bar.dart';
Expand Down Expand Up @@ -356,6 +357,11 @@ class DraggableNT4WidgetContainer extends DraggableWidgetContainer {
key: UniqueKey(),
jsonData: jsonData['properties'],
);
case 'SwerveDrive':
return SwerveDriveWidget.fromJson(
key: UniqueKey(),
jsonData: jsonData['properties'],
);
case 'ComboBox Chooser':
return ComboBoxChooser.fromJson(
key: UniqueKey(),
Expand Down
6 changes: 6 additions & 0 deletions lib/widgets/network_tree/tree_row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/power_distribu
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/combo_box_chooser.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/robot_preferences.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/subsystem_widget.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/multi-topic/swerve_drive.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/boolean_box.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/nt4_widget.dart';
import 'package:elastic_dashboard/widgets/nt4_widgets/single_topic/text_display.dart';
Expand Down Expand Up @@ -159,6 +160,8 @@ class TreeRow {
return PIDControllerWidget(key: UniqueKey(), topic: topic);
case 'DifferentialDrive':
return DifferentialDrive(key: UniqueKey(), topic: topic);
case 'SwerveDrive':
return SwerveDriveWidget(key: UniqueKey(), topic: topic);
case 'String Chooser':
return ComboBoxChooser(key: UniqueKey(), topic: topic);
case 'Subsystem':
Expand Down Expand Up @@ -205,6 +208,9 @@ class TreeRow {
} else if (primary is DifferentialDrive) {
width = normalGridSize * 3;
height = normalGridSize * 2;
} else if (primary is SwerveDriveWidget) {
width = normalGridSize * 2;
height = normalGridSize * 2;
} else if (primary is SubsystemWidget) {
width = normalGridSize * 2;
} else if (primary is CommandWidget) {
Expand Down
Loading

0 comments on commit 46d7533

Please sign in to comment.