mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-04-06 08:31:28 +03:00
plugin_framework, ui tmp
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
44
flutter/lib/desktop/plugin/model.dart
Normal file
44
flutter/lib/desktop/plugin/model.dart
Normal file
@@ -0,0 +1,44 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import './common.dart';
|
||||
import './desc.dart';
|
||||
|
||||
final Map<String, LocationModel> locationModels = {};
|
||||
|
||||
class PluginModel with ChangeNotifier {
|
||||
final List<UiType> uiList = [];
|
||||
|
||||
void add(UiType ui) {
|
||||
uiList.add(ui);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
bool get isEmpty => uiList.isEmpty;
|
||||
}
|
||||
|
||||
class LocationModel with ChangeNotifier {
|
||||
final Map<PluginId, PluginModel> pluginModels = {};
|
||||
|
||||
void add(PluginId id, UiType ui) {
|
||||
if (pluginModels[id] != null) {
|
||||
pluginModels[id]!.add(ui);
|
||||
} else {
|
||||
var model = PluginModel();
|
||||
model.add(ui);
|
||||
pluginModels[id] = model;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
bool get isEmpty => pluginModels.isEmpty;
|
||||
}
|
||||
|
||||
void addLocationUi(String location, PluginId id, UiType ui) {
|
||||
locationModels[location]?.add(id, ui);
|
||||
}
|
||||
|
||||
LocationModel addLocation(String location) {
|
||||
if (locationModels[location] == null) {
|
||||
locationModels[location] = LocationModel();
|
||||
}
|
||||
return locationModels[location]!;
|
||||
}
|
||||
Reference in New Issue
Block a user