GlassButton.custom constructor

const GlassButton.custom({
  1. required Widget? child,
  2. required VoidCallback onTap,
  3. Key? key,
  4. String label = '',
  5. double width = 56,
  6. double height = 56,
  7. LiquidShape shape = const LiquidOval(),
  8. LiquidGlassSettings? settings,
  9. bool useOwnLayer = false,
  10. GlassQuality quality = GlassQuality.standard,
  11. double interactionScale = 1.05,
  12. double stretch = 0.5,
  13. double resistance = 0.08,
  14. HitTestBehavior stretchHitTestBehavior = HitTestBehavior.opaque,
  15. Color glowColor = Colors.white24,
  16. double glowRadius = 1.0,
  17. HitTestBehavior glowHitTestBehavior = HitTestBehavior.opaque,
  18. bool enabled = true,
  19. GlassButtonStyle style = GlassButtonStyle.filled,
})

Creates a glass button with custom content.

This allows you to use any widget as the button's content instead of just an icon. Useful for text buttons, composite content, etc.

Example:

GlassButton.custom(
  onTap: () {},
  width: 120,
  height: 48,
  child: Row(
    mainAxisAlignment: MainAxisAlignment.center,
    children: [
      Icon(CupertinoIcons.play, size: 16),
      SizedBox(width: 8),
      Text('Play'),
    ],
  ),
)

Implementation

const GlassButton.custom({
  required this.child,
  required this.onTap,
  super.key,
  this.label = '',
  this.width = 56,
  this.height = 56,
  this.shape = const LiquidOval(),
  this.settings,
  this.useOwnLayer = false,
  this.quality = GlassQuality.standard,
  // LiquidStretch properties
  this.interactionScale = 1.05,
  this.stretch = 0.5,
  this.resistance = 0.08,
  this.stretchHitTestBehavior = HitTestBehavior.opaque,
  // GlassGlow properties
  this.glowColor = Colors.white24,
  this.glowRadius = 1.0,
  this.glowHitTestBehavior = HitTestBehavior.opaque,
  this.enabled = true,
  this.style = GlassButtonStyle.filled,
})  : icon = null,
      iconSize = 24.0,
      iconColor = Colors.white;