import 'package:cims_apps/application/component/button/back_button_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:flutter/material.dart';

class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
  final Widget? leading;
  final String title;
  final List<Widget>? trailing;
  final double height;

  const CustomAppBar({
    Key? key,
    required this.height,
    this.leading,
    required this.title,
    this.trailing,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 24),
      decoration: BoxDecoration(
          border: Border(bottom: BorderSide(color: ColorPalette.slate200))
      ),
      child: AppBar(
        toolbarHeight: 70,
        backgroundColor: Colors.white,
        surfaceTintColor: Colors.white,
        automaticallyImplyLeading: false,
        leadingWidth: 40,
        leading: leading ?? BackButtonView(),
        title: Text(title),
        centerTitle: true,
        actions: trailing ?? [],
      ),
    );
  }

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