ButtonStyles.from constructor
ButtonStyles.from(
- TUIColors colors,
- TUITypography typography
Implementation
ButtonStyles.from(tui.TUIColors colors, tui.TUITypography typography)
: primary = ButtonColorStyle(
backgroundColor: _createStateProperty(
colors.primary, colors.primaryHover, colors.disabledBackground),
foregroundColor: _createStateProperty(
colors.onPrimary,
colors.onPrimary,
colors.disabledContent,
),
borderSide: _createStateProperty(
BorderSide.none,
BorderSide(color: colors.onSurface, width: 1.5),
BorderSide.none)),
secondary = ButtonColorStyle(
backgroundColor: _createStateProperty(colors.secondary,
colors.secondaryHover, colors.disabledBackground),
foregroundColor: _createStateProperty(
colors.onSecondary,
colors.onSecondary,
colors.disabledContent,
),
borderSide: _createStateProperty(
BorderSide.none,
BorderSide(color: colors.onSurface, width: 1.5),
BorderSide.none)),
outlined = ButtonColorStyle(
backgroundColor: _createStateProperty(
Colors.transparent, colors.surfaceHover, Colors.transparent),
foregroundColor: _createStateProperty(
colors.onSurface,
colors.onSurface,
colors.disabledContent,
),
borderSide: _createStateProperty(
BorderSide(color: colors.onSurface, width: 1.5),
BorderSide(color: colors.onSurface, width: 2),
BorderSide(color: colors.disabledContent, width: 1.5))),
ghost = ButtonColorStyle(
backgroundColor: _createStateProperty(
Colors.transparent, colors.surfaceHover, Colors.transparent),
foregroundColor: _createStateProperty(
colors.secondary,
colors.secondary,
colors.disabledContent,
),
borderSide: _createStateProperty(
BorderSide.none, BorderSide.none, BorderSide.none)),
danger = ButtonColorStyle(
backgroundColor: _createStateProperty(
colors.error, colors.errorHover, colors.disabledBackground),
foregroundColor: _createStateProperty(
colors.onPrimary,
colors.onPrimary,
colors.disabledContent,
),
borderSide: _createStateProperty(
BorderSide.none,
BorderSide(color: colors.onSurface, width: 1.5),
BorderSide.none)),
xs = ButtonSizeStyle(
textStyle: typography.button8,
iconSize: 16,
paddingVertical: 5,
paddingTextToBorder: 8,
paddingIconToBorder: 4,
paddingTextToIcon: 4),
s = ButtonSizeStyle(
textStyle: typography.button7,
iconSize: 16,
paddingVertical: 7,
paddingTextToBorder: 16,
paddingIconToBorder: 8,
paddingTextToIcon: 4),
m = ButtonSizeStyle(
textStyle: typography.button6,
iconSize: 24,
paddingVertical: 10,
paddingTextToBorder: 24,
paddingIconToBorder: 16,
paddingTextToIcon: 8),
l = ButtonSizeStyle(
textStyle: typography.button6,
iconSize: 24,
paddingVertical: 14,
paddingTextToBorder: 24,
paddingIconToBorder: 16,
paddingTextToIcon: 8);