defaultTheme method

  1. @override
ViewTheme defaultTheme(
  1. BuildContext context
)
override

Implementation

@override
ViewTheme defaultTheme(BuildContext context) {
  final theme = ButtonTheme.of(context);
  final scheme = theme.colorScheme;
  final io = _iconOnly;
  final p = theme.padding;
  final x = min(p.horizontal, p.vertical);
  print(x);
  return ViewTheme(
    decoration: BoxDecoration(
      color: enabled
          ? activated
              ? scheme?.secondary
              : scheme?.primary
          : scheme?.tertiary,
      borderRadius: io ? null : BorderRadius.circular(x * 2),
      shape: io ? BoxShape.circle : BoxShape.rectangle,
    ),
    constraints: io ? null : BoxConstraints(minWidth: theme.minWidth),
    padding: io
        ? EdgeInsets.all(x / 2)
        : _textOnly
            ? EdgeInsets.symmetric(
                horizontal: p.horizontal / 2,
                vertical: p.vertical / 2,
              )
            : theme.padding,
    alignment: height != null && height! > 0 ? Alignment.center : null,
  );
}