Skip to content

Commit

Permalink
Fixed widget type change bug
Browse files Browse the repository at this point in the history
* Trying to change single topic widgets to a different type now works
* Topics don't get switched around when changing widget types
  • Loading branch information
Gold872 committed Dec 10, 2023
1 parent 2857efe commit 40b99bf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
15 changes: 15 additions & 0 deletions lib/services/nt4_widget_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,21 @@ class NT4WidgetBuilder {
});

// Used when building widgets from network tables (drag and drop)
_widgetNameBuildMap.addAll({
BooleanBox.widgetType: BooleanBox.new,
GraphWidget.widgetType: GraphWidget.new,
MatchTimeWidget.widgetType: MatchTimeWidget.new,
MultiColorView.widgetType: MultiColorView.new,
NumberBar.widgetType: NumberBar.new,
NumberSlider.widgetType: NumberSlider.new,
SingleColorView.widgetType: SingleColorView.new,
TextDisplay.widgetType: TextDisplay.new,
'Text View': TextDisplay.new,
ToggleButton.widgetType: ToggleButton.new,
ToggleSwitch.widgetType: ToggleSwitch.new,
VoltageView.widgetType: VoltageView.new,
});

_widgetNameBuildMap.addAll({
AccelerometerWidget.widgetType: AccelerometerWidget.new,
CameraStreamWidget.widgetType: CameraStreamWidget.new,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class DraggableNT4WidgetContainer extends DraggableWidgetContainer {

NT4Widget? newWidget = NT4WidgetBuilder.buildNT4WidgetFromType(
type,
child.type,
child.topic,
period: child.period,
);

Expand Down

0 comments on commit 40b99bf

Please sign in to comment.