GlassButton constructor

const GlassButton({
  1. required Widget? icon,
  2. required VoidCallback onTap,
  3. Key? key,
  4. String label = '',
  5. double? width = 56,
  6. double? height = 56,
  7. double iconSize = 24.0,
  8. Color? iconColor,
  9. LiquidShape shape = const LiquidOval(),
  10. LiquidGlassSettings? settings,
  11. bool useOwnLayer = false,
  12. GlassQuality? quality,
  13. GlassSurfaceStyle? surfaceStyle,
  14. Color? color,
  15. Color? tintColor,
  16. FocusNode? focusNode,
  17. bool autofocus = false,
  18. double? interactionScale,
  19. double stretch = 0.5,
  20. double resistance = 0.01,
  21. HitTestBehavior stretchHitTestBehavior = HitTestBehavior.opaque,
  22. Color? glowColor,
  23. double? glowRadius,
  24. double? glowBlurRadius,
  25. double? glowSpreadRadius,
  26. double? glowOpacity,
  27. HitTestBehavior glowHitTestBehavior = HitTestBehavior.opaque,
  28. bool enabled = true,
  29. GlassButtonStyle style = GlassButtonStyle.filled,
  30. bool persistPressOnDrag = true,
  31. bool anchorStretch = true,
  32. AnchorStretchSettings? anchorStretchSettings,
  33. AlignmentGeometry alignment = Alignment.center,
  34. double? ambientBaseLight,
  35. Color? pressLightColor,
  36. bool platformViewBackdrop = false,
  37. bool canRequestFocus = true,
  38. bool excludeFromSemantics = false,
  39. bool isStationary = false,
})

Creates a glass button with an icon.

Implementation

const GlassButton({
  required this.icon,
  required this.onTap,
  super.key,
  this.label = '',
  this.width = 56,
  this.height = 56,
  this.iconSize = 24.0,
  this.iconColor,
  this.shape = const LiquidOval(),
  this.settings,
  this.useOwnLayer = false,
  this.quality,
  this.surfaceStyle,
  this.color,
  this.tintColor,
  this.focusNode,
  this.autofocus = false,
  // LiquidStretch properties
  this.interactionScale,
  this.stretch = 0.5,
  this.resistance = 0.01,
  this.stretchHitTestBehavior = HitTestBehavior.opaque,
  // GlassGlow properties
  this.glowColor,
  this.glowRadius,
  // null → native iOS 26 shape-clipped specular (wide 1.6 radius, sigma-16 blur, soft sheen).
  // 0.0  → opt out; pure ambient lift only.
  // > 0  → custom explicit radius.
  this.glowBlurRadius,
  this.glowSpreadRadius,
  this.glowOpacity,
  this.glowHitTestBehavior = HitTestBehavior.opaque,
  this.enabled = true,
  this.style = GlassButtonStyle.filled,
  this.persistPressOnDrag = true,
  this.anchorStretch = true,
  this.anchorStretchSettings,
  this.alignment = Alignment.center,
  this.ambientBaseLight,
  this.pressLightColor,
  this.platformViewBackdrop = false,
  this.canRequestFocus = true,
  this.excludeFromSemantics = false,
  this.isStationary = false,
}) : child = null;