Unverified Commit 9611130e authored by Shi-Hao Hong's avatar Shi-Hao Hong Committed by GitHub

[NNBD] Migrate more widget tests to NNBD (#68173)

parent 7d25b1a4
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -75,8 +73,8 @@ void main() { ...@@ -75,8 +73,8 @@ void main() {
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
final int firstContainerId = tester.renderObject(find.byWidget(containers.first)).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byWidget(containers.first)).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
...@@ -137,8 +135,8 @@ void main() { ...@@ -137,8 +135,8 @@ void main() {
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
final int firstContainerId = tester.renderObject(find.byWidget(containers.first)).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byWidget(containers.first)).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
expect(tester.getTopLeft(find.byWidget(containers.first)).dy, kExpandedAppBarHeight); expect(tester.getTopLeft(find.byWidget(containers.first)).dy, kExpandedAppBarHeight);
...@@ -205,8 +203,8 @@ void main() { ...@@ -205,8 +203,8 @@ void main() {
expect(scrollController.offset, 2.5 * kItemHeight); expect(scrollController.offset, 2.5 * kItemHeight);
final int id0 = tester.renderObject(find.byWidget(children[0])).debugSemantics.id; final int id0 = tester.renderObject(find.byWidget(children[0])).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(id0, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(id0, SemanticsAction.showOnScreen);
await tester.pump(); await tester.pump();
await tester.pump(const Duration(seconds: 5)); await tester.pump(const Duration(seconds: 5));
expect(tester.getTopLeft(find.byWidget(children[0])).dy, kToolbarHeight); expect(tester.getTopLeft(find.byWidget(children[0])).dy, kToolbarHeight);
...@@ -405,9 +403,9 @@ void main() { ...@@ -405,9 +403,9 @@ void main() {
const double kItemHeight = 100.0; const double kItemHeight = 100.0;
List<Widget> children; late List<Widget> children;
ScrollController scrollController; late ScrollController scrollController;
Widget widgetUnderTest; late Widget widgetUnderTest;
setUp(() { setUp(() {
children = List<Widget>.generate(10, (int i) { children = List<Widget>.generate(10, (int i) {
...@@ -445,8 +443,8 @@ void main() { ...@@ -445,8 +443,8 @@ void main() {
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
final int firstContainerId = tester.renderObject(find.byWidget(children.first)).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byWidget(children.first)).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, 0.0); expect(scrollController.offset, 0.0);
...@@ -461,8 +459,8 @@ void main() { ...@@ -461,8 +459,8 @@ void main() {
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
final int firstContainerId = tester.renderObject(find.byWidget(children[2])).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byWidget(children[2])).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, kItemHeight); expect(scrollController.offset, kItemHeight);
...@@ -477,8 +475,8 @@ void main() { ...@@ -477,8 +475,8 @@ void main() {
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
final int firstContainerId = tester.renderObject(find.byWidget(children[1])).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byWidget(children[1])).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, kItemHeight / 2); expect(scrollController.offset, kItemHeight / 2);
...@@ -490,9 +488,9 @@ void main() { ...@@ -490,9 +488,9 @@ void main() {
group('showOnScreen with negative children', () { group('showOnScreen with negative children', () {
const double kItemHeight = 100.0; const double kItemHeight = 100.0;
List<Widget> children; late List<Widget> children;
ScrollController scrollController; late ScrollController scrollController;
Widget widgetUnderTest; late Widget widgetUnderTest;
setUp(() { setUp(() {
final Key center = GlobalKey(); final Key center = GlobalKey();
...@@ -550,8 +548,8 @@ void main() { ...@@ -550,8 +548,8 @@ void main() {
expect(scrollController.offset, -250.0); expect(scrollController.offset, -250.0);
final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(2))).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(2))).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, -300.0); expect(scrollController.offset, -300.0);
...@@ -566,8 +564,8 @@ void main() { ...@@ -566,8 +564,8 @@ void main() {
expect(scrollController.offset, -250.0); expect(scrollController.offset, -250.0);
final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(4))).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(4))).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, -200.0); expect(scrollController.offset, -200.0);
...@@ -582,8 +580,8 @@ void main() { ...@@ -582,8 +580,8 @@ void main() {
expect(scrollController.offset, -250.0); expect(scrollController.offset, -250.0);
final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(3))).debugSemantics.id; final int firstContainerId = tester.renderObject(find.byKey(const ValueKey<int>(3))).debugSemantics!.id;
tester.binding.pipelineOwner.semanticsOwner.performAction(firstContainerId, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(firstContainerId, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(scrollController.offset, -250.0); expect(scrollController.offset, -250.0);
...@@ -614,7 +612,7 @@ void main() { ...@@ -614,7 +612,7 @@ void main() {
final SemanticsNode rootScrollNode = semantics.nodesWith(actions: <SemanticsAction>[SemanticsAction.scrollUp]).single; final SemanticsNode rootScrollNode = semantics.nodesWith(actions: <SemanticsAction>[SemanticsAction.scrollUp]).single;
final SemanticsNode innerListPane = semantics.nodesWith(ancestor: rootScrollNode, scrollExtentMax: 0).single; final SemanticsNode innerListPane = semantics.nodesWith(ancestor: rootScrollNode, scrollExtentMax: 0).single;
final SemanticsNode outerListPane = innerListPane.parent; final SemanticsNode outerListPane = innerListPane.parent!;
final List<SemanticsNode> hiddenNodes = semantics.nodesWith(flags: <SemanticsFlag>[SemanticsFlag.isHidden]).toList(); final List<SemanticsNode> hiddenNodes = semantics.nodesWith(flags: <SemanticsFlag>[SemanticsFlag.isHidden]).toList();
// This test is only valid if some children are offscreen. // This test is only valid if some children are offscreen.
...@@ -631,7 +629,7 @@ void main() { ...@@ -631,7 +629,7 @@ void main() {
expect(nodeGlobalRect(innerListPane), nodeGlobalRect(outerListPane)); expect(nodeGlobalRect(innerListPane), nodeGlobalRect(outerListPane));
for (final SemanticsNode node in targetNodes) { for (final SemanticsNode node in targetNodes) {
tester.binding.pipelineOwner.semanticsOwner.performAction(node.id, SemanticsAction.showOnScreen); tester.binding.pipelineOwner.semanticsOwner!.performAction(node.id, SemanticsAction.showOnScreen);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(nodeGlobalRect(innerListPane), nodeGlobalRect(outerListPane)); expect(nodeGlobalRect(innerListPane), nodeGlobalRect(outerListPane));
...@@ -659,9 +657,9 @@ Future<void> fling(WidgetTester tester, Offset offset, int repetitions) async { ...@@ -659,9 +657,9 @@ Future<void> fling(WidgetTester tester, Offset offset, int repetitions) async {
Rect nodeGlobalRect(SemanticsNode node) { Rect nodeGlobalRect(SemanticsNode node) {
Matrix4 globalTransform = node.transform ?? Matrix4.identity(); Matrix4 globalTransform = node.transform ?? Matrix4.identity();
for (SemanticsNode parent = node.parent; parent != null; parent = parent.parent) { for (SemanticsNode? parent = node.parent; parent != null; parent = parent.parent) {
if (parent.transform != null) { if (parent.transform != null) {
globalTransform = parent.transform.multiplied(globalTransform); globalTransform = parent.transform!.multiplied(globalTransform);
} }
} }
return MatrixUtils.transformRect(globalTransform, node.rect); return MatrixUtils.transformRect(globalTransform, node.rect);
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:ui' as ui; import 'dart:ui' as ui;
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
...@@ -16,11 +14,10 @@ import 'package:flutter_test/flutter_test.dart'; ...@@ -16,11 +14,10 @@ import 'package:flutter_test/flutter_test.dart';
Future<void> pumpTest( Future<void> pumpTest(
WidgetTester tester, WidgetTester tester,
TargetPlatform platform, { TargetPlatform? platform, {
bool scrollable = true, bool scrollable = true,
bool reverse = false, bool reverse = false,
ScrollController controller, ScrollController? controller,
Widget Function(Widget) wrapper,
}) async { }) async {
await tester.pumpWidget(MaterialApp( await tester.pumpWidget(MaterialApp(
theme: ThemeData( theme: ThemeData(
...@@ -84,7 +81,7 @@ double getScrollOffset(WidgetTester tester, {bool last = true}) { ...@@ -84,7 +81,7 @@ double getScrollOffset(WidgetTester tester, {bool last = true}) {
double getScrollVelocity(WidgetTester tester) { double getScrollVelocity(WidgetTester tester) {
final RenderViewport viewport = tester.renderObject(find.byType(Viewport)); final RenderViewport viewport = tester.renderObject(find.byType(Viewport));
final ScrollPosition position = viewport.offset as ScrollPosition; final ScrollPosition position = viewport.offset as ScrollPosition;
return position.activity.velocity; return position.activity!.velocity;
} }
void resetScrollOffset(WidgetTester tester) { void resetScrollOffset(WidgetTester tester) {
...@@ -742,7 +739,7 @@ void main() { ...@@ -742,7 +739,7 @@ void main() {
// Getting the tester to simulate a life-like fling is difficult. // Getting the tester to simulate a life-like fling is difficult.
// Instead, just manually drive the activity with a ballistic simulation as // Instead, just manually drive the activity with a ballistic simulation as
// if the user has flung the list. // if the user has flung the list.
Scrollable.of(find.byType(SizedBox).evaluate().first).position.activity.delegate.goBallistic(4000); Scrollable.of(find.byType(SizedBox).evaluate().first)!.position.activity!.delegate.goBallistic(4000);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
expect(find.byKey(const ValueKey<String>('Box 0')), findsNothing); expect(find.byKey(const ValueKey<String>('Box 0')), findsNothing);
...@@ -771,7 +768,7 @@ void main() { ...@@ -771,7 +768,7 @@ void main() {
)); ));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ScrollPosition position = Scrollable.of(find.byType(SizedBox).evaluate().first).position; final ScrollPosition position = Scrollable.of(find.byType(SizedBox).evaluate().first)!.position;
final SuperPessimisticScrollPhysics physics = position.physics as SuperPessimisticScrollPhysics; final SuperPessimisticScrollPhysics physics = position.physics as SuperPessimisticScrollPhysics;
expect(find.byKey(const ValueKey<String>('Box 0')), findsOneWidget); expect(find.byKey(const ValueKey<String>('Box 0')), findsOneWidget);
...@@ -784,7 +781,7 @@ void main() { ...@@ -784,7 +781,7 @@ void main() {
// Getting the tester to simulate a life-like fling is difficult. // Getting the tester to simulate a life-like fling is difficult.
// Instead, just manually drive the activity with a ballistic simulation as // Instead, just manually drive the activity with a ballistic simulation as
// if the user has flung the list. // if the user has flung the list.
position.activity.delegate.goBallistic(4000); position.activity!.delegate.goBallistic(4000);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -815,7 +812,7 @@ void main() { ...@@ -815,7 +812,7 @@ void main() {
)); ));
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final ScrollPosition position = Scrollable.of(find.byType(SizedBox).evaluate().first).position; final ScrollPosition position = Scrollable.of(find.byType(SizedBox).evaluate().first)!.position;
expect(find.byKey(const ValueKey<String>('Cheap box 0')), findsOneWidget); expect(find.byKey(const ValueKey<String>('Cheap box 0')), findsOneWidget);
expect(find.byKey(const ValueKey<String>('Cheap box 52')), findsNothing); expect(find.byKey(const ValueKey<String>('Cheap box 52')), findsNothing);
...@@ -826,7 +823,7 @@ void main() { ...@@ -826,7 +823,7 @@ void main() {
// Getting the tester to simulate a life-like fling is difficult. // Getting the tester to simulate a life-like fling is difficult.
// Instead, just manually drive the activity with a ballistic simulation as // Instead, just manually drive the activity with a ballistic simulation as
// if the user has flung the list. // if the user has flung the list.
position.activity.delegate.goBallistic(4000); position.activity!.delegate.goBallistic(4000);
await tester.pumpAndSettle(); await tester.pumpAndSettle();
...@@ -1010,7 +1007,7 @@ void main() { ...@@ -1010,7 +1007,7 @@ void main() {
// ignore: must_be_immutable // ignore: must_be_immutable
class SuperPessimisticScrollPhysics extends ScrollPhysics { class SuperPessimisticScrollPhysics extends ScrollPhysics {
SuperPessimisticScrollPhysics({ScrollPhysics parent}) : super(parent: parent); SuperPessimisticScrollPhysics({ScrollPhysics? parent}) : super(parent: parent);
int count = 0; int count = 0;
...@@ -1021,13 +1018,13 @@ class SuperPessimisticScrollPhysics extends ScrollPhysics { ...@@ -1021,13 +1018,13 @@ class SuperPessimisticScrollPhysics extends ScrollPhysics {
} }
@override @override
ScrollPhysics applyTo(ScrollPhysics ancestor) { ScrollPhysics applyTo(ScrollPhysics? ancestor) {
return SuperPessimisticScrollPhysics(parent: buildParent(ancestor)); return SuperPessimisticScrollPhysics(parent: buildParent(ancestor));
} }
} }
class ExtraSuperPessimisticScrollPhysics extends ScrollPhysics { class ExtraSuperPessimisticScrollPhysics extends ScrollPhysics {
const ExtraSuperPessimisticScrollPhysics({ScrollPhysics parent}) : super(parent: parent); const ExtraSuperPessimisticScrollPhysics({ScrollPhysics? parent}) : super(parent: parent);
@override @override
bool recommendDeferredLoading(double velocity, ScrollMetrics metrics, BuildContext context) { bool recommendDeferredLoading(double velocity, ScrollMetrics metrics, BuildContext context) {
...@@ -1035,7 +1032,7 @@ class ExtraSuperPessimisticScrollPhysics extends ScrollPhysics { ...@@ -1035,7 +1032,7 @@ class ExtraSuperPessimisticScrollPhysics extends ScrollPhysics {
} }
@override @override
ScrollPhysics applyTo(ScrollPhysics ancestor) { ScrollPhysics applyTo(ScrollPhysics? ancestor) {
return ExtraSuperPessimisticScrollPhysics(parent: buildParent(ancestor)); return ExtraSuperPessimisticScrollPhysics(parent: buildParent(ancestor));
} }
} }
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/src/physics/utils.dart' show nearEqual; import 'package:flutter/src/physics/utils.dart' show nearEqual;
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -21,10 +19,10 @@ ScrollbarPainter _buildPainter({ ...@@ -21,10 +19,10 @@ ScrollbarPainter _buildPainter({
double thickness = _kThickness, double thickness = _kThickness,
double mainAxisMargin = 0.0, double mainAxisMargin = 0.0,
double crossAxisMargin = 0.0, double crossAxisMargin = 0.0,
Radius radius, Radius? radius,
double minLength = _kMinThumbExtent, double minLength = _kMinThumbExtent,
double minOverscrollLength, double? minOverscrollLength,
ScrollMetrics scrollMetrics, required ScrollMetrics scrollMetrics,
}) { }) {
return ScrollbarPainter( return ScrollbarPainter(
color: color, color: color,
...@@ -56,7 +54,6 @@ void main() { ...@@ -56,7 +54,6 @@ void main() {
Rect captureRect() => testCanvas.rects.removeLast(); Rect captureRect() => testCanvas.rects.removeLast();
tearDown(() { tearDown(() {
painter = null;
testCanvas.rects.clear(); testCanvas.rects.clear();
}); });
...@@ -136,14 +133,14 @@ void main() { ...@@ -136,14 +133,14 @@ void main() {
startingMetrics.copyWith(pixels: maxExtent - 0.01), startingMetrics.copyWith(pixels: maxExtent - 0.01),
]; ];
double lastCoefficient; late double lastCoefficient;
for (final ScrollMetrics metrics in metricsList) { for (final ScrollMetrics metrics in metricsList) {
painter.update(metrics, metrics.axisDirection); painter.update(metrics, metrics.axisDirection);
painter.paint(testCanvas, size); painter.paint(testCanvas, size);
final Rect rect = captureRect(); final Rect rect = captureRect();
final double newCoefficient = metrics.pixels/rect.top; final double newCoefficient = metrics.pixels/rect.top;
lastCoefficient ??= newCoefficient; lastCoefficient = newCoefficient;
expect(rect.top >= 0, true); expect(rect.top >= 0, true);
expect(rect.bottom <= maxExtent, true); expect(rect.bottom <= maxExtent, true);
...@@ -483,13 +480,12 @@ void main() { ...@@ -483,13 +480,12 @@ void main() {
) )
.takeWhile((ScrollMetrics metrics) => !metrics.outOfRange); .takeWhile((ScrollMetrics metrics) => !metrics.outOfRange);
Rect previousRect; Rect? previousRect;
for (final ScrollMetrics metrics in metricsList) { for (final ScrollMetrics metrics in metricsList) {
painter.update(metrics, metrics.axisDirection); painter.update(metrics, metrics.axisDirection);
painter.paint(testCanvas, size); painter.paint(testCanvas, size);
final Rect rect = captureRect(); final Rect rect = captureRect();
if (previousRect != null) { if (previousRect != null) {
if (rect.height == size.height) { if (rect.height == size.height) {
// Size of the scrollbar is too large for the view port // Size of the scrollbar is too large for the view port
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -15,7 +13,7 @@ import 'package:flutter/gestures.dart'; ...@@ -15,7 +13,7 @@ import 'package:flutter/gestures.dart';
import '../widgets/semantics_tester.dart'; import '../widgets/semantics_tester.dart';
class MockClipboard { class MockClipboard {
Object _clipboardData = <String, dynamic>{ dynamic _clipboardData = <String, dynamic>{
'text': null, 'text': null,
}; };
...@@ -52,7 +50,7 @@ class WidgetsLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocaliza ...@@ -52,7 +50,7 @@ class WidgetsLocalizationsDelegate extends LocalizationsDelegate<WidgetsLocaliza
bool shouldReload(WidgetsLocalizationsDelegate old) => false; bool shouldReload(WidgetsLocalizationsDelegate old) => false;
} }
Widget overlay({ Widget child }) { Widget overlay({ Widget? child }) {
final OverlayEntry entry = OverlayEntry( final OverlayEntry entry = OverlayEntry(
builder: (BuildContext context) { builder: (BuildContext context) {
return Center( return Center(
...@@ -86,7 +84,7 @@ Widget overlayWithEntry(OverlayEntry entry) { ...@@ -86,7 +84,7 @@ Widget overlayWithEntry(OverlayEntry entry) {
); );
} }
Widget boilerplate({ Widget child }) { Widget boilerplate({ Widget? child }) {
return Localizations( return Localizations(
locale: const Locale('en', 'US'), locale: const Locale('en', 'US'),
delegates: <LocalizationsDelegate<dynamic>>[ delegates: <LocalizationsDelegate<dynamic>>[
...@@ -139,7 +137,7 @@ void main() { ...@@ -139,7 +137,7 @@ void main() {
final RenderObject root = tester.renderObject(find.byType(EditableText)); final RenderObject root = tester.renderObject(find.byType(EditableText));
expect(root, isNotNull); expect(root, isNotNull);
RenderEditable renderEditable; late RenderEditable renderEditable;
void recursiveFinder(RenderObject child) { void recursiveFinder(RenderObject child) {
if (child is RenderEditable) { if (child is RenderEditable) {
renderEditable = child; renderEditable = child;
...@@ -179,8 +177,8 @@ void main() { ...@@ -179,8 +177,8 @@ void main() {
Widget selectableTextBuilder({ Widget selectableTextBuilder({
String text = '', String text = '',
int maxLines = 1, int? maxLines = 1,
int minLines, int? minLines,
}) { }) {
return boilerplate( return boilerplate(
child: SelectableText( child: SelectableText(
...@@ -625,7 +623,7 @@ void main() { ...@@ -625,7 +623,7 @@ void main() {
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
// Collapse selection should not paint. // Collapse selection should not paint.
expect(editableText.selectionOverlay.handlesAreVisible, isFalse); expect(editableText.selectionOverlay!.handlesAreVisible, isFalse);
// Long press on the 't' character of text 'selectable' to show context menu. // Long press on the 't' character of text 'selectable' to show context menu.
const int dIndex = 5; const int dIndex = 5;
final Offset dPos = textOffsetToPosition(tester, dIndex); final Offset dPos = textOffsetToPosition(tester, dIndex);
...@@ -1328,7 +1326,7 @@ void main() { ...@@ -1328,7 +1326,7 @@ void main() {
}); });
group('Keyboard Tests', () { group('Keyboard Tests', () {
TextEditingController controller; late TextEditingController controller;
Future<void> setupWidget(WidgetTester tester, String text) async { Future<void> setupWidget(WidgetTester tester, String text) async {
final FocusNode focusNode = FocusNode(); final FocusNode focusNode = FocusNode();
...@@ -2099,7 +2097,7 @@ void main() { ...@@ -2099,7 +2097,7 @@ void main() {
testWidgets('SelectableText change selection with semantics', (WidgetTester tester) async { testWidgets('SelectableText change selection with semantics', (WidgetTester tester) async {
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner; final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner!;
final Key key = UniqueKey(); final Key key = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -2204,7 +2202,7 @@ void main() { ...@@ -2204,7 +2202,7 @@ void main() {
const String testValue = 'Hello'; const String testValue = 'Hello';
final SemanticsTester semantics = SemanticsTester(tester); final SemanticsTester semantics = SemanticsTester(tester);
final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner; final SemanticsOwner semanticsOwner = tester.binding.pipelineOwner.semanticsOwner!;
final Key key = UniqueKey(); final Key key = UniqueKey();
await tester.pumpWidget( await tester.pumpWidget(
...@@ -3694,8 +3692,8 @@ void main() { ...@@ -3694,8 +3692,8 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.handlesAreVisible, isTrue); expect(editableText.selectionOverlay!.handlesAreVisible, isTrue);
expect(editableText.selectionOverlay.toolbarIsVisible, isTrue); expect(editableText.selectionOverlay!.toolbarIsVisible, isTrue);
}); });
testWidgets('Double tap shows handles and toolbar', (WidgetTester tester) async { testWidgets('Double tap shows handles and toolbar', (WidgetTester tester) async {
...@@ -3715,8 +3713,8 @@ void main() { ...@@ -3715,8 +3713,8 @@ void main() {
await tester.pump(); await tester.pump();
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.handlesAreVisible, isTrue); expect(editableText.selectionOverlay!.handlesAreVisible, isTrue);
expect(editableText.selectionOverlay.toolbarIsVisible, isTrue); expect(editableText.selectionOverlay!.toolbarIsVisible, isTrue);
}); });
testWidgets( testWidgets(
...@@ -3743,8 +3741,8 @@ void main() { ...@@ -3743,8 +3741,8 @@ void main() {
await tester.pump(); await tester.pump();
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.toolbarIsVisible, isFalse); expect(editableText.selectionOverlay!.toolbarIsVisible, isFalse);
expect(editableText.selectionOverlay.handlesAreVisible, isFalse); expect(editableText.selectionOverlay!.handlesAreVisible, isFalse);
}, },
); );
...@@ -3772,8 +3770,8 @@ void main() { ...@@ -3772,8 +3770,8 @@ void main() {
await tester.pump(); await tester.pump();
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.toolbarIsVisible, isFalse); expect(editableText.selectionOverlay!.toolbarIsVisible, isFalse);
expect(editableText.selectionOverlay.handlesAreVisible, isFalse); expect(editableText.selectionOverlay!.handlesAreVisible, isFalse);
}, },
); );
...@@ -3805,8 +3803,8 @@ void main() { ...@@ -3805,8 +3803,8 @@ void main() {
await tester.pump(); await tester.pump();
final EditableTextState editableText = tester.state(find.byType(EditableText)); final EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.toolbarIsVisible, isFalse); expect(editableText.selectionOverlay!.toolbarIsVisible, isFalse);
expect(editableText.selectionOverlay.handlesAreVisible, isFalse); expect(editableText.selectionOverlay!.handlesAreVisible, isFalse);
}, },
); );
...@@ -3928,7 +3926,7 @@ void main() { ...@@ -3928,7 +3926,7 @@ void main() {
await tester.pump(); await tester.pump();
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text); expect(RendererBinding.instance!.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text);
}); });
testWidgets('The handles show after pressing Select All', (WidgetTester tester) async { testWidgets('The handles show after pressing Select All', (WidgetTester tester) async {
...@@ -3950,8 +3948,8 @@ void main() { ...@@ -3950,8 +3948,8 @@ void main() {
expect(find.text('Paste'), findsNothing); expect(find.text('Paste'), findsNothing);
expect(find.text('Cut'), findsNothing); expect(find.text('Cut'), findsNothing);
EditableTextState editableText = tester.state(find.byType(EditableText)); EditableTextState editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.handlesAreVisible, isTrue); expect(editableText.selectionOverlay!.handlesAreVisible, isTrue);
expect(editableText.selectionOverlay.toolbarIsVisible, isTrue); expect(editableText.selectionOverlay!.toolbarIsVisible, isTrue);
await tester.tap(find.text('Select all')); await tester.tap(find.text('Select all'));
await tester.pump(); await tester.pump();
...@@ -3960,7 +3958,7 @@ void main() { ...@@ -3960,7 +3958,7 @@ void main() {
expect(find.text('Paste'), findsNothing); expect(find.text('Paste'), findsNothing);
expect(find.text('Cut'), findsNothing); expect(find.text('Cut'), findsNothing);
editableText = tester.state(find.byType(EditableText)); editableText = tester.state(find.byType(EditableText));
expect(editableText.selectionOverlay.handlesAreVisible, isTrue); expect(editableText.selectionOverlay!.handlesAreVisible, isTrue);
}, },
variant: const TargetPlatformVariant(<TargetPlatform>{ variant: const TargetPlatformVariant(<TargetPlatform>{
TargetPlatform.android, TargetPlatform.android,
...@@ -3991,7 +3989,7 @@ void main() { ...@@ -3991,7 +3989,7 @@ void main() {
await tester.pumpAndSettle(); await tester.pumpAndSettle();
final EditableTextState state = tester.state(find.byType(EditableText)); final EditableTextState state = tester.state(find.byType(EditableText));
expect(state.selectionOverlay.handlesAreVisible, isFalse); expect(state.selectionOverlay!.handlesAreVisible, isFalse);
expect( expect(
state.currentTextEditingValue.selection, state.currentTextEditingValue.selection,
const TextSelection.collapsed(offset: 0), const TextSelection.collapsed(offset: 0),
...@@ -4007,7 +4005,7 @@ void main() { ...@@ -4007,7 +4005,7 @@ void main() {
state.currentTextEditingValue.selection, state.currentTextEditingValue.selection,
const TextSelection(baseOffset: 2, extentOffset: 7), const TextSelection(baseOffset: 2, extentOffset: 7),
); );
expect(state.selectionOverlay.handlesAreVisible, isFalse); expect(state.selectionOverlay!.handlesAreVisible, isFalse);
} }
}); });
...@@ -4019,7 +4017,7 @@ void main() { ...@@ -4019,7 +4017,7 @@ void main() {
home: Material( home: Material(
child: SelectableText( child: SelectableText(
'abc def ghi', 'abc def ghi',
onSelectionChanged: (TextSelection selection, SelectionChangedCause cause) { onSelectionChanged: (TextSelection selection, SelectionChangedCause? cause) {
onSelectionChangedCallCount += 1; onSelectionChangedCallCount += 1;
}, },
), ),
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -36,7 +34,11 @@ void main() { ...@@ -36,7 +34,11 @@ void main() {
}); });
} }
Widget buildTestWidgets({ bool excludeSemantics, String label, bool isSemanticsBoundary }) { Widget buildTestWidgets({
required bool excludeSemantics,
required String label,
required bool isSemanticsBoundary,
}) {
return Directionality( return Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
child: Semantics( child: Semantics(
...@@ -65,10 +67,10 @@ Widget buildTestWidgets({ bool excludeSemantics, String label, bool isSemanticsB ...@@ -65,10 +67,10 @@ Widget buildTestWidgets({ bool excludeSemantics, String label, bool isSemanticsB
class TestWidget extends SingleChildRenderObjectWidget { class TestWidget extends SingleChildRenderObjectWidget {
const TestWidget({ const TestWidget({
Key key, Key? key,
Widget child, required Widget child,
this.label, required this.label,
this.isSemanticBoundary, required this.isSemanticBoundary,
}) : super(key: key, child: child); }) : super(key: key, child: child);
final String label; final String label;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -125,7 +123,7 @@ void main() { ...@@ -125,7 +123,7 @@ void main() {
)); ));
int changeCount = 0; int changeCount = 0;
tester.binding.pipelineOwner.semanticsOwner.addListener(() { tester.binding.pipelineOwner.semanticsOwner!.addListener(() {
changeCount += 1; changeCount += 1;
}); });
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
......
...@@ -2,13 +2,10 @@ ...@@ -2,13 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:meta/meta.dart';
import 'semantics_tester.dart'; import 'semantics_tester.dart';
...@@ -51,7 +48,7 @@ void main() { ...@@ -51,7 +48,7 @@ void main() {
}); });
} }
Widget buildWidget({ @required String blockedText, bool blocking = true }) { Widget buildWidget({ required String blockedText, bool blocking = true }) {
assert(blockedText != null); assert(blockedText != null);
return Directionality( return Directionality(
textDirection: TextDirection.ltr, textDirection: TextDirection.ltr,
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -139,14 +137,14 @@ void main() { ...@@ -139,14 +137,14 @@ void main() {
} }
class BoundaryBlockSemantics extends SingleChildRenderObjectWidget { class BoundaryBlockSemantics extends SingleChildRenderObjectWidget {
const BoundaryBlockSemantics({ Key key, Widget child }) : super(key: key, child: child); const BoundaryBlockSemantics({ Key? key, required Widget child }) : super(key: key, child: child);
@override @override
RenderBoundaryBlockSemantics createRenderObject(BuildContext context) => RenderBoundaryBlockSemantics(); RenderBoundaryBlockSemantics createRenderObject(BuildContext context) => RenderBoundaryBlockSemantics();
} }
class RenderBoundaryBlockSemantics extends RenderProxyBox { class RenderBoundaryBlockSemantics extends RenderProxyBox {
RenderBoundaryBlockSemantics({ RenderBox child }) : super(child); RenderBoundaryBlockSemantics();
@override @override
void describeSemanticsConfiguration(SemanticsConfiguration config) { void describeSemanticsConfiguration(SemanticsConfiguration config) {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:ui' show window; import 'dart:ui' show window;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -334,8 +332,7 @@ void main() { ...@@ -334,8 +332,7 @@ void main() {
final Key keyTop = UniqueKey(); final Key keyTop = UniqueKey();
final Key keyBottom = UniqueKey(); final Key keyBottom = UniqueKey();
bool valueTop = false; bool? valueTop = false;
const bool valueBottom = true;
await tester.pumpWidget( await tester.pumpWidget(
Directionality( Directionality(
...@@ -347,13 +344,13 @@ void main() { ...@@ -347,13 +344,13 @@ void main() {
Checkbox( Checkbox(
key: keyTop, key: keyTop,
value: valueTop, value: valueTop,
onChanged: (bool newValue) { onChanged: (bool? newValue) {
valueTop = newValue; valueTop = newValue;
}, },
), ),
Checkbox( Checkbox(
key: keyBottom, key: keyBottom,
value: valueBottom, value: false,
onChanged: null, onChanged: null,
), ),
], ],
...@@ -364,14 +361,11 @@ void main() { ...@@ -364,14 +361,11 @@ void main() {
); );
await tester.tap(find.byKey(keyTop)); await tester.tap(find.byKey(keyTop));
expect(valueTop, isTrue); expect(valueTop, isTrue);
valueTop = false; valueTop = false;
expect(valueTop, isFalse); expect(valueTop, isFalse);
await tester.tap(find.byKey(keyBottom)); await tester.tap(find.byKey(keyBottom));
expect(valueTop, isFalse);
expect(valueTop, isFalse); expect(valueTop, isFalse);
}); });
...@@ -395,7 +389,7 @@ void main() { ...@@ -395,7 +389,7 @@ void main() {
key: checkbox, key: checkbox,
child: Checkbox( child: Checkbox(
value: true, value: true,
onChanged: (bool _) { }, onChanged: (bool? _) { },
), ),
), ),
Semantics( Semantics(
...@@ -403,7 +397,7 @@ void main() { ...@@ -403,7 +397,7 @@ void main() {
key: checkboxUnchecked, key: checkboxUnchecked,
child: Checkbox( child: Checkbox(
value: false, value: false,
onChanged: (bool _) { }, onChanged: (bool? _) { },
), ),
), ),
Semantics( Semantics(
...@@ -495,17 +489,17 @@ void main() { ...@@ -495,17 +489,17 @@ void main() {
} }
String _getMessageShownInSemanticsDebugger({ String _getMessageShownInSemanticsDebugger({
@required Key widgetKey, required Key widgetKey,
@required Key debuggerKey, required Key debuggerKey,
@required WidgetTester tester, required WidgetTester tester,
}) { }) {
final dynamic semanticsDebuggerPainter = _getSemanticsDebuggerPainter(debuggerKey: debuggerKey, tester: tester); final dynamic semanticsDebuggerPainter = _getSemanticsDebuggerPainter(debuggerKey: debuggerKey, tester: tester);
return semanticsDebuggerPainter.getMessage(tester.renderObject(find.byKey(widgetKey)).debugSemantics) as String; return semanticsDebuggerPainter.getMessage(tester.renderObject(find.byKey(widgetKey)).debugSemantics) as String;
} }
dynamic _getSemanticsDebuggerPainter({ dynamic _getSemanticsDebuggerPainter({
@required Key debuggerKey, required Key debuggerKey,
@required WidgetTester tester, required WidgetTester tester,
}) { }) {
final CustomPaint customPaint = tester.widgetList(find.descendant( final CustomPaint customPaint = tester.widgetList(find.descendant(
of: find.byKey(debuggerKey), of: find.byKey(debuggerKey),
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/semantics.dart'; import 'package:flutter/semantics.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
...@@ -54,8 +52,8 @@ void main() { ...@@ -54,8 +52,8 @@ void main() {
class TestSemanticsEvent extends SemanticsEvent { class TestSemanticsEvent extends SemanticsEvent {
TestSemanticsEvent({ this.text, this.number }) : super('TestEvent'); TestSemanticsEvent({ this.text, this.number }) : super('TestEvent');
final String text; final String? text;
final int number; final int? number;
@override @override
Map<String, dynamic> getDataMap() { Map<String, dynamic> getDataMap() {
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
...@@ -83,7 +81,11 @@ void main() { ...@@ -83,7 +81,11 @@ void main() {
final Key paddingWidget = GlobalKey(); final Key paddingWidget = GlobalKey();
Widget _buildTestWidget({ bool extraPadding, String text, ScrollController controller }) { Widget _buildTestWidget({
required bool extraPadding,
required String text,
required ScrollController controller,
}) {
return MaterialApp( return MaterialApp(
home: Scaffold( home: Scaffold(
body: Column( body: Column(
...@@ -117,7 +119,11 @@ Widget _buildTestWidget({ bool extraPadding, String text, ScrollController contr ...@@ -117,7 +119,11 @@ Widget _buildTestWidget({ bool extraPadding, String text, ScrollController contr
} }
class ProblemWidget extends StatefulWidget { class ProblemWidget extends StatefulWidget {
const ProblemWidget({Key key, this.extraPadding, this.text}) : super(key: key); const ProblemWidget({
Key? key,
required this.extraPadding,
required this.text,
}) : super(key: key);
final bool extraPadding; final bool extraPadding;
final String text; final String text;
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
......
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