mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Updated return-type for PathMetric.extractPath to be non-nullable (#22292)
This commit is contained in:
parent
acc246676c
commit
deb7c662d2
3
AUTHORS
3
AUTHORS
@ -16,4 +16,5 @@ Dwayne Slater <ds84182@gmail.com>
|
||||
Tetsuhiro Ueda <najeira@gmail.com>
|
||||
shoryukenn <naifu.guan@gmail.com>
|
||||
SOTEC GmbH & Co. KG <sotec-contributors@sotec.eu>
|
||||
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
|
||||
Hidenori Matsubayashi <Hidenori.Matsubayashi@sony.com>
|
||||
Sarbagya Dhaubanjar <mail@sarbagyastha.com.np>
|
||||
|
||||
@ -2744,12 +2744,11 @@ class PathMetric {
|
||||
return _measure.getTangentForOffset(contourIndex, distance);
|
||||
}
|
||||
|
||||
/// Given a start and stop distance, return the intervening segment(s).
|
||||
/// Given a start and end distance, return the intervening segment(s).
|
||||
///
|
||||
/// `start` and `end` are clamped to legal values (0..[length])
|
||||
/// Returns null if the segment is 0 length or `start` > `stop`.
|
||||
/// Begin the segment with a moveTo if `startWithMoveTo` is true.
|
||||
Path? extractPath(double start, double end, {bool startWithMoveTo = true}) {
|
||||
Path extractPath(double start, double end, {bool startWithMoveTo = true}) {
|
||||
return _measure.extractPath(contourIndex, start, end, startWithMoveTo: startWithMoveTo);
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ class _SurfacePathMeasure {
|
||||
return true;
|
||||
}
|
||||
|
||||
ui.Path? extractPath(int contourIndex, double start, double end,
|
||||
ui.Path extractPath(int contourIndex, double start, double end,
|
||||
{bool startWithMoveTo = true}) {
|
||||
return _contours[contourIndex].extractPath(start, end, startWithMoveTo);
|
||||
}
|
||||
@ -196,7 +196,7 @@ class _PathContourMeasure {
|
||||
return segment.computeTangent(t);
|
||||
}
|
||||
|
||||
ui.Path? extractPath(
|
||||
ui.Path extractPath(
|
||||
double startDistance, double stopDistance, bool startWithMoveTo) {
|
||||
if (startDistance < 0) {
|
||||
startDistance = 0;
|
||||
@ -204,14 +204,14 @@ class _PathContourMeasure {
|
||||
if (stopDistance > _contourLength) {
|
||||
stopDistance = _contourLength;
|
||||
}
|
||||
if (startDistance > stopDistance || _segments.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
final ui.Path path = ui.Path();
|
||||
if (startDistance > stopDistance || _segments.isEmpty) {
|
||||
return path;
|
||||
}
|
||||
int startSegmentIndex = _segmentIndexAtDistance(startDistance);
|
||||
int stopSegmentIndex = _segmentIndexAtDistance(stopDistance);
|
||||
if (startSegmentIndex == -1 || stopSegmentIndex == -1) {
|
||||
return null;
|
||||
return path;
|
||||
}
|
||||
int currentSegmentIndex = startSegmentIndex;
|
||||
_PathSegment seg = _segments[currentSegmentIndex];
|
||||
@ -574,13 +574,11 @@ class SurfacePathMetric implements ui.PathMetric {
|
||||
return _measure.getTangentForOffset(contourIndex, distance);
|
||||
}
|
||||
|
||||
/// Given a start and stop distance, return the intervening segment(s).
|
||||
/// Given a start and end distance, return the intervening segment(s).
|
||||
///
|
||||
/// `start` and `end` are pinned to legal values (0..[length])
|
||||
/// Returns null if the segment is 0 length or `start` > `stop`.
|
||||
/// Begin the segment with a moveTo if `startWithMoveTo` is true.
|
||||
ui.Path? extractPath(double start, double end,
|
||||
{bool startWithMoveTo = true}) {
|
||||
ui.Path extractPath(double start, double end, {bool startWithMoveTo = true}) {
|
||||
return _measure.extractPath(contourIndex, start, end,
|
||||
startWithMoveTo: startWithMoveTo);
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ abstract class PathMetric {
|
||||
double get length;
|
||||
int get contourIndex;
|
||||
Tangent? getTangentForOffset(double distance);
|
||||
Path? extractPath(double start, double end, {bool startWithMoveTo = true});
|
||||
Path extractPath(double start, double end, {bool startWithMoveTo = true});
|
||||
bool get isClosed;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user