plugin_framework, support log callback

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-25 15:35:48 +08:00
parent ce1ce19567
commit 2051dca5b4
7 changed files with 118 additions and 51 deletions

View File

@@ -1466,7 +1466,11 @@ class PluginCardState extends State<PluginCard> {
final children = [
_Button(
'Reload',
() => bind.pluginReload(id: widget.pluginId),
() async {
clearPlugin(widget.pluginId);
await bind.pluginReload(id: widget.pluginId);
setState(() {});
},
),
_Checkbox(
label: 'Enable',
@@ -1476,6 +1480,7 @@ class PluginCardState extends State<PluginCard> {
clearPlugin(widget.pluginId);
}
await bind.pluginIdEnable(id: widget.pluginId, v: v);
setState(() {});
},
),
];

View File

@@ -51,6 +51,11 @@ class LocationModel with ChangeNotifier {
notifyListeners();
}
void remove(PluginId id) {
pluginModels.remove(id);
notifyListeners();
}
bool get isEmpty => pluginModels.isEmpty;
}
@@ -68,7 +73,7 @@ PluginModel? getPluginModel(String location, PluginId id) =>
void clearPlugin(PluginId pluginId) {
for (var element in _locationModels.values) {
element.pluginModels.remove(pluginId);
element.remove(pluginId);
}
}