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

@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:softplayer_web/models/catalog_entry.dart';
class CatalogCard extends StatelessWidget {
const CatalogCard({
super.key,
required this.data,
});
final List<CatalogEntry> data;
List<Widget> createCards(List<CatalogEntry> data) {
List<Widget> createCards = [];
for (var app in data) {
createCards.add(Card(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
//leading: Image.network(app.logoUrl),
leading: const Icon(Icons.nfc),
title: Text(app.name),
subtitle: Text(app.description),
),
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
TextButton(
child: const Text('INSTALL'),
onPressed: () {
print("installing");
},
),
const SizedBox(width: 8),
],
),
],
),
));
}
return createCards;
}
@override
Widget build(BuildContext context) {
return Column(
children: createCards(data),
);
}
}

View File

@ -2,14 +2,14 @@ import 'package:flutter/material.dart';
/// Flutter code sample for [AppBar].
class MenuPanel extends StatefulWidget implements PreferredSizeWidget {
class MenuPanel extends StatefulWidget implements PreferredSizeWidget {
final TabName tab;
MenuPanel({super.key, required this.tab}) : preferredSize = const Size.fromHeight(kToolbarHeight);
const MenuPanel({super.key, required this.tab})
: preferredSize = const Size.fromHeight(kToolbarHeight);
@override
final Size preferredSize; // default is 56.0
@override
State<StatefulWidget> createState() => _MenuPanel();
}
enum TabName { home, catalog, about }
@ -22,40 +22,49 @@ class _MenuPanel extends State<MenuPanel> {
PreferredSizeWidget build(BuildContext context) {
final TabName tab = widget.tab;
return AppBar(
title: Row(
children: [
title: Row(children: [
TextButton(
child: const Text("Softplayer"),
onPressed: () {
Navigator.pushNamed(context, "/");
}),
TextButton(
child: Text(linkHome,
style: (tab == TabName.home)? const TextStyle(decoration: TextDecoration.underline) : const TextStyle(),
TextButton(
child: Text(
linkHome,
style: (tab == TabName.home)
? const TextStyle(decoration: TextDecoration.underline)
: const TextStyle(),
),
onPressed: () {
Navigator.pushNamed(context, "/");
}),
TextButton(
child: Text(linkCatalog,
style: (tab == TabName.catalog)? const TextStyle(decoration: TextDecoration.underline) : const TextStyle(),
TextButton(
child: Text(
linkCatalog,
style: (tab == TabName.catalog)
? const TextStyle(decoration: TextDecoration.underline)
: const TextStyle(),
),
onPressed: () {
Navigator.pushNamed(context, "/catalog");
}),
TextButton(
child: Text(linkAbout,
style: (tab == TabName.about)? const TextStyle(decoration: TextDecoration.underline) : const TextStyle(),
TextButton(
child: Text(
linkAbout,
style: (tab == TabName.about)
? const TextStyle(decoration: TextDecoration.underline)
: const TextStyle(),
),
onPressed: () {
Navigator.pushNamed(context, "/about");
}),
]),
automaticallyImplyLeading: false,
actions: <Widget>[
IconButton(onPressed: () => print("acc"), icon: Icon(Icons.account_circle))
],
);
]),
automaticallyImplyLeading: false,
actions: <Widget>[
IconButton(
onPressed: () => print("acc"), icon: const Icon(Icons.account_circle))
],
backgroundColor: Colors.cyan,
);
}
}