ChipThemeData.standard constructor
ChipThemeData.standard(
- ThemeData style
Implementation
factory ChipThemeData.standard(ThemeData style) {
Color normalColor(Set<ButtonStates> states) => style.brightness.isLight
? states.isPressing
? Color(0xFFc1c1c1)
: states.isFocused || states.isHovering
? Color(0xFFe1e1e1)
: Color(0xFFf1f1f1)
: states.isPressing
? Color(0xFF292929)
: states.isFocused || states.isHovering
? Color(0xFF383838)
: Color(0xFF212121);
Color selectedColor(Set<ButtonStates> states) =>
states.isFocused || states.isPressing || states.isHovering
? style.accentColor.resolveFromBrightness(
style.brightness,
level: states.isPressing
? 2
: states.isFocused
? 0
: 1,
)
: style.accentColor;
return ChipThemeData(
cursor: style.inputMouseCursor,
spacing: _kChipSpacing,
decoration: ButtonState.resolveWith((states) {
return BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
color: normalColor(states),
);
}),
textStyle: ButtonState.resolveWith((states) {
return TextStyle(
color: states.isDisabled
? style.disabledColor
: normalColor(states).basedOnLuminance(),
);
}),
selectedDecoration: ButtonState.resolveWith((states) {
return BoxDecoration(
borderRadius: BorderRadius.circular(4.0),
color: selectedColor(states),
);
}),
selectedTextStyle: ButtonState.resolveWith((states) {
return TextStyle(color: selectedColor(states).basedOnLuminance());
}),
);
}