add active flow page
This commit is contained in:
parent
37757ee445
commit
f4d81bc5ff
1 changed files with 32 additions and 3 deletions
|
@ -36,6 +36,31 @@ class _FlowsPageState extends State<FlowsPage> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget listFlowInfoByActive(
|
||||||
|
BuildContext context, Map<String, API.FlowInfo> infos) {
|
||||||
|
return FutureBuilder(future: () async {
|
||||||
|
var included = [];
|
||||||
|
|
||||||
|
for (var key in infos.keys) {
|
||||||
|
var active = await API.API().getActiveFlowsOf(key);
|
||||||
|
if (active.isNotEmpty) {
|
||||||
|
included.add(infos[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return included;
|
||||||
|
}(), builder: (context, snapshot) {
|
||||||
|
if (!snapshot.hasData) {
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
}
|
||||||
|
|
||||||
|
var included = snapshot.data!;
|
||||||
|
|
||||||
|
return ListView(
|
||||||
|
children: included.map((x) => flowTile(context, x)).toList());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Widget listAllFlowInfos(
|
Widget listAllFlowInfos(
|
||||||
BuildContext context, Map<String, API.FlowInfo> infos) {
|
BuildContext context, Map<String, API.FlowInfo> infos) {
|
||||||
return ListView(
|
return ListView(
|
||||||
|
@ -101,8 +126,6 @@ class _FlowsPageState extends State<FlowsPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// todo : list currently active
|
|
||||||
|
|
||||||
if (flowInfos == null) {
|
if (flowInfos == null) {
|
||||||
return const CircularProgressIndicator();
|
return const CircularProgressIndicator();
|
||||||
}
|
}
|
||||||
|
@ -111,7 +134,12 @@ class _FlowsPageState extends State<FlowsPage> {
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text("Flows"),
|
title: const Text("Flows"),
|
||||||
bottom: TabBar(
|
bottom: TabBar(
|
||||||
tabs: const [Text("All"), Text("Produces"), Text("Depends")],
|
tabs: const [
|
||||||
|
Text("All"),
|
||||||
|
Text("Produces"),
|
||||||
|
Text("Depends"),
|
||||||
|
Text("Active")
|
||||||
|
],
|
||||||
onTap: (value) {
|
onTap: (value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
tabSelection = value;
|
tabSelection = value;
|
||||||
|
@ -122,6 +150,7 @@ class _FlowsPageState extends State<FlowsPage> {
|
||||||
0 => listAllFlowInfos(context, flowInfos!),
|
0 => listAllFlowInfos(context, flowInfos!),
|
||||||
1 => listFlowInfoByProduced(context, flowInfos!),
|
1 => listFlowInfoByProduced(context, flowInfos!),
|
||||||
2 => listFlowInfoByDependant(context, flowInfos!),
|
2 => listFlowInfoByDependant(context, flowInfos!),
|
||||||
|
3 => listFlowInfoByActive(context, flowInfos!),
|
||||||
_ => const Text("..."),
|
_ => const Text("..."),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue