rustdesk/flutter/lib/plugin/widget.dart
fufesou d9755abbc2 tmp commit
Signed-off-by: fufesou <shuanglongchen@yeah.net>
2023-04-20 22:55:26 +08:00

48 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import './desc.dart';
import './model.dart';
final Map<String, PluginWidget> pluginWidgets = {};
class PluginWidget {
final String id;
final String name;
final String location;
final Widget widget;
PluginWidget({
required this.id,
required this.name,
required this.location,
required this.widget,
});
// static Widget createButton(UiButton btn) {}
// static Widget createCheckbox(UiCheckbox chk) {}
// // ui location
// // host|main|settings|display|others
// // client|remote|toolbar|display
// static Widget? create(String id, String locatin, UiType ui) {
// if (ui.button != null) {
// return createButton(ui.button!);
// } else if (ui.checkbox != null) {
// return createCheckbox(ui.checkbox!);
// } else {
// return null;
// }
// }
}
void handleReloading(Map<String, dynamic> evt, String peer) {
if (evt['id'] == null || evt['location'] == null) {
return;
}
final ui = UiType.fromJson(evt);
if (!ui.isValid) {
return;
}
addLocation(evt['id']!, evt['location']!, ui);
}