Files
Traders_Circuit/lib/Utils/Common/CommonAppBar.dart
2024-03-19 22:57:32 -07:00

102 lines
2.9 KiB
Dart

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 => const Size.fromHeight(70);
const CommonAppbar({
Key? key,
required this.titleTxt,
this.showLeading = true,
this.customActionWidget,
this.onCustomActionPressed,
// this.calendarWidget = true,
required Size preferredSize,
this.showEdit = false,
this.customBack,
this.editPageName,
this.customleading,
}) : super(key: key);
final String titleTxt;
final bool? showLeading;
final Widget? customActionWidget;
final Widget? customleading;
// final bool? calendarWidget;
final VoidCallback? onCustomActionPressed;
final bool? showEdit;
final bool? customBack;
final String? editPageName;
@override
Widget build(BuildContext context) {
return AppBar(
scrolledUnderElevation: 0.0,
backgroundColor: Colors.black,
elevation: 0,
automaticallyImplyLeading: false,
titleSpacing: 0,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
titleTxt,
softWrap: true,
overflow: TextOverflow.visible,
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: 'DM Sans',
fontSize: 18.sp,
fontWeight: FontWeight.w500,
color: Color(0xFF090909),
),
),
),
],
),
),
leading: showLeading!
? InkWell(
onTap: () {
Get.back();
},
child: Icon(
Icons.arrow_back,
color: Color(0xFFFFFFFF),
size: 27,
),
)
: customleading,
actions: [
// if (calendarWidget == true)
// InkWell(
// onTap: onCustomActionPressed,
// child: Padding(
// padding: EdgeInsets.only(right: 14.w),
// child: Icon(
// Icons.calendar_month_outlined,
// color: Color(0xFF3192D8),
// size: 28,
// ),
// ),
// ),
if (customActionWidget != null)
InkWell(
onTap: onCustomActionPressed,
child: Padding(
padding: EdgeInsets.only(right: 14.w),
child: customActionWidget,
),
),
],
);
}
}