Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into osama/closed-acculmu…
Browse files Browse the repository at this point in the history
…lator-label

# Conflicts:
#	lib/src/deriv_chart/chart/data_visualization/annotations/barriers/accumulators_barriers/accumulators_closed_indicator_painter.dart
  • Loading branch information
osama-deriv committed Feb 29, 2024
2 parents 502c261 + fbc89a0 commit a2c345a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@ class AccumulatorsActiveContract {
/// Initializes [AccumulatorsActiveContract].
const AccumulatorsActiveContract({
required this.profit,
required this.currency,
required this.profitUnit,
required this.fractionalDigits,
});

/// Profit value of the current contract.
final double? profit;

/// The currency of the current contract.
final String? currency;
/// The profit unit label either currency or %, etc that will be shown next to
/// profit value.
final String? profitUnit;

/// The number of decimal places to show the correct formatting of the profit
/// value.
final int fractionalDigits;
}
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,14 @@ class AccumulatorIndicatorPainter extends SeriesPainter<AccumulatorIndicator> {
// profit
if (animatedProfit != null && animatedProfit != 0) {
final TextPainter profitPainter = makeTextPainter(
'${animatedProfit < 0 ? '' : '+'}${animatedProfit.toStringAsFixed(2)}',
'${animatedProfit < 0 ? '' : '+'}${animatedProfit.toStringAsFixed(
indicator.activeContract!.fractionalDigits,
)}',
style.textStyle.copyWith(color: color, fontSize: 26),
);

final TextPainter currencyPainter = makeTextPainter(
indicator.activeContract?.currency ?? '',
indicator.activeContract?.profitUnit ?? '',
style.textStyle.copyWith(color: color, fontSize: 14),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ class AccumulatorsRecentlyClosedIndicatorPainter
// draw the transparent color.
final Rect rect = Rect.fromPoints(
highBarrierPosition,
Offset(
epochToX(series.barrierEndEpoch),
lowBarrierPosition.dy),
Offset(epochToX(series.barrierEndEpoch), lowBarrierPosition.dy),
);
canvas.drawRect(rect, _rectPaint);

Expand Down Expand Up @@ -183,8 +181,11 @@ class AccumulatorsRecentlyClosedIndicatorPainter
if (indicator.activeContract?.profit != null) {
final double profit = indicator.activeContract!.profit!;
final String profitText =
'${profit < 0 ? '' : '+'}${profit.toStringAsFixed(2)}';
final String currencyText = '${indicator.activeContract?.currency ?? ''}';
'${profit < 0 ? '' : '+'}${profit.toStringAsFixed(
indicator.activeContract!.fractionalDigits,
)}';
final String currencyText =
'${indicator.activeContract?.profitUnit ?? ''}';
final TextPainter profitPainter = makeTextPainter(
'$profitText $currencyText',
style.textStyle.copyWith(
Expand Down

0 comments on commit a2c345a

Please sign in to comment.