[pve-devel] [PATCH pve_flutter_frontend] refactor: remove unused files and address deprecated import

Shan Shaji s.shaji at proxmox.com
Tue May 6 10:25:01 CEST 2025


This patch removes the `utils_web.dart` file, which contained a
deprecated `dart:html` import. Flutter suggest using `package:web` [0].
However this package is an external package [1] and are not included
by default with flutter or dart.

The `registerConsoleIframe` function had one usage inside the
`PveConsoleWidget` , but since the widget is no longer being
used, this patch deletes both the `utils_web.dart` and
`pve_console_widget.dart` files.

- [0] https://dart.dev/interop/js-interop/package-web
- [1] https://pub.dev/packages/web

Signed-off-by: Shan Shaji <s.shaji at proxmox.com>
---
 lib/utils/utils.dart                |  2 --
 lib/utils/utils_web.dart            | 15 ---------------
 lib/widgets/pve_console_widget.dart | 24 ------------------------
 3 files changed, 41 deletions(-)
 delete mode 100644 lib/utils/utils_web.dart
 delete mode 100644 lib/widgets/pve_console_widget.dart

diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart
index 0507d90..026fad6 100644
--- a/lib/utils/utils.dart
+++ b/lib/utils/utils.dart
@@ -8,8 +8,6 @@ import 'package:pve_flutter_frontend/states/pve_task_log_viewer_state.dart';
 import 'package:pve_flutter_frontend/widgets/pve_console_menu_widget.dart';
 import 'package:pve_flutter_frontend/widgets/pve_task_log_widget.dart';
 
-void registerConsoleIframe(String nodeid) => throw UnimplementedError();
-
 Future<T?> showTaskLogBottomSheet<T>(BuildContext context,
     ProxmoxApiClient apiClient, String targetNode, String upid,
     {Widget icon = const Icon(Icons.work),
diff --git a/lib/utils/utils_web.dart b/lib/utils/utils_web.dart
deleted file mode 100644
index d09ff67..0000000
--- a/lib/utils/utils_web.dart
+++ /dev/null
@@ -1,15 +0,0 @@
-import 'dart:html';
-import 'dart:ui' as ui;
-
-void registerConsoleIframe(String nodeid) {
-  // analyzer
-  // ignore: undefined_prefixed_name
-  ui.platformViewRegistry.registerViewFactory(
-      'console-html',
-      (int viewId) => IFrameElement()
-        ..width = '640'
-        ..height = '360'
-        ..src =
-            'http://localhost/?console=shell&node=$nodeid&resize=scale&xtermjs=1'
-        ..style.border = 'none');
-}
diff --git a/lib/widgets/pve_console_widget.dart b/lib/widgets/pve_console_widget.dart
deleted file mode 100644
index f71c5f0..0000000
--- a/lib/widgets/pve_console_widget.dart
+++ /dev/null
@@ -1,24 +0,0 @@
-import 'package:flutter/foundation.dart';
-import 'package:flutter/material.dart';
-import 'package:pve_flutter_frontend/utils/utils.dart'
-    if (dart.library.html) 'package:pve_flutter_frontend/utils/utils_web.dart';
-
-class PveConsoleWidget extends StatelessWidget {
-  static const routeName = '/console';
-  final String? vmid;
-  final String nodeid;
-  const PveConsoleWidget({super.key, this.vmid, required this.nodeid});
-
-  @override
-  Widget build(BuildContext context) {
-    //TODO change this when there's a more official way to determine web e.g. Platform.isWeb or similar
-    if (kIsWeb) {
-      registerConsoleIframe(nodeid);
-      return const HtmlElementView(
-        viewType: 'console-html',
-      );
-    } else {
-      return Container();
-    }
-  }
-}
-- 
2.39.5





More information about the pve-devel mailing list