Start developping the frontend
This commit is contained in:
61
lib/components/menubar.dart
Normal file
61
lib/components/menubar.dart
Normal file
@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// Flutter code sample for [AppBar].
|
||||
|
||||
class MenuPanel extends StatefulWidget implements PreferredSizeWidget {
|
||||
final TabName tab;
|
||||
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 }
|
||||
|
||||
class _MenuPanel extends State<MenuPanel> {
|
||||
final String linkCatalog = "catalog";
|
||||
final String linkAbout = "about";
|
||||
final String linkHome = "home";
|
||||
@override
|
||||
PreferredSizeWidget build(BuildContext context) {
|
||||
final TabName tab = widget.tab;
|
||||
return AppBar(
|
||||
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(),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, "/");
|
||||
}),
|
||||
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(),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(context, "/about");
|
||||
}),
|
||||
]),
|
||||
automaticallyImplyLeading: false,
|
||||
actions: <Widget>[
|
||||
IconButton(onPressed: () => print("acc"), icon: Icon(Icons.account_circle))
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user