// ignore_for_file: non_constant_identifier_names, file_names, prefer_const_constructors

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';

class CommonAppbar extends StatelessWidget implements PreferredSizeWidget {
  @override
  Size get preferredSize => Size.fromHeight(height);
  const CommonAppbar(
      {Key? key,
      required this.titleTxt,
      this.showLeading = true,
      this.customBack,
      this.backPageName = '',
      this.height = 105})
      : super(key: key);

  final String titleTxt;
  final bool? showLeading;
  final bool? customBack;
  final String? backPageName;
  final double height;
  @override
  Widget build(BuildContext context) {
    return PreferredSize(
      preferredSize: Size.fromHeight(130),
      child: AppBar(
        scrolledUnderElevation: 0.0,
        backgroundColor: Colors.black,
        elevation: 0,
        leadingWidth: 56.w,
        leading: Padding(
          padding: EdgeInsets.only(left: 16.w, top: 20.h),
          child: GestureDetector(
            onTap: () {
              customBack ?? false ? Get.toNamed(backPageName!) : Get.back();
            },
            child: Padding(
              padding: EdgeInsets.only(left: 8.w),
              child: Icon(
                Icons.arrow_back_ios,
                color: Colors.white,
                size: 25.r,
              ),
            ),
          ),
        ),
        flexibleSpace: FlexibleSpaceBar(
          centerTitle: false,
          titlePadding: EdgeInsets.all(0),
          title: Padding(
            padding: EdgeInsets.only(left: 16.w),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                Text(
                  titleTxt,
                  style: TextStyle(
                      color: Colors.white,
                      fontSize: 24.sp,
                      fontWeight: FontWeight.w500,
                      fontFamily: 'manrope'),
                  maxLines: 2,
                  softWrap: true,
                ),
                // newTextfield(
                //     FontWeight.w400, 0)
              ],
            ),
          ),
        ),
      ),
    );
  }
}
