Skip to content

feat: add buildSemantics to base classes and vertical barrier painter #388

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:example/settings_page.dart';
import 'package:example/utils/endpoints_helper.dart';
import 'package:example/widgets/connection_status_label.dart';
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter_deriv_api/api/exceptions/exceptions.dart';
import 'package:flutter_deriv_api/api/manually/ohlc_response_result.dart';
import 'package:flutter_deriv_api/api/manually/tick.dart' as tick_api;
Expand Down Expand Up @@ -38,6 +39,8 @@ class MyHttpOverrides extends HttpOverrides {

void main() {
WidgetsFlutterBinding.ensureInitialized();
SemanticsBinding.instance.ensureSemantics();

HttpOverrides.global = MyHttpOverrides();
runApp(const MyApp());
}
Expand Down
7 changes: 7 additions & 0 deletions lib/src/deriv_chart/chart/custom_painters/chart_painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,11 @@ class ChartPainter extends CustomPainter {

@override
bool shouldRebuildSemantics(ChartPainter oldDelegate) => false;

@override
SemanticsBuilderCallback get semanticsBuilder {
return (Size size) {
return chartData.buildSemantics(size, epochToCanvasX, quoteToCanvasY);
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,12 @@ class AccumulatorsClosedIndicatorPainter
// Draw exit tick position.
paintDotWithGlow(canvas, exitTickPosition, color: color);
}

@override
List<CustomPainterSemantics> buildSemantics(
{required Size size,
required EpochToX epochToX,
required QuoteToY quoteToY}) {
return <CustomPainterSemantics>[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,12 @@ class AccumulatorsEntrySpotBarrierPainter<
1,
);
}

@override
List<CustomPainterSemantics> buildSemantics(
{required ui.Size size,
required EpochToX epochToX,
required QuoteToY quoteToY}) {
return <CustomPainterSemantics>[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,12 @@ class AccumulatorIndicatorPainter extends SeriesPainter<AccumulatorIndicator> {
Offset(mainLineStartX, y), Offset(mainLineEndX, y), _paint);
}
}

@override
List<CustomPainterSemantics> buildSemantics(
{required ui.Size size,
required EpochToX epochToX,
required QuoteToY quoteToY}) {
return <CustomPainterSemantics>[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,12 @@ class AccumulatorsRecentlyClosedIndicatorPainter
);
}
}

@override
List<CustomPainterSemantics> buildSemantics(
{required Size size,
required EpochToX epochToX,
required QuoteToY quoteToY}) {
return <CustomPainterSemantics>[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:deriv_chart/src/deriv_chart/chart/data_visualization/models/barr
import 'package:deriv_chart/src/deriv_chart/chart/helpers/paint_functions/paint_entry_exit_marker.dart';
import 'package:deriv_chart/src/models/tick.dart';
import 'package:deriv_chart/src/theme/painting_styles/entry_exit_marker_style.dart';
import 'package:flutter/rendering.dart';

import '../chart_annotation.dart';

Expand Down Expand Up @@ -57,4 +58,12 @@ class _EntryTickAnnotationPainter extends SeriesPainter<EntryTickAnnotation> {
);
paintEntryExitMarker(canvas, center, series.style as EntryExitMarkerStyle);
}

@override
List<CustomPainterSemantics> buildSemantics(
{required Size size,
required EpochToX epochToX,
required QuoteToY quoteToY}) {
return <CustomPainterSemantics>[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@ class HorizontalBarrierPainter<T extends HorizontalBarrier>
),
arrowPaint..color = _paint.color.withOpacity(0.32));
}

@override
List<CustomPainterSemantics> buildSemantics({
required Size size,
required EpochToX epochToX,
required QuoteToY quoteToY,
}) {
return <CustomPainterSemantics>[];
}
}

/// The painter for the [IconTickIndicator] which paints the icon on the
Expand Down Expand Up @@ -392,4 +401,13 @@ class IconBarrierPainter extends HorizontalBarrierPainter<IconTickIndicator> {
_barrierPosition! - Offset(innerIconSize / 2, innerIconSize / 2),
);
}

@override
List<CustomPainterSemantics> buildSemantics({
required Size size,
required EpochToX epochToX,
required QuoteToY quoteToY,
}) {
return <CustomPainterSemantics>[];
}
}
Loading
Loading