Skip to content

Commit

Permalink
Fixed widgets not rebuilding after dragging
Browse files Browse the repository at this point in the history
  • Loading branch information
Gold872 committed Nov 22, 2023
1 parent 2c7ecb6 commit 9fb5f6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/widgets/dashboard_grid.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:contextmenu/contextmenu.dart';
import 'package:dot_cast/dot_cast.dart';
import 'package:elastic_dashboard/services/globals.dart';
import 'package:elastic_dashboard/services/nt4_connection.dart';
import 'package:elastic_dashboard/widgets/draggable_containers/draggable_layout_container.dart';
Expand Down Expand Up @@ -229,6 +230,8 @@ class DashboardGrid extends StatelessWidget {
widget.validLocation = true;

widget.dispose();
widget.refresh();
widget.tryCast<DraggableNT4WidgetContainer>()?.refreshChild();
}

void onWidgetDragCancel(DraggableWidgetContainer widget) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,10 @@ class DraggableNT4WidgetContainer extends DraggableWidgetContainer {
onJsonLoadingWarning: onJsonLoadingWarning);
}

void refreshChild() {
child?.refresh();
}

@override
void dispose({bool deleting = false}) {
super.dispose(deleting: deleting);
Expand Down Expand Up @@ -534,7 +538,10 @@ class DraggableNT4WidgetContainer extends DraggableWidgetContainer {
width: draggablePositionRect.width,
height: draggablePositionRect.height,
opacity: 0.80,
child: child,
child: ChangeNotifierProvider(
create: (context) => NT4WidgetNotifier(),
child: child,
),
);
}

Expand Down

0 comments on commit 9fb5f6a

Please sign in to comment.