Start developping the catalog
This commit is contained in:
49
lib/components/catalog_card.dart
Normal file
49
lib/components/catalog_card.dart
Normal 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),
|
||||
);
|
||||
}
|
||||
}
|
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user