mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Parse correctly conversation color
This commit is contained in:
14
lib/utils/dart_color.dart
Normal file
14
lib/utils/dart_color.dart
Normal file
@ -0,0 +1,14 @@
|
||||
// https://stackoverflow.com/a/53905427
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class HexColor extends Color {
|
||||
static int _getColorFromHex(String hexColor) {
|
||||
hexColor = hexColor.toUpperCase().replaceAll("#", "");
|
||||
if (hexColor.length == 6) {
|
||||
hexColor = "FF" + hexColor;
|
||||
}
|
||||
return int.parse(hexColor, radix: 16);
|
||||
}
|
||||
|
||||
HexColor(final String hexColor) : super(_getColorFromHex(hexColor));
|
||||
}
|
Reference in New Issue
Block a user