Skip to content

Commit

Permalink
color not convert to hex format, or else the value will be string
Browse files Browse the repository at this point in the history
  • Loading branch information
ebwood committed Mar 15, 2024
1 parent a057f8a commit dd4e526
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/widget2rfw/lib/flutter/arguments_encoder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,12 @@ class ArgumentEncoders {
///
/// Returns null if it's not an integer; otherwise, passes it to the [
/// Color] constructor.
static String? color(Color? color) {
static int? color(Color? color) {
if (color == null) {
return null;
}
return '0x${color.value.toRadixString(16).toUpperCase().toUpperCase()}';
// return '0x${color.value.toRadixString(16).padLeft(8, '0').toUpperCase()}';
return color.value;
}

/// Returns a [ColorFilter] from the specified map.
Expand Down Expand Up @@ -656,15 +657,15 @@ class ArgumentEncoders {
'type': 'linear',
'begin': alignment(gradient.begin),
'end': alignment(gradient.end),
'colors': list<Color, String?>(gradient.colors, color),
'colors': list<Color, dynamic>(gradient.colors, color),
'stops': list<double, double>(gradient.stops),
'tileMode': enumValue(gradient.tileMode)
});
case RadialGradient():
return NotNullMap.from({
'type': 'radial',
'center': alignment(gradient.center),
'colors': list<Color, String?>(gradient.colors, color),
'colors': list<Color, dynamic>(gradient.colors, color),
'stops': list<double, double>(gradient.stops),
'tileMode': enumValue(gradient.tileMode),
'focal': alignment(gradient.focal),
Expand All @@ -676,7 +677,7 @@ class ArgumentEncoders {
'center': alignment(gradient.center),
'startAngle': gradient.startAngle,
'endAngle': gradient.endAngle,
'colors': list<Color, String?>(gradient.colors, color),
'colors': list<Color, dynamic>(gradient.colors, color),
'stops': list<double, double>(gradient.stops),
'tileMode': enumValue(gradient.tileMode),
});
Expand Down

0 comments on commit dd4e526

Please sign in to comment.