header.dart 1.6 KB

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