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 { ...@@ -308,10 +308,10 @@ class FixedExtentMetrics extends FixedScrollMetrics {
/// Creates an immutable snapshot of values associated with a /// Creates an immutable snapshot of values associated with a
/// [ListWheelScrollView]. /// [ListWheelScrollView].
FixedExtentMetrics({ FixedExtentMetrics({
required double minScrollExtent, required double? minScrollExtent,
required double maxScrollExtent, required double? maxScrollExtent,
required double pixels, required double? pixels,
required double viewportDimension, required double? viewportDimension,
required AxisDirection axisDirection, required AxisDirection axisDirection,
required this.itemIndex, required this.itemIndex,
}) : super( }) : super(
...@@ -332,10 +332,10 @@ class FixedExtentMetrics extends FixedScrollMetrics { ...@@ -332,10 +332,10 @@ class FixedExtentMetrics extends FixedScrollMetrics {
int? itemIndex, int? itemIndex,
}) { }) {
return FixedExtentMetrics( return FixedExtentMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent, minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent, maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? this.pixels, pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? this.viewportDimension, viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection, axisDirection: axisDirection ?? this.axisDirection,
itemIndex: itemIndex ?? this.itemIndex, itemIndex: itemIndex ?? this.itemIndex,
); );
...@@ -412,10 +412,10 @@ class _FixedExtentScrollPosition extends ScrollPositionWithSingleContext impleme ...@@ -412,10 +412,10 @@ class _FixedExtentScrollPosition extends ScrollPositionWithSingleContext impleme
int? itemIndex, int? itemIndex,
}) { }) {
return FixedExtentMetrics( return FixedExtentMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent, minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent, maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? this.pixels, pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? this.viewportDimension, viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection, axisDirection: axisDirection ?? this.axisDirection,
itemIndex: itemIndex ?? this.itemIndex, itemIndex: itemIndex ?? this.itemIndex,
); );
......
...@@ -706,10 +706,10 @@ class _InheritedNestedScrollView extends InheritedWidget { ...@@ -706,10 +706,10 @@ class _InheritedNestedScrollView extends InheritedWidget {
class _NestedScrollMetrics extends FixedScrollMetrics { class _NestedScrollMetrics extends FixedScrollMetrics {
_NestedScrollMetrics({ _NestedScrollMetrics({
required double minScrollExtent, required double? minScrollExtent,
required double maxScrollExtent, required double? maxScrollExtent,
required double pixels, required double? pixels,
required double viewportDimension, required double? viewportDimension,
required AxisDirection axisDirection, required AxisDirection axisDirection,
required this.minRange, required this.minRange,
required this.maxRange, required this.maxRange,
...@@ -734,10 +734,10 @@ class _NestedScrollMetrics extends FixedScrollMetrics { ...@@ -734,10 +734,10 @@ class _NestedScrollMetrics extends FixedScrollMetrics {
double? correctionOffset, double? correctionOffset,
}) { }) {
return _NestedScrollMetrics( return _NestedScrollMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent, minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent, maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? this.pixels, pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? this.viewportDimension, viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection, axisDirection: axisDirection ?? this.axisDirection,
minRange: minRange ?? this.minRange, minRange: minRange ?? this.minRange,
maxRange: maxRange ?? this.maxRange, maxRange: maxRange ?? this.maxRange,
......
...@@ -262,10 +262,10 @@ class PageController extends ScrollController { ...@@ -262,10 +262,10 @@ class PageController extends ScrollController {
class PageMetrics extends FixedScrollMetrics { class PageMetrics extends FixedScrollMetrics {
/// Creates an immutable snapshot of values associated with a [PageView]. /// Creates an immutable snapshot of values associated with a [PageView].
PageMetrics({ PageMetrics({
required double minScrollExtent, required double? minScrollExtent,
required double maxScrollExtent, required double? maxScrollExtent,
required double pixels, required double? pixels,
required double viewportDimension, required double? viewportDimension,
required AxisDirection axisDirection, required AxisDirection axisDirection,
required this.viewportFraction, required this.viewportFraction,
}) : super( }) : super(
...@@ -286,10 +286,10 @@ class PageMetrics extends FixedScrollMetrics { ...@@ -286,10 +286,10 @@ class PageMetrics extends FixedScrollMetrics {
double? viewportFraction, double? viewportFraction,
}) { }) {
return PageMetrics( return PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent, minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent, maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? this.pixels, pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? this.viewportDimension, viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection, axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction, viewportFraction: viewportFraction ?? this.viewportFraction,
); );
...@@ -441,10 +441,10 @@ class _PagePosition extends ScrollPositionWithSingleContext implements PageMetri ...@@ -441,10 +441,10 @@ class _PagePosition extends ScrollPositionWithSingleContext implements PageMetri
double? viewportFraction, double? viewportFraction,
}) { }) {
return PageMetrics( return PageMetrics(
minScrollExtent: minScrollExtent ?? this.minScrollExtent, minScrollExtent: minScrollExtent ?? (hasContentDimensions ? this.minScrollExtent : null),
maxScrollExtent: maxScrollExtent ?? this.maxScrollExtent, maxScrollExtent: maxScrollExtent ?? (hasContentDimensions ? this.maxScrollExtent : null),
pixels: pixels ?? this.pixels, pixels: pixels ?? (hasPixels ? this.pixels : null),
viewportDimension: viewportDimension ?? this.viewportDimension, viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null),
axisDirection: axisDirection ?? this.axisDirection, axisDirection: axisDirection ?? this.axisDirection,
viewportFraction: viewportFraction ?? this.viewportFraction, 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