Skip to content

Commit e682ec7

Browse files
a14nHixie
andauthored
Nnbd widgets (flutter#64672)
* migrate widget to nullsafety * remove double blank line after license * address review comments in actions.dart * nullable ObjectKey.value * use local variable oldElement * make State.build non-nullable * make State.context non-nullable * newline at eof * make ProxyWidget.child non-nullable * make _InactiveElements.debugContains non-nullable * make Element.depth non-nullable * make ProxyElement.build non-nullable * make StatefulElement.state non-nullable * remove 'Notice that' * avoid cast of list in RenderObjectElement.updateChildren * make IndexedSlot.value non-nullable * avoid cast of list in MultiChildRenderObjectElement.mount * make some WidgetsApp parameters non-nullable * hitTest take non-nullable position * make ScrollableState.position non-nullable * use _pixels instead of pixels * make ViewportOffset.pixels non-nullable * make param and return type of IndexedWidgetBuilder non-nullable * unused_import * make context param non-nullable for Builder in animated_list.dart * make ScrollMetrics.viewportDimension non-nullable * make ScrollMetrics.{min,max}ScrollExtent non-nullable * make _Location.file non-nullable * _WidgetForTypeTests.createElement throw UnimplementedError * update _NullWidget.build error message * make _ShortcutsState.manager non-nullable * Fix childCount issues for NNBD * fix childCount computation on web * increase max value on js side to compute childCount * make aspect parameter of dependOnInheritedWidgetOfExactType nullable * merge has{min,max}ScrollExtent into hasScrollExtents * update focus_manager.dart * address review comments in icon.dart * address review comments in image.dart * address review comments in routes.dart * address review comments in scroll_activity.dart * update doc comments * make UserScrollNotification.direction non-nullable and required * rename hasScrollExtents to hasContentDimensions * unnecessary late Co-authored-by: Ian Hickson <[email protected]>
1 parent abeaf11 commit e682ec7

File tree

123 files changed

+5145
-5301
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+5145
-5301
lines changed

packages/flutter/lib/src/cupertino/text_field.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ class CupertinoTextField extends StatefulWidget {
645645
}
646646
}
647647

648-
class _CupertinoTextFieldState extends State<CupertinoTextField> with RestorationMixin, AutomaticKeepAliveClientMixin implements TextSelectionGestureDetectorBuilderDelegate {
648+
class _CupertinoTextFieldState extends State<CupertinoTextField> with RestorationMixin, AutomaticKeepAliveClientMixin<CupertinoTextField> implements TextSelectionGestureDetectorBuilderDelegate {
649649
final GlobalKey _clearGlobalKey = GlobalKey();
650650

651651
RestorableTextEditingController _controller;

packages/flutter/lib/src/rendering/sliver_fixed_extent_list.dart

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -196,28 +196,11 @@ abstract class RenderSliverFixedExtentBoxAdaptor extends RenderSliverMultiBoxAda
196196
if (firstChild == null) {
197197
if (!addInitialChild(index: firstIndex, layoutOffset: indexToLayoutOffset(itemExtent, firstIndex))) {
198198
// There are either no children, or we are past the end of all our children.
199-
// If it is the latter, we will need to find the first available child.
200199
double max;
201-
if (childManager.childCount != null) {
202-
max = computeMaxScrollOffset(constraints, itemExtent);
203-
// TODO(ianh): null-aware flow analysis flags the next two
204-
// branches as entirely dead code, and it's hard to argue with
205-
// its logic.
206-
} else if (firstIndex <= 0) { // ignore: dead_code
200+
if (firstIndex <= 0) {
207201
max = 0.0;
208202
} else {
209-
// We will have to find it manually.
210-
int possibleFirstIndex = firstIndex - 1;
211-
while (
212-
possibleFirstIndex > 0 &&
213-
!addInitialChild(
214-
index: possibleFirstIndex,
215-
layoutOffset: indexToLayoutOffset(itemExtent, possibleFirstIndex),
216-
)
217-
) {
218-
possibleFirstIndex -= 1;
219-
}
220-
max = (possibleFirstIndex + 1) * itemExtent;
203+
max = computeMaxScrollOffset(constraints, itemExtent);
221204
}
222205
geometry = SliverGeometry(
223206
scrollExtent: max,

packages/flutter/lib/src/rendering/viewport_offset.dart

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ abstract class ViewportOffset extends ChangeNotifier {
9494
/// the value changes due to [correctBy]).
9595
double get pixels;
9696

97+
/// Whether the [pixels] property is available.
98+
bool get hasPixels;
99+
97100
/// Called when the viewport's extents are established.
98101
///
99102
/// The argument is the dimension of the [RenderViewport] in the main axis
@@ -245,7 +248,9 @@ abstract class ViewportOffset extends ChangeNotifier {
245248
/// `super.debugFillDescription(description)`.
246249
@mustCallSuper
247250
void debugFillDescription(List<String> description) {
248-
description.add('offset: ${pixels.toStringAsFixed(1)}');
251+
if (hasPixels) {
252+
description.add('offset: ${pixels.toStringAsFixed(1)}');
253+
}
249254
}
250255
}
251256

@@ -258,6 +263,9 @@ class _FixedViewportOffset extends ViewportOffset {
258263
@override
259264
double get pixels => _pixels;
260265

266+
@override
267+
bool get hasPixels => true;
268+
261269
@override
262270
bool applyViewportDimension(double viewportDimension) => true;
263271

0 commit comments

Comments
 (0)