plugin_framework, ui tmp

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou
2023-04-20 22:53:43 +08:00
parent 9a08e0bed4
commit 1b303b7b27
11 changed files with 147 additions and 93 deletions

View 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]!;
}