This commit is contained in:
JMARyA 2024-09-20 08:52:56 +02:00
parent 80895d4d71
commit 7155aaf6b9
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 72 additions and 11 deletions

View file

@ -1,4 +1,4 @@
import 'package:cdb_ui/api.dart';
import 'package:cdb_ui/api.dart' as API;
import 'package:flutter/material.dart';
class FlowsPage extends StatelessWidget {
@ -7,10 +7,13 @@ class FlowsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// todo : flows by item produced
// todo : list all flow kinds
// todo : list currently active
// todo : flows by item needed (show only avail)
return Scaffold(
appBar: AppBar(title: const Text("Flows")),
body: FutureBuilder(
future: API().getFlows(),
future: API.API().getFlows(),
builder: (ctx, snap) {
if (!snap.hasData) {
return const CircularProgressIndicator();
@ -34,7 +37,7 @@ class FlowsPage extends StatelessWidget {
}
class FlowPage extends StatelessWidget {
final FlowInfo info;
final API.FlowInfo info;
const FlowPage(this.info, {super.key});
@ -64,7 +67,7 @@ class FlowPage extends StatelessWidget {
),
const Divider(),
FutureBuilder(
future: API().getActiveFlowsOf(info.id),
future: API.API().getActiveFlowsOf(info.id),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const CircularProgressIndicator();
@ -72,7 +75,15 @@ class FlowPage extends StatelessWidget {
var data = snapshot.data!;
return ListView(children: data.map((x) => Text(x.id)).toList());
return ListView(
children: data
.map((x) => ListTile(
title: Text(x.id),
onTap: () =>
Navigator.of(context).push(MaterialPageRoute(
builder: (context) => ActiveFlowPage(x),
))))
.toList());
},
)
],
@ -80,3 +91,17 @@ class FlowPage extends StatelessWidget {
);
}
}
class ActiveFlowPage extends StatelessWidget {
late API.Flow flow;
ActiveFlowPage(this.flow);
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [],
));
}
}