text static method
Widget
text({
- 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,
Create a text button.
Implementation
static Widget text({
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) => Container(
margin: margin ??
(horizontalMargin != null || verticalMargin != null
? EdgeInsets.symmetric(
horizontal: horizontalMargin ?? 0,
vertical: verticalMargin ?? 0,
)
: null),
child: TextButton(
key: key,
onPressed: enabled
? busy
? () {}
: () {
onPressed?.call();
if (back) Get.back();
}
: null,
onLongPress: onLongPress,
style: TextButton.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,
child: busy
? CircularProgress.small(
color: primary ?? context.textButtonForegroundColor,
)
: child,
),
),
);