outlined static method

Widget outlined({
  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? backgroundColor,
  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. required Widget child,
})

Create an outlined button.

Implementation

static Widget outlined({
  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? backgroundColor,
  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,
  required Widget child,
}) =>
    Builder(
      builder: (context) {
        return Container(
          margin: margin ??
              (horizontalMargin != null || verticalMargin != null
                  ? EdgeInsets.symmetric(
                      horizontal: horizontalMargin ?? 0,
                      vertical: verticalMargin ?? 0,
                    )
                  : null),
          child: OutlinedButton(
            key: key,
            onPressed: enabled
                ? busy
                    ? () {}
                    : () {
                        onPressed?.call();
                        if (back) Get.back();
                      }
                : null,
            onLongPress: onLongPress,
            style: OutlinedButton.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,
              backgroundColor: backgroundColor,
              onSurface: onSurface,
              elevation: elevation,
              textStyle: textStyle,
            ),
            focusNode: focusNode,
            autofocus: autofocus,
            clipBehavior: clipBehavior ?? Clip.none,
            child: busy
                ? CircularProgress.small(
                    color: primary ?? context.outlinedButtonForegroundColor,
                  )
                : child,
          ),
        );
      },
    );