flutter color with opacity code example

Example 1: flutter how to add opacity to color

backgroundColor: Colors.black.withOpacity(0.5)

Example 2: opacity color flutter

Color(0xFF0E3311).withOpacity(0.5)

Example 3: flutter color hex opacity

Hex Opacity Values

100% — FF

95% — F2

90% — E6

85% — D9

80% — CC

75% — BF

70% — B3

65% — A6

60%99

55%8C

50%80

45%73

40%66

35%59

30%4D

25%40

20%33

15%26

10%1A

5%0D

0%00

Example 4: how to set opacity of background color in flutter

Opacity(
          opacity: 0.5,
          child: Container(
          color: Colors.red,
          width: 200,
          height: 200,
  ),
        ),

Tags:

Dart Example