MAppBar constructor

MAppBar({
  1. Key? key,
  2. Widget? leading,
  3. bool automaticallyImplyLeading = true,
  4. Widget? title,
  5. String? titleText,
  6. Color? color,
  7. double? fontSize,
  8. List<Widget>? actions,
  9. Widget? flexibleSpace,
  10. PreferredSizeWidget? bottom,
  11. bool? centerTitle,
  12. Color? backgroundColor,
  13. Color? foregroundColor,
  14. double? elevation,
  15. double? toolbarHeight,
  16. VoidCallback? onBack,
  17. String? previousRoute,
  18. bool isRoot = false,
  19. String? rootName,
  20. Color? surfaceTintColor,
  21. Color? shadowColor,
  22. IconData? backIconData,
  23. double? backIconSize,
  24. double? scrolledUnderElevation,
  25. ScrollNotificationPredicate notificationPredicate = defaultScrollNotificationPredicate,
  26. ShapeBorder? shape,
  27. IconThemeData? iconTheme,
  28. IconThemeData? actionsIconTheme,
  29. bool primary = true,
  30. bool excludeHeaderSemantics = false,
  31. double? titleSpacing,
  32. double toolbarOpacity = 1.0,
  33. double bottomOpacity = 1.0,
  34. double? leadingWidth,
  35. TextStyle? toolbarTextStyle,
  36. TextStyle? titleTextStyle,
  37. SystemUiOverlayStyle? systemOverlayStyle,
  38. bool forceMaterialTransparency = false,
  39. 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,
                    ),
                  )),
      );