Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Fixed the weird syntax highlighting (as a result, the diff looks more extensive than it really is - use view "Side-by-side markdown" to compare).
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

In Flutter, to create a color from RGB with alpha, use:

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hexadecimal color:

return new Container(
 color: new Color(0xFF4286f4),
);
// 0xFF -> the opacity (FF for opaque)
// 4286f4 -> the hexadecimal color

Hexadecimal color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// Or change the "FF" value

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
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

For more, see the official documentation page, Color class - dart:ui library - Dart API .

In Flutter, to create a color from RGB with alpha, use:

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hexadecimal color:

return new Container(
 color: new Color(0xFF4286f4),
);
// 0xFF -> the opacity (FF for opaque)
// 4286f4 -> the hexadecimal color

Hexadecimal color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// Or change the "FF" value

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

For more, see the official documentation page, Color class - dart:ui library - Dart API .

In Flutter, to create a color from RGB with alpha, use:

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hexadecimal color:

return new Container(
 color: new Color(0xFF4286f4),
);
// 0xFF -> the opacity (FF for opaque)
// 4286f4 -> the hexadecimal color

Hexadecimal color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// Or change the "FF" value

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

For more, see the official documentation page, Color class - dart:ui library - Dart API .

Expanded. Dressed the naked link.
Source Link
Peter Mortensen
  • 31.3k
  • 22
  • 110
  • 134

In Flutter it, to create a color from RGB with alpha, use:

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hex-colorhexadecimal color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hex-hexadecimal color

Hex-colorHexadecimal color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// orOr change the "FF" value

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

For more follow, see the official linkdocumentation page, https://api.flutter.dev/flutter/dart-ui/Color-class.html Color class - dart:ui library - Dart API .

In Flutter it create a color from RGB with alpha, use

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hex-color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hex-color

Hex-color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// or change the "FF" value

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

For more follow official link https://api.flutter.dev/flutter/dart-ui/Color-class.html

In Flutter, to create a color from RGB with alpha, use:

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hexadecimal color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hexadecimal color

Hexadecimal color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// Or change the "FF" value

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

For more, see the official documentation page, Color class - dart:ui library - Dart API .

added 90 characters in body
Source Link
Amit Prajapati
  • 14.4k
  • 8
  • 67
  • 88

In Flutter it create a color from RGB with alpha, use

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hex-color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hex-color

Hex-color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// or change the "FF" value

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

For more follow official link https://api.flutter.dev/flutter/dart-ui/Color-class.html

In Flutter it create a color from RGB with alpha, use

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hex-color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hex-color

Hex-color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// or change the "FF" value

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

In Flutter it create a color from RGB with alpha, use

return new Container(
 color: new Color.fromRGBO(0, 0, 0, 0.5),
);

How to use hex-color:

return new Container(
 color: new Color(0xFF4286f4),
);
//0xFF -> the opacity (FF for opaque)
//4286f4 -> the hex-color

Hex-color with opacity:

return new Container(
 color: new Color(0xFF4286f4).withOpacity(0.5),
);

// or change the "FF" value

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

For more follow official link https://api.flutter.dev/flutter/dart-ui/Color-class.html

added 8 characters in body
Source Link
Amit Prajapati
  • 14.4k
  • 8
  • 67
  • 88
Loading
Source Link
Amit Prajapati
  • 14.4k
  • 8
  • 67
  • 88
Loading
lang-dart

AltStyle によって変換されたページ (->オリジナル) /