getCustomAppBarWithSearch method

dynamic getCustomAppBarWithSearch(
  1. BuildContext context, {
  2. required String appBarTitle,
  3. required Function onBackButtonPress,
  4. required dynamic onSearchValueChanged(
    1. String
    ),
  5. TextEditingController? controller,
  6. String? hintText,
  7. Color? backgroundColor,
  8. double? elevation,
  9. bool? centerTitle,
  10. List<Widget>? actions,
  11. Widget? icon,
  12. Widget? titleWidget,
  13. bool? isIconVisible,
})

Implementation

getCustomAppBarWithSearch(BuildContext context,
    {required String appBarTitle,
    required Function onBackButtonPress,
    required Function(String) onSearchValueChanged,
    TextEditingController? controller,
    String? hintText,
    Color? backgroundColor,
    double? elevation,
    bool? centerTitle,
    List<Widget>? actions,
    Widget? icon,
    Widget? titleWidget,
    bool? isIconVisible}) {
  return CustomPrefferedSizedWidget(
    height: 120,
    child: Column(
      mainAxisSize: MainAxisSize.min,
      children: [
        AppBar(
          iconTheme: IconThemeData(
            color: AppColors.appColorBlack85, //change your color here
          ),
          title: titleWidget ??
              Text(
                appBarTitle,
                style: TextStyleElements.headline6
                    .copyWith(fontWeight: FontWeight.w600),
              ),
          backgroundColor: backgroundColor ??= AppColors.appColorTransparent,
          elevation: elevation ??= 0.0,
          leading: Visibility(
              visible: isIconVisible ??= true,
              child: IconButton(
                icon: icon ??= const Icon(
                  Icons.keyboard_backspace_rounded,
                  // add custom icons also
                ),
                onPressed: onBackButtonPress as void Function()?,
              )),
          actions: actions,
          centerTitle: centerTitle ??= true,
        ),
        SearchBox(
          controller: controller,
          onvalueChanged: onSearchValueChanged,
          hintText: hintText ??= "Search",
        )
      ],
    ),
  );
}