header.dart 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // ignore_for_file: file_names
  2. import 'package:flutter/material.dart';
  3. import 'package:go_router/go_router.dart';
  4. class Header extends StatelessWidget implements PreferredSizeWidget {
  5. final Text title;
  6. final AppBar appBar;
  7. final List<Widget> widgets;
  8. /// you can add more fields that meet your needs
  9. const Header(
  10. {super.key,
  11. required this.title,
  12. required this.appBar,
  13. required this.widgets});
  14. @override
  15. Widget build(BuildContext context) {
  16. return AppBar(
  17. backgroundColor: Colors.white,
  18. leading: Icon(Icons.bug_report),
  19. titleSpacing: 0,
  20. title: Text(
  21. 'Bug Listing',
  22. style: TextStyle(fontSize: 28, fontWeight: FontWeight.w500),
  23. ),
  24. actions: [
  25. //todo hide kalo non login
  26. ElevatedButton(
  27. onPressed: () => context.go('/'),
  28. style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
  29. child: Text(
  30. 'Home',
  31. style: TextStyle(color: Colors.black),
  32. )),
  33. ElevatedButton(
  34. onPressed: () => context.go('/listplatform'),
  35. style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
  36. child: Text(
  37. 'Platform',
  38. style: TextStyle(color: Colors.black),
  39. ),
  40. ),
  41. ElevatedButton(
  42. onPressed: () => context.go('/maintenance'),
  43. style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
  44. child: Text(
  45. 'Maintenance',
  46. style: TextStyle(color: Colors.black),
  47. ),
  48. ),
  49. Padding(
  50. padding: const EdgeInsets.all(8.0),
  51. child: Text('Log Out'),
  52. ),
  53. ],
  54. );
  55. }
  56. @override
  57. Size get preferredSize => Size.fromHeight(appBar.preferredSize.height);
  58. }