Start developping the catalog

This commit is contained in:
2024-03-27 22:07:53 +01:00
parent d5b2ef18ab
commit 3cc8edfc8c
11 changed files with 202 additions and 54 deletions

View File

@ -13,7 +13,7 @@ class _AboutPage extends State<AboutPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MenuPanel(tab: TabName.about,),
appBar: const MenuPanel(tab: TabName.about),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,

View File

@ -1,5 +1,8 @@
import 'package:flutter/material.dart';
import 'package:softplayer_web/api/third_party/chartmuseum.dart';
import 'package:softplayer_web/components/catalog_card.dart';
import 'package:softplayer_web/components/menubar.dart';
import 'package:softplayer_web/models/catalog_entry.dart';
class CatalogPage extends StatefulWidget {
const CatalogPage({super.key});
@ -10,36 +13,68 @@ class CatalogPage extends StatefulWidget {
}
class _CatalogPage extends State<CatalogPage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
late Future<List<HelmChart>> helmChart;
@override
void initState() {
super.initState();
helmChart = fetchCharts();
}
final List<CatalogEntry> catalog = [
CatalogEntry(
name: "openvpn",
description: "you know what I mean",
logoUrl:
"https://upload.wikimedia.org/wikipedia/commons/f/f5/OpenVPN_logo.svg"),
CatalogEntry(
name: "openvpn",
description: "you know what I mean",
logoUrl:
"https://upload.wikimedia.org/wikipedia/commons/f/f5/OpenVPN_logo.svg"),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MenuPanel(tab: TabName.catalog),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
print(helmChart);
return SelectionArea(
child: Scaffold(
appBar: const MenuPanel(tab: TabName.catalog),
body: Container(
margin: const EdgeInsets.all(14),
child: Container(
child: Row(children: <Widget>[
const SizedBox(
width: 200,
child: Card(
child: Column(
children: <Widget>[Text("Filter")],
))),
Flexible(
child: Column(
children: <Widget>[
const TextField(
decoration: InputDecoration(
icon: Icon(Icons.search),
labelText: "Search",
),
autofocus: true,
),
CatalogCard(data: catalog),
FutureBuilder(
future: helmChart,
builder: (context, snapshot) {
print(snapshot);
if (snapshot.hasData) {
return Text(snapshot.data!.first.name);
} else if (snapshot.hasError) {
return SelectableText('${snapshot.error}');
}
return const CircularProgressIndicator();
}),
],
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
)
])),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment v rot',
child: const Icon(Icons.hd),
),
);
));
}
}

View File

@ -20,7 +20,7 @@ class _HomePage extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: MenuPanel(tab: TabName.home),
appBar: const MenuPanel(tab: TabName.home),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,