Skip to content

Commit

Permalink
Merge pull request #79 from infinum/fix/widget-options
Browse files Browse the repository at this point in the history
Widget options could not have width set if chart was scrollable
  • Loading branch information
itsJoKr authored Feb 15, 2023
2 parents 8d7e195 + 8689edd commit 364f222
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/chart/model/theme/item_theme/widget/widget_item_options.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
part of charts_painter;

// Hidden because it's only used if chart item is a widget.
GeometryPainter<T> _emptyPainter<T>(ChartItem<T> item, ChartData<T> data,
ItemOptions itemOptions, DrawDataItem drawDataItem) =>
GeometryPainter<T> _emptyPainter<T>(
ChartItem<T> item, ChartData<T> data, ItemOptions itemOptions, DrawDataItem drawDataItem) =>
_EmptyGeometryPainter<T>(item, data, itemOptions);

typedef WidgetItemBuilder<T> = Widget Function(ItemBuilderData<T>);
Expand Down Expand Up @@ -43,11 +43,15 @@ class WidgetItemOptions extends ItemOptions {
const WidgetItemOptions({
required this.widgetItemBuilder,
EdgeInsets multiValuePadding = EdgeInsets.zero,
double? maxBarWidth,
double? minBarWidth,
}) : super(
padding: EdgeInsets.zero,
multiValuePadding: multiValuePadding,
geometryPainter: _emptyPainter,
itemBuilder: widgetItemBuilder,
maxBarWidth: maxBarWidth,
minBarWidth: minBarWidth,
);

const WidgetItemOptions._lerp({
Expand All @@ -64,12 +68,8 @@ class WidgetItemOptions extends ItemOptions {
@override
ItemOptions animateTo(ItemOptions endValue, double t) {
return WidgetItemOptions._lerp(
widgetItemBuilder: endValue is WidgetItemOptions
? endValue.widgetItemBuilder
: widgetItemBuilder,
multiValuePadding:
EdgeInsets.lerp(multiValuePadding, endValue.multiValuePadding, t) ??
EdgeInsets.zero,
widgetItemBuilder: endValue is WidgetItemOptions ? endValue.widgetItemBuilder : widgetItemBuilder,
multiValuePadding: EdgeInsets.lerp(multiValuePadding, endValue.multiValuePadding, t) ?? EdgeInsets.zero,
);
}
}

0 comments on commit 364f222

Please sign in to comment.