@@ -5,28 +5,6 @@ import 'package:flutter/services.dart';
5
5
import 'package:flutter_colorpicker/flutter_colorpicker.dart' ;
6
6
import 'package:flutter_form_builder/flutter_form_builder.dart' ;
7
7
8
- extension on Color {
9
- /// String is in the format "aabbcc" or "ffaabbcc" with an optional leading "#".
10
- /*static Color fromHex(String hexString) {
11
- final buffer = StringBuffer();
12
- if (hexString.length == 6 || hexString.length == 7) buffer.write('ff');
13
- buffer.write(hexString.replaceFirst('#', ''));
14
- return Color(int.parse(buffer.toString(), radix: 16));
15
- }*/
16
-
17
- /// Prefixes a hash sign if [leadingHashSign] is set to `true` (default is `true` ).
18
- String toHex ({bool leadingHashSign = true }) {
19
- /// Converts an rgba value (0-255) into a 2-digit Hex code.
20
- String hexValue (int rgbaVal) {
21
- assert (rgbaVal == rgbaVal & 0xFF );
22
- return rgbaVal.toRadixString (16 ).padLeft (2 , '0' ).toUpperCase ();
23
- }
24
-
25
- return '${leadingHashSign ? '#' : '' }'
26
- '${hexValue (a .toInt ())}${hexValue (r .toInt ())}${hexValue (g .toInt ())}${hexValue (b .toInt ())}' ;
27
- }
28
- }
29
-
30
8
enum ColorPickerType { colorPicker, materialPicker, blockPicker }
31
9
32
10
/// Creates a field for `Color` input selection
@@ -176,7 +154,7 @@ class FormBuilderColorPickerFieldState
176
154
FormBuilderFieldDecorationState <FormBuilderColorPickerField , Color > {
177
155
late TextEditingController _effectiveController;
178
156
179
- String ? get valueString => value? .toHex ();
157
+ String ? get valueString => value? .toHexString ();
180
158
181
159
Color ? _selectedColor;
182
160
0 commit comments