Skip to content

Commit c1ddfbc

Browse files
fix: show rigth string on text field
1 parent d029aed commit c1ddfbc

File tree

2 files changed

+2
-24
lines changed

2 files changed

+2
-24
lines changed

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ packages:
211211
path: ".."
212212
relative: true
213213
source: path
214-
version: "12.2.0"
214+
version: "12.0.0"
215215
form_builder_validators:
216216
dependency: "direct main"
217217
description:

lib/src/fields/form_builder_color_picker.dart

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,6 @@ import 'package:flutter/services.dart';
55
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
66
import 'package:flutter_form_builder/flutter_form_builder.dart';
77

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-
308
enum ColorPickerType { colorPicker, materialPicker, blockPicker }
319

3210
/// Creates a field for `Color` input selection
@@ -176,7 +154,7 @@ class FormBuilderColorPickerFieldState
176154
FormBuilderFieldDecorationState<FormBuilderColorPickerField, Color> {
177155
late TextEditingController _effectiveController;
178156

179-
String? get valueString => value?.toHex();
157+
String? get valueString => value?.toHexString();
180158

181159
Color? _selectedColor;
182160

0 commit comments

Comments
 (0)