Unverified Commit e55b7ca0 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

fix nullability of ScrollMetrics (#65861)

parent ca2ecf75
......@@ -308,10 +308,10 @@ class FixedExtentMetrics extends FixedScrollMetrics {
/// Creates an immutable snapshot of values associated with a
/// [ListWheelScrollView].
FixedExtentMetrics({
required double minScrollExtent,
required double maxScrollExtent,
required double pixels,
required double viewportDimension,
required double? minScrollExtent,
required double? maxScrollExtent,
required double? pixels,
required double? viewportDimension,
required AxisDirection axisDirection,
required this.itemIndex,
}) : super(
......@@ -332,10 +332,10 @@ class FixedExtentMetrics extends FixedScrollMetrics {
int? itemIndex,
}) {
return FixedExtentMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection,
itemIndex: itemIndex ?? this.itemIndex,
);
......@@ -412,10 +412,10 @@ class _FixedExtentScrollPosition extends ScrollPositionWithSingleContext impleme
int? itemIndex,
}) {
return FixedExtentMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection,
itemIndex: itemIndex ?? this.itemIndex,
);
......
......@@ -706,10 +706,10 @@ class _InheritedNestedScrollView extends InheritedWidget {
class _NestedScrollMetrics extends FixedScrollMetrics {
_NestedScrollMetrics({
required double minScrollExtent,
required double maxScrollExtent,
required double pixels,
required double viewportDimension,
required double? minScrollExtent,
required double? maxScrollExtent,
required double? pixels,
required double? viewportDimension,
required AxisDirection axisDirection,
required this.minRange,
required this.maxRange,
......@@ -734,10 +734,10 @@ class _NestedScrollMetrics extends FixedScrollMetrics {
double? correctionOffset,
}) {
return _NestedScrollMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection,
minRange: minRange ?? this.minRange,
maxRange: maxRange ?? this.maxRange,
......
......@@ -262,10 +262,10 @@ class PageController extends ScrollController {
class PageMetrics extends FixedScrollMetrics {
/// Creates an immutable snapshot of values associated with a [PageView].
PageMetrics({
required double minScrollExtent,
required double maxScrollExtent,
required double pixels,
required double viewportDimension,
required double? minScrollExtent,
required double? maxScrollExtent,
required double? pixels,
required double? viewportDimension,
required AxisDirection axisDirection,
required this.viewportFraction,
}) : super(
......@@ -286,10 +286,10 @@ class PageMetrics extends FixedScrollMetrics {
double? viewportFraction,
}) {
return PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction,
);
......@@ -441,10 +441,10 @@ class _PagePosition extends ScrollPositionWithSingleContext implements PageMetri
double? viewportFraction,
}) {
return PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent,
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent,
pixels: pixels ?? this.pixels,
viewportDimension: viewportDimension ?? this.viewportDimension,
minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction,
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment