simple static method
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,
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,
)),
);
}