GradientTextButton constructor
GradientTextButton({
- Key? key,
- required VoidCallback? onPressed,
- Color? splashColor,
- VoidCallback? onLongPress,
- ButtonStyle? style,
- FocusNode? focusNode,
- bool autofocus = false,
- Clip clipBehavior = Clip.none,
- required Gradient gradient,
- required Widget child,
- EdgeInsetsGeometry padding = const EdgeInsets.all(8),
Create a TextButton.
The autofocus
and clipBehavior
arguments must not be null.
Implementation
GradientTextButton({
Key? key,
required VoidCallback? onPressed,
Color? splashColor,
VoidCallback? onLongPress,
ButtonStyle? style,
FocusNode? focusNode,
bool autofocus = false,
Clip clipBehavior = Clip.none,
required Gradient gradient,
required Widget child,
EdgeInsetsGeometry padding = const EdgeInsets.all(8),
}) : super(
key: key,
onPressed: onPressed,
onLongPress: onLongPress,
style: style ??
ButtonStyle(
overlayColor: ButtonStyleButton.allOrNull(splashColor ??
gradient.colors.elementAt(0).withOpacity(0.1))),
focusNode: focusNode,
autofocus: autofocus,
clipBehavior: clipBehavior,
child: Padding(
padding: style?.padding != null ? EdgeInsets.zero : padding,
child: ShaderMask(
shaderCallback: (Rect bounds) => gradient.createShader(
Rect.fromLTWH(0, 0, bounds.width, bounds.height),
),
blendMode: BlendMode.srcIn,
child: child,
),
),
);