import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

class Header extends StatelessWidget implements PreferredSizeWidget {
  final Text title;
  final AppBar appBar;
  final List<Widget> widgets;

  const Header(
      {super.key,
      required this.title,
      required this.appBar,
      required this.widgets});

  @override
  Widget build(BuildContext context) {
    return AppBar(
      backgroundColor: Colors.white,
      leading: Icon(Icons.bug_report),
      titleSpacing: 0,
      title: Text(
        'Bug Listing',
        style: TextStyle(fontSize: 28, fontWeight: FontWeight.w500),
      ),
      actions: [
        //todo hide kalo non login
        ElevatedButton(
            onPressed: () => context.go('/'),
            style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
            child: Text(
              'Home',
              style: TextStyle(color: Colors.black),
            )),
        ElevatedButton(
          onPressed: () => context.go('/listplatform'),
          style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
          child: Text(
            'Platform',
            style: TextStyle(color: Colors.black),
          ),
        ),
        ElevatedButton(
          onPressed: () => context.go('/maintenance'),
          style: ElevatedButton.styleFrom(surfaceTintColor: Colors.white),
          child: Text(
            'Maintenance',
            style: TextStyle(color: Colors.black),
          ),
        ),
        Text('Log Out'),
      ],
    );
  }

  @override
  Size get preferredSize => Size.fromHeight(appBar.preferredSize.height);
}