plugin_framework, load plugin

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-23 15:40:55 +08:00
parent ae789ff5f1
commit 260c671d6c
13 changed files with 411 additions and 103 deletions

View File

@@ -1434,27 +1434,38 @@ class _PluginState extends State<_Plugin> {
final scrollController = ScrollController();
buildCards(DescModel model) {
final cards = <Widget>[
_Card(title: 'Plugin', children: [
_checkbox('Enable', bind.pluginIsEnabled, (bool v) async {
if (!v) {
clearLocations();
}
await bind.pluginEnable(v: v);
}),
]),
_Card(
title: 'Plugin',
children: [
_checkbox(
'Enable',
() => bind.pluginIsEnabled() ?? false,
(bool v) async {
if (!v) {
clearLocations();
}
await bind.pluginEnable(v: v);
},
),
],
),
];
model.all.forEach((key, value) {
cards.add(_Card(title: key, children: [
_Button('Reload', () {
bind.pluginReload(id: key);
}),
_checkbox('Enable', () => bind.pluginIdIsEnabled(id: key),
(bool v) async {
if (!v) {
clearPlugin(key);
}
await bind.pluginIdEnable(id: key, v: v);
}),
_Button(
'Reload',
() => bind.pluginReload(id: key),
),
_checkbox(
'Enable',
() => bind.pluginIdIsEnabled(id: key),
(bool v) async {
if (!v) {
clearPlugin(key);
}
await bind.pluginIdEnable(id: key, v: v);
},
),
]));
});
return cards;