import 'package:car_provider_app/theme/colors.dart';
import 'package:car_provider_app/extensions/string_extensions.dart';
import 'package:car_provider_app/extensions/int_extensions.dart';
import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';

AppBar appBar(
  BuildContext context, {
  Color? backgroundColor,
  double? elevation,
  String? title,
  Color? titleColor,
  bool? isTitleCenter,
  Color? backIconColor,
  List<Widget>? actions,
  bool isRemoveBackButton = false,
}) {
  return AppBar(
    backgroundColor: backgroundColor ?? appBackgroundColor,
    elevation: elevation ?? 0,
    centerTitle: isTitleCenter ?? true,
    leading: isRemoveBackButton
        ? null
        : IconButton(
            icon: Icon(Icons.arrow_back_ios, color: Colors.black),
            onPressed: () => Navigator.of(context).pop(),
          ),
    iconTheme: IconThemeData(
      color: backIconColor ?? Colors.black, //change your color here
    ),
    actions: actions,
    title: (title ?? "").toText(fontSize: 20, isBold: true),
  );
}
