import 'package:flutter/material.dart';
import 'package:mohem_flutter_app/classes/colors.dart';
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';

AppBar AppBarWidget(BuildContext context, {required String title, bool showHomeButton = false}) {
  return AppBar(
    leadingWidth: 0,
    // leading: GestureDetector(
    //   behavior: HitTestBehavior.opaque,
    //   onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
    //   child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
    // ),
    //titleSpacing: -1.44,
    title: Row(
      children: [
        GestureDetector(
          behavior: HitTestBehavior.opaque,
          onTap: Feedback.wrapForTap(() => Navigator.maybePop(context), context),
          child: const Icon(Icons.arrow_back_ios, color: MyColors.darkIconColor),
        ),
        4.width,
        title.toText24(color: MyColors.darkTextColor, isBold: true, considerHeight: false).expanded,
      ],
    ),
    centerTitle: false,
    elevation: 0,
    backgroundColor: Colors.white,
    actions: [
      if (showHomeButton)
        IconButton(
          onPressed: () {
            // Navigator.pushAndRemoveUntil(
            //   context,
            //   MaterialPageRoute(builder: (context) => LandingPage()),
            //       (Route<dynamic> route) => false,
            // );
          },
          icon: const Icon(Icons.home, color: MyColors.darkIconColor),
        ),
    ],
  );
}
