simple static method

GetSimpleAppBar simple({
  1. Widget? leading,
  2. Widget? bottom,
  3. Widget? flexibleSpace,
  4. List<Widget>? actions,
  5. LinearProgress? progress,
  6. Widget? customTitle,
  7. String? title,
  8. TextStyle? titleStyle,
  9. ShapeBorder? shape,
  10. Color? backgroundColor,
  11. bool? centerTitle,
  12. bool interactive = true,
  13. bool showLeading = true,
  14. bool? showProgress,
  15. double? elevation,
  16. double? toolbarHeight,
  17. double bottomHeight = 0.0,
  18. double bottomConstant = 48.0,
  19. double? leadingWidth,
  20. double? titleSpacing,
})

Implementation

static GetSimpleAppBar simple({
  Widget? leading,
  Widget? bottom,
  Widget? flexibleSpace,
  List<Widget>? actions,
  LinearProgress? progress,
  Widget? customTitle,
  String? title,
  TextStyle? titleStyle,
  ShapeBorder? shape,
  Color? backgroundColor,
  bool? centerTitle,
  bool interactive = true,
  bool showLeading = true,
  bool? showProgress,
  double? elevation,
  double? toolbarHeight,
  double bottomHeight = 0.0,
  double bottomConstant = 48.0,
  double? leadingWidth,
  double? titleSpacing,
}) {
  final _actions = interactive ? actions : null;
  final _progress = progress ??
      (showProgress != null ? LinearProgress(visible: showProgress) : null);
  final _toolbarHeight = toolbarHeight ??
      (Get.isIOS ? kMinInteractiveDimensionCupertino : kToolbarHeight);
  final _bottomHeight = (_progress?.height ?? 0) +
      (bottom == null ? 0 : bottomHeight + bottomConstant);
  return PreferredSize(
    preferredSize: Size.fromHeight(_toolbarHeight + _bottomHeight),
    child: ThemeBuilder((context) => AppBar(
          centerTitle:
              context.appBarCenterTitle(centerTitle, actions: _actions),
          automaticallyImplyLeading: false,
          titleTextStyle: context.appBarTheme.titleTextStyle?.copyWith(
            fontSize: titleStyle?.fontSize,
            color: titleStyle?.color,
            fontWeight: titleStyle?.fontWeight,
            fontFamily: titleStyle?.fontFamily,
          ),
          flexibleSpace: flexibleSpace,
          shape: shape,
          elevation: elevation,
          backgroundColor: backgroundColor,
          leading: showLeading ? leading ?? GetButton.back() : null,
          leadingWidth: leadingWidth ?? (leading == null ? 40.0 : null),
          titleSpacing: titleSpacing ??
              (showLeading ? kDensePaddingX : kStandardPaddingX),
          toolbarHeight: _toolbarHeight,
          title: customTitle ??
              (title != null ? Text(title) : Container(height: 0)),
          bottom: PreferredSize(
            preferredSize: Size.fromHeight(_bottomHeight),
            child: Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                if (bottom != null) bottom,
                if (_progress != null) _progress,
              ],
            ),
          ),
          actions: _actions,
        )),
  );
}