MAppBar constructor
MAppBar({
- Key? key,
- Widget? leading,
- bool automaticallyImplyLeading = true,
- Widget? title,
- String? titleText,
- Color? color,
- double? fontSize,
- List<
Widget> ? actions, - Widget? flexibleSpace,
- PreferredSizeWidget? bottom,
- bool? centerTitle,
- Color? backgroundColor,
- Color? foregroundColor,
- double? elevation,
- double? toolbarHeight,
- VoidCallback? onBack,
- String? previousRoute,
- bool isRoot = false,
- String? rootName,
- Color? surfaceTintColor,
- Color? shadowColor,
- IconData? backIconData,
- double? backIconSize,
- double? scrolledUnderElevation,
- ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
- ShapeBorder? shape,
- IconThemeData? iconTheme,
- IconThemeData? actionsIconTheme,
- bool primary = true,
- bool excludeHeaderSemantics = false,
- double? titleSpacing,
- double toolbarOpacity = 1.0,
- double bottomOpacity = 1.0,
- double? leadingWidth,
- TextStyle? toolbarTextStyle,
- TextStyle? titleTextStyle,
- SystemUiOverlayStyle? systemOverlayStyle,
- bool forceMaterialTransparency = false,
- Clip? clipBehavior,
Implementation
MAppBar({
super.key,
Widget? leading,
super.automaticallyImplyLeading = true,
Widget? title,
String? titleText,
Color? color,
double? fontSize,
super.actions,
super.flexibleSpace,
super.bottom,
super.centerTitle,
super.backgroundColor,
super.foregroundColor,
super.elevation,
super.toolbarHeight,
VoidCallback? onBack,
String? previousRoute,
bool isRoot = false,
String? rootName,
super.surfaceTintColor,
super.shadowColor,
IconData? backIconData,
double? backIconSize,
super.scrolledUnderElevation,
super.notificationPredicate = defaultScrollNotificationPredicate,
super.shape,
super.iconTheme,
super.actionsIconTheme,
super.primary = true,
super.excludeHeaderSemantics = false,
super.titleSpacing,
super.toolbarOpacity = 1.0,
super.bottomOpacity = 1.0,
super.leadingWidth,
super.toolbarTextStyle,
super.titleTextStyle,
super.systemOverlayStyle,
super.forceMaterialTransparency = false,
super.clipBehavior,
}) : super(
title: titleText == null
? title
: MText(
titleText,
style: Get.theme.appBarTheme.titleTextStyle?.copyWith(
fontSize: fontSize,
color: color ?? foregroundColor,
),
),
leading: leading ??
(isRoot
? null
// TODO: 为什么放 AppBar 上和 IconButton 的点击大小会不一样?
: MIconButton(
onPressed: onBack ?? () => Get.back(),
icon: Icon(
backIconData ?? Icons.arrow_back_ios_new_rounded,
size: backIconSize ?? 18,
color: foregroundColor,
),
)),
);