elevated static method

Widget elevated({
  1. Key? key,
  2. VoidCallback? onPressed,
  3. VoidCallback? onLongPress,
  4. Size? minimumSize,
  5. EdgeInsetsGeometry? padding,
  6. double? horizontalPadding = 24,
  7. double? verticalPadding,
  8. EdgeInsetsGeometry? margin,
  9. double? horizontalMargin,
  10. double? verticalMargin,
  11. OutlinedBorder? shape,
  12. BorderSide? side,
  13. Color? primary,
  14. Color? onPrimary,
  15. Color? onSurface,
  16. double? elevation,
  17. TextStyle? textStyle,
  18. FocusNode? focusNode,
  19. bool back = false,
  20. bool? autofocus = false,
  21. bool round = false,
  22. bool enabled = true,
  23. bool busy = false,
  24. Clip? clipBehavior = Clip.none,
  25. Widget? child,
})

Create an elevated button.

Implementation

static Widget elevated({
  Key? key,
  VoidCallback? onPressed,
  VoidCallback? onLongPress,
  Size? minimumSize,
  EdgeInsetsGeometry? padding,
  double? horizontalPadding = 24,
  double? verticalPadding,
  EdgeInsetsGeometry? margin,
  double? horizontalMargin,
  double? verticalMargin,
  OutlinedBorder? shape,
  BorderSide? side,
  Color? primary,
  Color? onPrimary,
  Color? onSurface,
  double? elevation,
  TextStyle? textStyle,
  FocusNode? focusNode,
  bool back = false,
  bool? autofocus = false,
  bool round = false,
  bool enabled = true,
  bool busy = false,
  Clip? clipBehavior = Clip.none,
  Widget? child,
}) =>
    Builder(
      builder: (context) => Container(
        margin: margin ??
            (horizontalMargin != null || verticalMargin != null
                ? EdgeInsets.symmetric(
                    horizontal: horizontalMargin ?? 0,
                    vertical: verticalMargin ?? 0,
                  )
                : null),
        child: ElevatedButton(
          key: key,
          onPressed: enabled
              ? busy
                  ? () {}
                  : () {
                      onPressed?.call();
                      if (back) Get.back();
                    }
              : null,
          onLongPress: onLongPress,
          style: ElevatedButton.styleFrom(
            minimumSize: minimumSize,
            padding: padding ??
                (horizontalPadding != null || verticalPadding != null
                    ? EdgeInsets.symmetric(
                        horizontal: horizontalPadding ?? 0,
                        vertical: verticalPadding ?? 0,
                      )
                    : null),
            shape: shape ??
                (round == true
                    ? RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(30),
                      )
                    : null),
            side: side,
            primary: primary,
            onPrimary: onPrimary,
            onSurface: onSurface,
            elevation: elevation,
            textStyle: textStyle,
          ),
          focusNode: focusNode,
          autofocus: autofocus ?? false,
          clipBehavior: clipBehavior ?? Clip.none,
          child: busy
              ? CircularProgress.small(
                  color: onPrimary ?? context.elevatedButtonForegroundColor,
                )
              : child,
        ),
      ),
    );