getNoramlAppBar static method

PreferredSize getNoramlAppBar({
  1. required BuildContext context,
  2. required String title,
  3. List<Widget>? actions,
  4. Widget? titlew,
  5. Widget? leading,
  6. bool showback = true,
  7. double elevation = 0,
  8. double prferredheight = -1,
  9. PreferredSizeWidget? bottom,
  10. Color? textColor,
  11. Color? leadingIconColor,
  12. Color? backgroundColor,
  13. dynamic leadingCallback()?,
})

Implementation

static PreferredSize getNoramlAppBar(
    {required BuildContext context,
    required String title,
    List<Widget>? actions,
    Widget? titlew,
    Widget? leading,
    bool showback = true,
    double elevation = 0,
    double prferredheight = -1,
    PreferredSizeWidget? bottom,
    Color? textColor,
    Color? leadingIconColor,
    Color? backgroundColor,
    Function()? leadingCallback}) {
  final ModalRoute<dynamic>? parentRoute = ModalRoute.of(context);
  bool canshowback = parentRoute?.canPop ?? false;
  if (prferredheight == -1) {
    prferredheight = 54;
  }

  backgroundColor ??= CommentColorS.colffffff;
  return PreferredSize(
    preferredSize: Size.fromHeight(prferredheight),
    child: AppBar(
      backgroundColor: backgroundColor,
      centerTitle: true,
      actions: actions,
      leading: showback
          ? (canshowback
              ? (leading ??
                  IconButton(
                    icon: Icon(
                      Icons.arrow_back_ios,
                      color: leadingIconColor ?? CommentColorS.col101010,
                    ),
                    onPressed:
                        leadingCallback ?? () => Navigator.of(context).pop(),
                  ))
              : null)
          : null,
      title: titlew ??
          Text(
            title,
            style: TextStyle(
              fontSize: 18,
              color: textColor ?? CommentColorS.col101010,
            ),
          ),
      elevation: elevation,
      bottom: bottom,
      automaticallyImplyLeading: showback,
    ),
  );
}