import 'package:flutter/material.dart';
import 'package:sk_base_mobile/util/util.dart';

class SkAppbar extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  final List<Widget>? action;
  final bool hideLeading;
  final PreferredSizeWidget? bottom;
  final Color? backgroundColor;
  final Color? iconAndTextColor;
  const SkAppbar(
      {super.key,
      required this.title,
      this.action,
      this.hideLeading = false,
      this.backgroundColor,
      this.iconAndTextColor,
      this.bottom});

  @override
  Widget build(BuildContext context) {
    return AppBar(
      titleTextStyle: TextStyle(
          color: iconAndTextColor,
          fontWeight: FontWeight.w600,
          letterSpacing: ScreenAdaper.width(2)),
      backgroundColor: backgroundColor,
      bottom: bottom,
      leading: hideLeading
          ? const SizedBox()
          : IconButton(
              icon: Icon(
                Icons.arrow_back_ios,
                size: ScreenAdaper.height(40),
                color: iconAndTextColor,
              ),
              onPressed: () {
                Navigator.pop(context);
              },
            ),
      title: Text(
        title,
        style: TextStyle(fontSize: ScreenAdaper.height(30)),
      ),
      actions: action,
    );
  }

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