PremiumButton class

A premium button component with modern styling and animations.

Features:

  • Multiple style variants (filled, outlined, ghost, gradient, glass, glow, neumorphic)
  • Size presets (xs, sm, md, lg, xl)
  • Icon support (leading and trailing)
  • Loading state with spinner
  • Disabled state
  • Press and hover animations
  • Haptic feedback support
  • Full customization via ModernStyleOptions

Example usage:

PremiumButton(
  label: 'Continue',
  variant: PremiumButtonVariant.gradient,
  size: PremiumButtonSize.lg,
  leadingIcon: Icons.arrow_forward,
  onPressed: () => handleContinue(),
)
Inheritance

Constructors

PremiumButton({Key? key, String? label, Widget? child, IconData? leadingIcon, IconData? trailingIcon, Widget? leading, Widget? trailing, VoidCallback? onPressed, VoidCallback? onLongPress, PremiumButtonVariant variant = PremiumButtonVariant.filled, PremiumButtonSize size = PremiumButtonSize.md, bool isLoading = false, bool isDisabled = false, Color? color, Color? textColor, Gradient? gradient, double? borderRadius, bool fullWidth = false, double? width, double? height, EdgeInsetsGeometry? padding, double elevation = 0, bool hapticFeedback = true, bool isDarkMode = true, double pressedScale = 0.96, Duration animationDuration = const Duration(milliseconds: 150), ModernStyleOptions? styleOptions, String? tooltip})
const

Properties

animationDuration Duration
Duration of press animation.
final
borderRadius double?
Border radius override.
final
child Widget?
Child widget (alternative to label).
final
color Color?
Primary color for the button.
final
elevation double
Custom elevation.
final
fullWidth bool
Whether to use full-width button.
final
gradient Gradient?
Custom gradient (for gradient variant).
final
hapticFeedback bool
Whether to enable haptic feedback.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
Custom height.
final
isDarkMode bool
Whether to use dark mode styling.
final
isDisabled bool
Whether the button is disabled.
final
isLoading bool
Whether the button is in loading state.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label String?
Button label text.
final
leading Widget?
Custom leading widget.
final
leadingIcon IconData?
Icon to display before the label.
final
onLongPress VoidCallback?
Callback when button is long pressed.
final
onPressed VoidCallback?
Callback when button is pressed.
final
padding EdgeInsetsGeometry?
Custom padding.
final
pressedScale double
Scale factor when pressed.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size PremiumButtonSize
Size preset.
final
styleOptions ModernStyleOptions?
Custom style options.
final
textColor Color?
Text color.
final
tooltip String?
Tooltip text.
final
trailing Widget?
Custom trailing widget.
final
trailingIcon IconData?
Icon to display after the label.
final
variant PremiumButtonVariant
Style variant.
final
width double?
Custom width.
final

Methods

createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() State<PremiumButton>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited