kDefaultDecoration constant
The decoration of a CupertinoMenuItem when pressed.
Implementation
// Pressed colors were sampled from the iOS simulator and are based on the
// following:
//
// Dark mode on white background rgb(111, 111, 111)
// Dark mode on black rgb(61, 61, 61)
// Light mode on black rgb(177, 177, 177)
// Light mode on white rgb(225, 225, 225)
//
// Blend mode is used to mimic the visual effect of the iOS
// menu item. As a result, the default pressed color does not match the
// reported colors on the iOS 18.5 simulator.
static const WidgetStateProperty<BoxDecoration> kDefaultDecoration =
WidgetStateProperty<BoxDecoration>.fromMap(<WidgetStatesConstraint, BoxDecoration>{
WidgetState.dragged: BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: Color.fromRGBO(50, 50, 50, 0.1),
darkColor: Color.fromRGBO(255, 255, 255, 0.1),
),
),
WidgetState.pressed: BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: Color.fromRGBO(50, 50, 50, 0.1),
darkColor: Color.fromRGBO(255, 255, 255, 0.1),
),
),
WidgetState.focused: BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: Color.fromRGBO(50, 50, 50, 0.075),
darkColor: Color.fromRGBO(255, 255, 255, 0.075),
),
),
WidgetState.hovered: BoxDecoration(
color: CupertinoDynamicColor.withBrightness(
color: Color.fromRGBO(50, 50, 50, 0.05),
darkColor: Color.fromRGBO(255, 255, 255, 0.05),
),
),
WidgetState.any: BoxDecoration(),
});