TButton constructor

const TButton({
  1. Key? key,
  2. TWidgetTheme? baseTheme,
  3. TButtonTheme? theme,
  4. TButtonShape? shape,
  5. TButtonType? type,
  6. TButtonSize? size,
  7. Color? color,
  8. bool loading = false,
  9. String loadingText = 'Loading...',
  10. ValueNotifier<String>? loadingNotifier,
  11. dynamic icon,
  12. String? imageUrl,
  13. bool forceCache = false,
  14. String? text,
  15. String? tooltip,
  16. VoidCallback? onTap,
  17. dynamic onPressed(
    1. TButtonPressOptions
    )?,
  18. bool active = false,
  19. dynamic activeIcon,
  20. Color? activeColor,
  21. (double, double)? turns,
  22. bool showTick = false,
  23. Alignment tickAlignment = Alignment.topRight,
  24. Widget? tickWidget,
  25. dynamic badge,
  26. TSize? badgeSize,
  27. Alignment badgeAlignment = Alignment.topRight,
  28. Color? badgeColor,
  29. Color? badgeTextColor,
  30. Widget? child,
  31. ValueChanged<bool>? onChanged,
  32. Duration duration = const Duration(milliseconds: 400),
  33. Duration? throttleDuration,
  34. Gradient? gradient,
  35. double? elevation,
  36. Color? shadowColor,
  37. String? semanticLabel,
  38. String? semanticIdentifier,
  39. Object? permission,
  40. TAuthMode? onDenied,
})

Creates a customizable button widget.

At least one of onTap, onPressed, or onChanged should be provided for the button to be interactive.

Implementation

const TButton({
  super.key,
  this.baseTheme,
  this.theme,
  this.shape,
  this.type,
  this.size,
  this.color,
  this.loading = false,
  this.loadingText = 'Loading...',
  this.loadingNotifier,
  this.icon,
  this.imageUrl,
  this.forceCache = false,
  this.text,
  this.tooltip,
  this.onTap,
  this.onPressed,
  this.active = false,
  this.activeIcon,
  this.activeColor,
  this.turns,
  this.showTick = false,
  this.tickAlignment = Alignment.topRight,
  this.tickWidget,
  this.badge,
  this.badgeSize,
  this.badgeAlignment = Alignment.topRight,
  this.badgeColor,
  this.badgeTextColor,
  this.child,
  this.onChanged,
  this.duration = const Duration(milliseconds: 400),
  this.throttleDuration,
  this.gradient,
  this.elevation,
  this.shadowColor,
  this.semanticLabel,
  this.semanticIdentifier,
  this.permission,
  this.onDenied,
})  : assert(
        theme == null || (baseTheme == null && type == null && size == null && shape == null && color == null),
        'If theme is provided, baseTheme, type, shape, color and size must be null.',
      ),
      assert(baseTheme == null || (type == null && color == null && activeColor == null),
          'If baseTheme is provided, type, color and activeColor must be null.'),
      assert(imageUrl == null || icon == null, 'Provide either `imageUrl` or `icon`, but not both.');