getDefaultHeader function
Widget
getDefaultHeader(
- BuildContext context,
- String title, {
- Function? function,
- ValueChanged<
String> ? funChange, - bool withFilter = false,
- Function? filterFun,
- bool isShowBack = false,
- bool isBackQuestion = false,
- TextEditingController? searchController,
- FocusNode? searchFocusNode,
- dynamic backResult,
- void addOnTap()?,
- Function? searchOnBlur,
Implementation
Widget getDefaultHeader(
BuildContext context,
String title, {
Function? function,
ValueChanged<String>? funChange,
bool withFilter = false,
Function? filterFun,
bool isShowBack = false,
bool isBackQuestion = false,
TextEditingController? searchController,
FocusNode? searchFocusNode,
dynamic backResult,
void Function()? addOnTap,
Function? searchOnBlur,
}) {
double appbarPadding = MahasDimensions.getAppBarPadding();
double toolbarHeight = MahasDimensions.getToolbarHeight(context);
return Container(
color: MahasColors.primaryColor,
child: Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.only(
top: MahasDimensions.getToolbarTopHeight(context),
left: appbarPadding,
right: appbarPadding),
height: toolbarHeight,
child: Stack(
children: [
Visibility(
visible: isShowBack,
child: Align(
alignment: Alignment.centerLeft,
child: SizedBox(
height: double.infinity,
child: InkWell(
onTap: () {
if (isBackQuestion) {
MahasDialog.getBackDialog(backResult: backResult);
} else {
Get.back(result: backResult);
}
},
child: getIcon(
'arrow_left',
color: MahasColors.whiteColor,
size: MahasDimensions.getHeightPercentSize(
MahasDimensions.fontSizeExtraLarge),
),
),
),
),
),
Center(
child: getCustomText(
title,
align: TextAlign.center,
weight: FontWeight.bold,
color: MahasColors.whiteColor,
size: MahasDimensions.getHeightPercentSize(
MahasDimensions.fontSizeLarge),
),
),
Visibility(
visible: addOnTap != null,
child: Align(
alignment: Alignment.centerRight,
child: SizedBox(
height: double.infinity,
child: InkWell(
onTap: addOnTap,
child: getIcon(
'add_circle',
color: MahasColors.whiteColor,
size: MahasDimensions.getHeightPercentSize(
MahasDimensions.fontSizeExtraLarge),
),
),
),
),
),
],
),
),
if (searchController != null && searchFocusNode != null)
Container(
margin: EdgeInsets.only(
right: appbarPadding,
left: appbarPadding,
bottom: appbarPadding / 2),
child: getTextField(
searchController,
focusNode: searchFocusNode,
hint: "Search",
icon: "search",
colorSet: MahasColors.whiteColor,
rightIcon: filterFun != null ? "filter" : null,
rightIconFieldFunction: filterFun,
onBlur: searchOnBlur,
),
)
else
getSpaceWidth(0),
],
),
);
}