import 'package:flutter/material.dart'; /// Flutter code sample for [AppBar]. class MenuPanel extends StatefulWidget implements PreferredSizeWidget { final TabName tab; const MenuPanel({super.key, required this.tab}) : preferredSize = const Size.fromHeight(kToolbarHeight); @override final Size preferredSize; // default is 56.0 @override State createState() => _MenuPanel(); } enum TabName { home, catalog, about } class _MenuPanel extends State { 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: [ IconButton( onPressed: () => print("acc"), icon: const Icon(Icons.account_circle)) ], backgroundColor: Colors.cyan, ); } }