import 'package:flutter/material.dart'; import 'package:test/test.dart'; void main() { group('Hex or RGB string to Color', () { test('Can convert hex #cc3333 to Color', () { expect(hexOrRGBToColor("#cc3333"), Color(0xffcc3333)); }); test('Can convert hex #000 to Color', () { expect(hexOrRGBToColor("#000"), Color(0xff000000)); }); test('Can convert hex #ffffff to Color', () { expect(hexOrRGBToColor("#ffffff"), Color(0xffffffff)); }); test('Can convert rgba rgba(255,255,255,0) to Color', () { expect(hexOrRGBToColor("rgba(255,255,255,0)"), Color(0x00ffffff)); }); test('Can convert rgba rgba(32,33,36,0.55) to Color', () { expect(hexOrRGBToColor("rgba(32,33,36,0.55)"), Color(0x8c202124)); }); test('Can convert hex #2021248c to Color', () { expect(hexOrRGBToColor("#2021248c"), Color(0x8c202124)); }); test('Can convert hex #cc2c512e to Color', () { expect(hexOrRGBToColor("#cc2c512e"), Color(0x2ecc2c51)); }); test('Can convert rgba rgba(204,44, 81, 0.20) to Color', () { expect(hexOrRGBToColor("rgba(204,44, 81, 0.20)"), Color(0x33cc2c51)); }); test('Can convert rgba rgba(204,44, 81, 0.80) to Color', () { expect(hexOrRGBToColor("rgba(204,44, 81, 0.80)"), Color(0xcccc2c51)); }); test('Can convert rgb rgb(204,44, 81) to Color', () { expect(hexOrRGBToColor("rgb(204,44, 81)"), Color(0xffcc2c51)); }); test('Can convert rgb rgb(32,33, 36) to Color', () { expect(hexOrRGBToColor("rgb(32,33, 36)"), Color(0xff202124)); }); }