Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
e3184b38
Unverified
Commit
e3184b38
authored
Oct 15, 2020
by
Michael Goderbauer
Committed by
GitHub
Oct 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate some widget tests to NNBD (#68150)
parent
dfc6c438
Changes
35
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
195 additions
and
291 deletions
+195
-291
sliver.dart
packages/flutter/lib/src/widgets/sliver.dart
+6
-4
semantics_test.dart
packages/flutter/test/widgets/semantics_test.dart
+4
-6
semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
...eTestSemanticsExpressionForCurrentSemanticsTree_test.dart
+3
-5
semantics_tester_test.dart
packages/flutter/test/widgets/semantics_tester_test.dart
+0
-2
semantics_traversal_test.dart
packages/flutter/test/widgets/semantics_traversal_test.dart
+5
-7
semantics_zero_surface_size_test.dart
...lutter/test/widgets/semantics_zero_surface_size_test.dart
+0
-2
set_state_1_test.dart
packages/flutter/test/widgets/set_state_1_test.dart
+4
-6
set_state_2_test.dart
packages/flutter/test/widgets/set_state_2_test.dart
+0
-2
set_state_3_test.dart
packages/flutter/test/widgets/set_state_3_test.dart
+4
-6
set_state_4_test.dart
packages/flutter/test/widgets/set_state_4_test.dart
+1
-3
set_state_5_test.dart
packages/flutter/test/widgets/set_state_5_test.dart
+1
-3
shader_mask_test.dart
packages/flutter/test/widgets/shader_mask_test.dart
+1
-3
shadow_test.dart
packages/flutter/test/widgets/shadow_test.dart
+2
-4
shape_decoration_test.dart
packages/flutter/test/widgets/shape_decoration_test.dart
+0
-2
shortcuts_test.dart
packages/flutter/test/widgets/shortcuts_test.dart
+9
-11
shrink_wrapping_viewport_test.dart
...s/flutter/test/widgets/shrink_wrapping_viewport_test.dart
+0
-2
simple_semantics_test.dart
packages/flutter/test/widgets/simple_semantics_test.dart
+0
-2
single_child_scroll_view_test.dart
...s/flutter/test/widgets/single_child_scroll_view_test.dart
+20
-20
size_changed_layout_notification_test.dart
...r/test/widgets/size_changed_layout_notification_test.dart
+0
-2
sized_box_test.dart
packages/flutter/test/widgets/sized_box_test.dart
+14
-16
sliver_appbar_opacity_test.dart
...ages/flutter/test/widgets/sliver_appbar_opacity_test.dart
+25
-27
sliver_constraints_test.dart
packages/flutter/test/widgets/sliver_constraints_test.dart
+1
-3
sliver_fill_remaining_test.dart
...ages/flutter/test/widgets/sliver_fill_remaining_test.dart
+1
-3
sliver_fill_viewport_test.dart
packages/flutter/test/widgets/sliver_fill_viewport_test.dart
+2
-4
sliver_list_test.dart
packages/flutter/test/widgets/sliver_list_test.dart
+1
-3
sliver_prototype_item_extent_test.dart
...utter/test/widgets/sliver_prototype_item_extent_test.dart
+4
-6
sliver_semantics_test.dart
packages/flutter/test/widgets/sliver_semantics_test.dart
+0
-2
sliver_visibility_test.dart
packages/flutter/test/widgets/sliver_visibility_test.dart
+41
-43
slivers_appbar_floating_pinned_test.dart
...ter/test/widgets/slivers_appbar_floating_pinned_test.dart
+9
-11
slivers_appbar_floating_test.dart
...es/flutter/test/widgets/slivers_appbar_floating_test.dart
+5
-7
slivers_appbar_pinned_test.dart
...ages/flutter/test/widgets/slivers_appbar_pinned_test.dart
+6
-8
slivers_appbar_scrolling_test.dart
...s/flutter/test/widgets/slivers_appbar_scrolling_test.dart
+4
-6
slivers_appbar_stretch_test.dart
...ges/flutter/test/widgets/slivers_appbar_stretch_test.dart
+19
-53
slivers_block_global_key_test.dart
...s/flutter/test/widgets/slivers_block_global_key_test.dart
+2
-4
slivers_block_test.dart
packages/flutter/test/widgets/slivers_block_test.dart
+1
-3
No files found.
packages/flutter/lib/src/widgets/sliver.dart
View file @
e3184b38
...
@@ -213,11 +213,13 @@ class _SaltedValueKey extends ValueKey<Key>{
...
@@ -213,11 +213,13 @@ class _SaltedValueKey extends ValueKey<Key>{
const
_SaltedValueKey
(
Key
key
):
assert
(
key
!=
null
),
super
(
key
);
const
_SaltedValueKey
(
Key
key
):
assert
(
key
!=
null
),
super
(
key
);
}
}
/// Called to find the new index of a child based on its
key
in case of
/// Called to find the new index of a child based on its
`key`
in case of
/// reordering.
/// reordering.
///
///
/// If the child with the `key` is no longer present, null is returned.
///
/// Used by [SliverChildBuilderDelegate.findChildIndexCallback].
/// Used by [SliverChildBuilderDelegate.findChildIndexCallback].
typedef
ChildIndexGetter
=
int
Function
(
Key
key
);
typedef
ChildIndexGetter
=
int
?
Function
(
Key
key
);
/// A delegate that supplies children for slivers using a builder callback.
/// A delegate that supplies children for slivers using a builder callback.
///
///
...
@@ -424,8 +426,8 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
...
@@ -424,8 +426,8 @@ class SliverChildBuilderDelegate extends SliverChildDelegate {
/// when the order in which children are returned from [builder] changes.
/// when the order in which children are returned from [builder] changes.
/// This may result in state-loss.
/// This may result in state-loss.
///
///
/// This callback should take an input [Key], and
I
t should return the
/// This callback should take an input [Key], and
i
t should return the
/// index of the child element with
associated key,
null if not found.
/// index of the child element with
that associated key, or
null if not found.
final
ChildIndexGetter
?
findChildIndexCallback
;
final
ChildIndexGetter
?
findChildIndexCallback
;
@override
@override
...
...
packages/flutter/test/widgets/semantics_test.dart
View file @
e3184b38
...
@@ -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:math'
;
import
'dart:math'
;
import
'dart:ui'
;
import
'dart:ui'
;
...
@@ -21,7 +19,7 @@ void main() {
...
@@ -21,7 +19,7 @@ void main() {
});
});
testWidgets
(
'Semantics shutdown and restart'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Semantics shutdown and restart'
,
(
WidgetTester
tester
)
async
{
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
SemanticsTester
?
semantics
=
SemanticsTester
(
tester
);
final
TestSemantics
expectedSemantics
=
TestSemantics
.
root
(
final
TestSemantics
expectedSemantics
=
TestSemantics
.
root
(
children:
<
TestSemantics
>[
children:
<
TestSemantics
>[
...
@@ -436,7 +434,7 @@ void main() {
...
@@ -436,7 +434,7 @@ void main() {
expect
(
semantics
,
hasSemantics
(
expectedSemantics
));
expect
(
semantics
,
hasSemantics
(
expectedSemantics
));
// Do the actions work?
// Do the actions work?
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
;
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!
;
int
expectedLength
=
1
;
int
expectedLength
=
1
;
for
(
final
SemanticsAction
action
in
allActions
)
{
for
(
final
SemanticsAction
action
in
allActions
)
{
switch
(
action
)
{
switch
(
action
)
{
...
@@ -574,7 +572,7 @@ void main() {
...
@@ -574,7 +572,7 @@ void main() {
],
],
);
);
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
;
final
SemanticsOwner
semanticsOwner
=
tester
.
binding
.
pipelineOwner
.
semanticsOwner
!
;
expect
(
semantics
,
hasSemantics
(
expectedSemantics
));
expect
(
semantics
,
hasSemantics
(
expectedSemantics
));
semanticsOwner
.
performAction
(
expectedId
,
SemanticsAction
.
tap
);
semanticsOwner
.
performAction
(
expectedId
,
SemanticsAction
.
tap
);
...
@@ -1101,5 +1099,5 @@ void main() {
...
@@ -1101,5 +1099,5 @@ void main() {
}
}
class
CustomSortKey
extends
OrdinalSortKey
{
class
CustomSortKey
extends
OrdinalSortKey
{
const
CustomSortKey
(
double
order
,
{
String
name
})
:
super
(
order
,
name:
name
);
const
CustomSortKey
(
double
order
,
{
String
?
name
})
:
super
(
order
,
name:
name
);
}
}
packages/flutter/test/widgets/semantics_tester_generateTestSemanticsExpressionForCurrentSemanticsTree_test.dart
View file @
e3184b38
...
@@ -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
@TestOn
(
'!chrome'
)
@TestOn
(
'!chrome'
)
import
'dart:io'
;
import
'dart:io'
;
...
@@ -62,10 +60,10 @@ void _tests() {
...
@@ -62,10 +60,10 @@ void _tests() {
.
join
(
'
\n
'
)
.
join
(
'
\n
'
)
.
trim
()
+
','
;
.
trim
()
+
','
;
File
findThisTestFile
(
Directory
directory
)
{
File
?
findThisTestFile
(
Directory
directory
)
{
for
(
final
FileSystemEntity
entity
in
directory
.
listSync
())
{
for
(
final
FileSystemEntity
entity
in
directory
.
listSync
())
{
if
(
entity
is
Directory
)
{
if
(
entity
is
Directory
)
{
final
File
childSearch
=
findThisTestFile
(
entity
);
final
File
?
childSearch
=
findThisTestFile
(
entity
);
if
(
childSearch
!=
null
)
{
if
(
childSearch
!=
null
)
{
return
childSearch
;
return
childSearch
;
}
}
...
@@ -76,7 +74,7 @@ void _tests() {
...
@@ -76,7 +74,7 @@ void _tests() {
return
null
;
return
null
;
}
}
final
File
thisTestFile
=
findThisTestFile
(
Directory
.
current
);
final
File
thisTestFile
=
findThisTestFile
(
Directory
.
current
)
!
;
expect
(
thisTestFile
,
isNotNull
);
expect
(
thisTestFile
,
isNotNull
);
String
expectedCode
=
thisTestFile
.
readAsStringSync
();
String
expectedCode
=
thisTestFile
.
readAsStringSync
();
expectedCode
=
expectedCode
.
substring
(
expectedCode
=
expectedCode
.
substring
(
...
...
packages/flutter/test/widgets/semantics_tester_test.dart
View file @
e3184b38
...
@@ -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/gestures.dart'
;
import
'package:flutter/gestures.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'
;
...
...
packages/flutter/test/widgets/semantics_traversal_test.dart
View file @
e3184b38
...
@@ -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:collection'
;
import
'dart:collection'
;
import
'dart:math'
as
math
;
import
'dart:math'
as
math
;
import
'dart:ui'
;
import
'dart:ui'
;
...
@@ -293,9 +291,9 @@ class TraversalTester {
...
@@ -293,9 +291,9 @@ class TraversalTester {
final
SemanticsTester
semantics
;
final
SemanticsTester
semantics
;
Future
<
void
>
test
({
Future
<
void
>
test
({
TextDirection
textDirection
,
required
TextDirection
textDirection
,
Map
<
String
,
Rect
>
children
,
required
Map
<
String
,
Rect
>
children
,
String
expectedTraversal
,
required
String
expectedTraversal
,
})
async
{
})
async
{
assert
(
children
is
LinkedHashMap
);
assert
(
children
is
LinkedHashMap
);
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -314,8 +312,8 @@ class TraversalTester {
...
@@ -314,8 +312,8 @@ class TraversalTester {
explicitChildNodes:
true
,
explicitChildNodes:
true
,
label:
label
,
label:
label
,
child:
SizedBox
(
child:
SizedBox
(
width:
children
[
label
].
width
,
width:
children
[
label
]
!
.
width
,
height:
children
[
label
].
height
,
height:
children
[
label
]
!
.
height
,
),
),
),
),
);
);
...
...
packages/flutter/test/widgets/semantics_zero_surface_size_test.dart
View file @
e3184b38
...
@@ -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'
;
...
...
packages/flutter/test/widgets/set_state_1_test.dart
View file @
e3184b38
...
@@ -2,13 +2,11 @@
...
@@ -2,13 +2,11 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
class
Inside
extends
StatefulWidget
{
class
Inside
extends
StatefulWidget
{
const
Inside
({
Key
key
})
:
super
(
key:
key
);
const
Inside
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
InsideState
createState
()
=>
InsideState
();
InsideState
createState
()
=>
InsideState
();
}
}
...
@@ -29,11 +27,11 @@ class InsideState extends State<Inside> {
...
@@ -29,11 +27,11 @@ class InsideState extends State<Inside> {
class
Middle
extends
StatefulWidget
{
class
Middle
extends
StatefulWidget
{
const
Middle
({
const
Middle
({
Key
key
,
Key
?
key
,
this
.
child
,
this
.
child
,
})
:
super
(
key:
key
);
})
:
super
(
key:
key
);
final
Inside
child
;
final
Inside
?
child
;
@override
@override
MiddleState
createState
()
=>
MiddleState
();
MiddleState
createState
()
=>
MiddleState
();
...
@@ -54,7 +52,7 @@ class MiddleState extends State<Middle> {
...
@@ -54,7 +52,7 @@ class MiddleState extends State<Middle> {
}
}
class
Outside
extends
StatefulWidget
{
class
Outside
extends
StatefulWidget
{
const
Outside
({
Key
key
})
:
super
(
key:
key
);
const
Outside
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
OutsideState
createState
()
=>
OutsideState
();
OutsideState
createState
()
=>
OutsideState
();
}
}
...
...
packages/flutter/test/widgets/set_state_2_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
...
packages/flutter/test/widgets/set_state_3_test.dart
View file @
e3184b38
...
@@ -2,15 +2,13 @@
...
@@ -2,15 +2,13 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
ChangerState
changer
;
late
ChangerState
changer
;
class
Changer
extends
StatefulWidget
{
class
Changer
extends
StatefulWidget
{
const
Changer
(
this
.
child
,
{
Key
key
})
:
super
(
key:
key
);
const
Changer
(
this
.
child
,
{
Key
?
key
})
:
super
(
key:
key
);
final
Widget
child
;
final
Widget
child
;
...
@@ -34,7 +32,7 @@ class ChangerState extends State<Changer> {
...
@@ -34,7 +32,7 @@ class ChangerState extends State<Changer> {
}
}
class
Wrapper
extends
StatelessWidget
{
class
Wrapper
extends
StatelessWidget
{
const
Wrapper
(
this
.
child
,
{
Key
key
})
:
super
(
key:
key
);
const
Wrapper
(
this
.
child
,
{
Key
?
key
})
:
super
(
key:
key
);
final
Widget
child
;
final
Widget
child
;
...
@@ -43,7 +41,7 @@ class Wrapper extends StatelessWidget {
...
@@ -43,7 +41,7 @@ class Wrapper extends StatelessWidget {
}
}
class
Leaf
extends
StatefulWidget
{
class
Leaf
extends
StatefulWidget
{
const
Leaf
({
Key
key
})
:
super
(
key:
key
);
const
Leaf
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
LeafState
createState
()
=>
LeafState
();
LeafState
createState
()
=>
LeafState
();
}
}
...
...
packages/flutter/test/widgets/set_state_4_test.dart
View file @
e3184b38
...
@@ -2,13 +2,11 @@
...
@@ -2,13 +2,11 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
class
Changer
extends
StatefulWidget
{
class
Changer
extends
StatefulWidget
{
const
Changer
({
Key
key
})
:
super
(
key:
key
);
const
Changer
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
ChangerState
createState
()
=>
ChangerState
();
ChangerState
createState
()
=>
ChangerState
();
}
}
...
...
packages/flutter/test/widgets/set_state_5_test.dart
View file @
e3184b38
...
@@ -2,13 +2,11 @@
...
@@ -2,13 +2,11 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
class
BadWidget
extends
StatefulWidget
{
class
BadWidget
extends
StatefulWidget
{
const
BadWidget
({
Key
key
})
:
super
(
key:
key
);
const
BadWidget
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
State
<
StatefulWidget
>
createState
()
=>
BadWidgetState
();
State
<
StatefulWidget
>
createState
()
=>
BadWidgetState
();
}
}
...
...
packages/flutter/test/widgets/shader_mask_test.dart
View file @
e3184b38
...
@@ -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
Shader
;
import
'dart:ui'
show
Shader
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -26,7 +24,7 @@ void main() {
...
@@ -26,7 +24,7 @@ void main() {
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/44152
},
skip:
isBrowser
);
// https://github.com/flutter/flutter/issues/44152
testWidgets
(
'Bounds rect includes offset'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Bounds rect includes offset'
,
(
WidgetTester
tester
)
async
{
Rect
shaderBounds
;
late
Rect
shaderBounds
;
Shader
recordShaderBounds
(
Rect
bounds
)
{
Shader
recordShaderBounds
(
Rect
bounds
)
{
shaderBounds
=
bounds
;
shaderBounds
=
bounds
;
return
createShader
(
bounds
);
return
createShader
(
bounds
);
...
...
packages/flutter/test/widgets/shadow_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -79,7 +77,7 @@ void main() {
...
@@ -79,7 +77,7 @@ void main() {
color:
Colors
.
yellow
[
200
],
color:
Colors
.
yellow
[
200
],
child:
PhysicalModel
(
child:
PhysicalModel
(
elevation:
9.0
,
elevation:
9.0
,
color:
Colors
.
blue
[
900
],
color:
Colors
.
blue
[
900
]
!
,
child:
const
SizedBox
(
child:
const
SizedBox
(
height:
100.0
,
height:
100.0
,
width:
100.0
,
width:
100.0
,
...
@@ -111,7 +109,7 @@ void main() {
...
@@ -111,7 +109,7 @@ void main() {
padding:
const
EdgeInsets
.
all
(
150.0
),
padding:
const
EdgeInsets
.
all
(
150.0
),
color:
Colors
.
yellow
[
200
],
color:
Colors
.
yellow
[
200
],
child:
PhysicalShape
(
child:
PhysicalShape
(
color:
Colors
.
green
[
900
],
color:
Colors
.
green
[
900
]
!
,
clipper:
ShapeBorderClipper
(
shape:
BeveledRectangleBorder
(
clipper:
ShapeBorderClipper
(
shape:
BeveledRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
20.0
))),
borderRadius:
BorderRadius
.
circular
(
20.0
))),
elevation:
elevation
,
elevation:
elevation
,
...
...
packages/flutter/test/widgets/shape_decoration_test.dart
View file @
e3184b38
...
@@ -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:typed_data'
;
import
'dart:typed_data'
;
import
'dart:ui'
as
ui
show
Image
;
import
'dart:ui'
as
ui
show
Image
;
...
...
packages/flutter/test/widgets/shortcuts_test.dart
View file @
e3184b38
...
@@ -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/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
...
@@ -11,11 +9,11 @@ import 'package:flutter/src/services/keyboard_key.dart';
...
@@ -11,11 +9,11 @@ import 'package:flutter/src/services/keyboard_key.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'
;
typedef
PostInvokeCallback
=
void
Function
({
Action
<
Intent
>
action
,
Intent
intent
,
BuildContext
context
,
ActionDispatcher
dispatcher
});
typedef
PostInvokeCallback
=
void
Function
({
Action
<
Intent
>
action
,
Intent
intent
,
BuildContext
?
context
,
ActionDispatcher
dispatcher
});
class
TestAction
extends
CallbackAction
<
TestIntent
>
{
class
TestAction
extends
CallbackAction
<
TestIntent
>
{
TestAction
({
TestAction
({
@
required
OnInvokeCallback
onInvoke
,
required
OnInvokeCallback
onInvoke
,
})
:
assert
(
onInvoke
!=
null
),
})
:
assert
(
onInvoke
!=
null
),
super
(
onInvoke:
onInvoke
);
super
(
onInvoke:
onInvoke
);
...
@@ -25,11 +23,11 @@ class TestAction extends CallbackAction<TestIntent> {
...
@@ -25,11 +23,11 @@ class TestAction extends CallbackAction<TestIntent> {
class
TestDispatcher
extends
ActionDispatcher
{
class
TestDispatcher
extends
ActionDispatcher
{
const
TestDispatcher
({
this
.
postInvoke
});
const
TestDispatcher
({
this
.
postInvoke
});
final
PostInvokeCallback
postInvoke
;
final
PostInvokeCallback
?
postInvoke
;
@override
@override
Object
invokeAction
(
Action
<
TestIntent
>
action
,
Intent
intent
,
[
BuildContext
context
])
{
Object
?
invokeAction
(
Action
<
TestIntent
>
action
,
Intent
intent
,
[
BuildContext
?
context
])
{
final
Object
result
=
super
.
invokeAction
(
action
,
intent
,
context
);
final
Object
?
result
=
super
.
invokeAction
(
action
,
intent
,
context
);
postInvoke
?.
call
(
action:
action
,
intent:
intent
,
context:
context
,
dispatcher:
this
);
postInvoke
?.
call
(
action:
action
,
intent:
intent
,
context:
context
,
dispatcher:
this
);
return
result
;
return
result
;
}
}
...
@@ -45,7 +43,7 @@ class TestShortcutManager extends ShortcutManager {
...
@@ -45,7 +43,7 @@ class TestShortcutManager extends ShortcutManager {
List
<
LogicalKeyboardKey
>
keys
;
List
<
LogicalKeyboardKey
>
keys
;
@override
@override
bool
handleKeypress
(
BuildContext
context
,
RawKeyEvent
event
,
{
LogicalKeySet
keysPressed
})
{
bool
handleKeypress
(
BuildContext
context
,
RawKeyEvent
event
,
{
LogicalKeySet
?
keysPressed
})
{
keys
.
add
(
event
.
logicalKey
);
keys
.
add
(
event
.
logicalKey
);
return
super
.
handleKeypress
(
context
,
event
,
keysPressed:
keysPressed
);
return
super
.
handleKeypress
(
context
,
event
,
keysPressed:
keysPressed
);
}
}
...
@@ -239,7 +237,7 @@ void main() {
...
@@ -239,7 +237,7 @@ void main() {
),
),
);
);
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
),
isNotNull
);
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
!
),
isNotNull
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
expect
(
invoked
,
isTrue
);
expect
(
invoked
,
isTrue
);
expect
(
pressedKeys
,
equals
(<
LogicalKeyboardKey
>[
LogicalKeyboardKey
.
shiftLeft
]));
expect
(
pressedKeys
,
equals
(<
LogicalKeyboardKey
>[
LogicalKeyboardKey
.
shiftLeft
]));
...
@@ -277,7 +275,7 @@ void main() {
...
@@ -277,7 +275,7 @@ void main() {
),
),
);
);
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
),
isNotNull
);
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
!
),
isNotNull
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
expect
(
invoked
,
isTrue
);
expect
(
invoked
,
isTrue
);
expect
(
pressedKeys
,
equals
(<
LogicalKeyboardKey
>[
LogicalKeyboardKey
.
shiftLeft
]));
expect
(
pressedKeys
,
equals
(<
LogicalKeyboardKey
>[
LogicalKeyboardKey
.
shiftLeft
]));
...
@@ -317,7 +315,7 @@ void main() {
...
@@ -317,7 +315,7 @@ void main() {
),
),
);
);
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
),
isNotNull
);
expect
(
Shortcuts
.
of
(
containerKey
.
currentContext
!
),
isNotNull
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
await
tester
.
sendKeyDownEvent
(
LogicalKeyboardKey
.
shiftLeft
);
expect
(
invoked
,
isFalse
);
expect
(
invoked
,
isFalse
);
expect
(
pressedKeys
,
isEmpty
);
expect
(
pressedKeys
,
isEmpty
);
...
...
packages/flutter/test/widgets/shrink_wrapping_viewport_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
...
...
packages/flutter/test/widgets/simple_semantics_test.dart
View file @
e3184b38
...
@@ -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'
;
...
...
packages/flutter/test/widgets/single_child_scroll_view_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -15,10 +13,10 @@ import 'semantics_tester.dart';
...
@@ -15,10 +13,10 @@ import 'semantics_tester.dart';
class
TestScrollPosition
extends
ScrollPositionWithSingleContext
{
class
TestScrollPosition
extends
ScrollPositionWithSingleContext
{
TestScrollPosition
({
TestScrollPosition
({
ScrollPhysics
physics
,
required
ScrollPhysics
physics
,
ScrollContext
state
,
required
ScrollContext
state
,
double
initialPixels
=
0.0
,
double
initialPixels
=
0.0
,
ScrollPosition
oldPosition
,
ScrollPosition
?
oldPosition
,
})
:
super
(
})
:
super
(
physics:
physics
,
physics:
physics
,
context:
state
,
context:
state
,
...
@@ -29,7 +27,7 @@ class TestScrollPosition extends ScrollPositionWithSingleContext {
...
@@ -29,7 +27,7 @@ class TestScrollPosition extends ScrollPositionWithSingleContext {
class
TestScrollController
extends
ScrollController
{
class
TestScrollController
extends
ScrollController
{
@override
@override
ScrollPosition
createScrollPosition
(
ScrollPhysics
physics
,
ScrollContext
context
,
ScrollPosition
oldPosition
)
{
ScrollPosition
createScrollPosition
(
ScrollPhysics
physics
,
ScrollContext
context
,
ScrollPosition
?
oldPosition
)
{
return
TestScrollPosition
(
return
TestScrollPosition
(
physics:
physics
,
physics:
physics
,
state:
context
,
state:
context
,
...
@@ -53,7 +51,7 @@ void main() {
...
@@ -53,7 +51,7 @@ void main() {
);
);
// 1st, check that the render object has received the default clip behavior.
// 1st, check that the render object has received the default clip behavior.
final
dynamic
renderObject
=
tester
.
allRenderObjects
.
where
((
RenderObject
o
)
=>
o
.
runtimeType
.
toString
()
==
'_RenderSingleChildViewport'
).
first
;
final
dynamic
renderObject
=
tester
.
allRenderObjects
.
where
((
RenderObject
o
)
=>
o
.
runtimeType
.
toString
()
==
'_RenderSingleChildViewport'
).
first
;
// ignore: unnecessary_nullable_for_final_variable_declarations
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
// 2nd, height == widow.height test: check that the painting context does not call pushClipRect .
// 2nd, height == widow.height test: check that the painting context does not call pushClipRect .
...
@@ -107,7 +105,7 @@ void main() {
...
@@ -107,7 +105,7 @@ void main() {
await
tester
.
pumpWidget
(
SingleChildScrollView
(
child:
Container
(
height:
2000.0
)));
await
tester
.
pumpWidget
(
SingleChildScrollView
(
child:
Container
(
height:
2000.0
)));
// 1st, check that the render object has received the default clip behavior.
// 1st, check that the render object has received the default clip behavior.
final
dynamic
renderObject
=
tester
.
allRenderObjects
.
where
((
RenderObject
o
)
=>
o
.
runtimeType
.
toString
()
==
'_RenderSingleChildViewport'
).
first
;
final
dynamic
renderObject
=
tester
.
allRenderObjects
.
where
((
RenderObject
o
)
=>
o
.
runtimeType
.
toString
()
==
'_RenderSingleChildViewport'
).
first
;
// ignore: unnecessary_nullable_for_final_variable_declarations
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
expect
(
renderObject
.
clipBehavior
,
equals
(
Clip
.
hardEdge
));
// 2nd, check that the painting context has received the default clip behavior.
// 2nd, check that the painting context has received the default clip behavior.
...
@@ -630,7 +628,15 @@ void main() {
...
@@ -630,7 +628,15 @@ void main() {
});
});
testWidgets
(
'Nested SingleChildScrollView showOnScreen'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Nested SingleChildScrollView showOnScreen'
,
(
WidgetTester
tester
)
async
{
final
List
<
List
<
Widget
>>
children
=
List
<
List
<
Widget
>>(
10
);
final
List
<
List
<
Widget
>>
children
=
List
<
List
<
Widget
>>.
generate
(
10
,
(
int
x
)
{
return
List
<
Widget
>.
generate
(
10
,
(
int
y
)
{
return
SizedBox
(
key:
UniqueKey
(),
height:
100.0
,
width:
100.0
,
);
});
});
ScrollController
controllerX
;
ScrollController
controllerX
;
ScrollController
controllerY
;
ScrollController
controllerY
;
...
@@ -665,17 +671,11 @@ void main() {
...
@@ -665,17 +671,11 @@ void main() {
controller:
controllerX
=
ScrollController
(
initialScrollOffset:
400.0
),
controller:
controllerX
=
ScrollController
(
initialScrollOffset:
400.0
),
scrollDirection:
Axis
.
horizontal
,
scrollDirection:
Axis
.
horizontal
,
child:
Column
(
child:
Column
(
children:
List
<
Widget
>.
generate
(
10
,
(
int
y
)
{
children:
children
.
map
((
List
<
Widget
>
widgets
)
{
return
Row
(
return
Row
(
children:
children
[
y
]
=
List
<
Widget
>.
generate
(
10
,
(
int
x
)
{
children:
widgets
,
return
SizedBox
(
key:
UniqueKey
(),
height:
100.0
,
width:
100.0
,
);
}),
);
);
}),
})
.
toList
()
,
),
),
),
),
),
),
...
@@ -792,9 +792,9 @@ void main() {
...
@@ -792,9 +792,9 @@ void main() {
});
});
group
(
'Nested SingleChildScrollView (same orientation) showOnScreen'
,
()
{
group
(
'Nested SingleChildScrollView (same orientation) showOnScreen'
,
()
{
List
<
Widget
>
children
;
late
List
<
Widget
>
children
;
Future
<
void
>
buildNestedScroller
({
WidgetTester
tester
,
ScrollController
inner
,
ScrollController
outer
})
{
Future
<
void
>
buildNestedScroller
({
required
WidgetTester
tester
,
ScrollController
?
inner
,
ScrollController
?
outer
})
{
return
tester
.
pumpWidget
(
return
tester
.
pumpWidget
(
Directionality
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
...
...
packages/flutter/test/widgets/size_changed_layout_notification_test.dart
View file @
e3184b38
...
@@ -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/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/widgets/sized_box_test.dart
View file @
e3184b38
...
@@ -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/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -48,7 +46,7 @@ void main() {
...
@@ -48,7 +46,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -58,7 +56,7 @@ void main() {
...
@@ -58,7 +56,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -69,7 +67,7 @@ void main() {
...
@@ -69,7 +67,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -80,7 +78,7 @@ void main() {
...
@@ -80,7 +78,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
100.0
,
100.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
100.0
,
100.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -91,7 +89,7 @@ void main() {
...
@@ -91,7 +89,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -100,7 +98,7 @@ void main() {
...
@@ -100,7 +98,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -109,7 +107,7 @@ void main() {
...
@@ -109,7 +107,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
});
});
testWidgets
(
'SizedBox - container child'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'SizedBox - container child'
,
(
WidgetTester
tester
)
async
{
...
@@ -123,7 +121,7 @@ void main() {
...
@@ -123,7 +121,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -134,7 +132,7 @@ void main() {
...
@@ -134,7 +132,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
0.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -146,7 +144,7 @@ void main() {
...
@@ -146,7 +144,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -158,7 +156,7 @@ void main() {
...
@@ -158,7 +156,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
100.0
,
100.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
100.0
,
100.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -170,7 +168,7 @@ void main() {
...
@@ -170,7 +168,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -180,7 +178,7 @@ void main() {
...
@@ -180,7 +178,7 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
800.0
,
600.0
)));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Center
(
Center
(
...
@@ -190,6 +188,6 @@ void main() {
...
@@ -190,6 +188,6 @@ void main() {
),
),
),
),
);
);
expect
(
patient
.
currentContext
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
expect
(
patient
.
currentContext
!
.
size
,
equals
(
const
Size
(
0.0
,
0.0
)));
});
});
}
}
packages/flutter/test/widgets/sliver_appbar_opacity_test.dart
View file @
e3184b38
...
@@ -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/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -21,11 +19,11 @@ void main() {
...
@@ -21,11 +19,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
testWidgets
(
'!pinned && !floating && bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'!pinned && !floating && bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -40,11 +38,11 @@ void main() {
...
@@ -40,11 +38,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
testWidgets
(
'!pinned && floating && !bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'!pinned && floating && !bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -59,11 +57,11 @@ void main() {
...
@@ -59,11 +57,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
testWidgets
(
'!pinned && floating && bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'!pinned && floating && bottom ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -78,11 +76,11 @@ void main() {
...
@@ -78,11 +76,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
testWidgets
(
'pinned && !floating && !bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'pinned && !floating && !bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -97,11 +95,11 @@ void main() {
...
@@ -97,11 +95,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
});
});
testWidgets
(
'pinned && !floating && bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'pinned && !floating && bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -116,11 +114,11 @@ void main() {
...
@@ -116,11 +114,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
});
});
testWidgets
(
'pinned && floating && !bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'pinned && floating && !bottom ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -137,11 +135,11 @@ void main() {
...
@@ -137,11 +135,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
});
});
testWidgets
(
'pinned && floating && bottom && extraToolbarHeight == 0.0 ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'pinned && floating && bottom && extraToolbarHeight == 0.0 ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -158,11 +156,11 @@ void main() {
...
@@ -158,11 +156,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
testWidgets
(
'pinned && floating && bottom && extraToolbarHeight != 0.0 ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'pinned && floating && bottom && extraToolbarHeight != 0.0 ==> 1.0 opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -178,11 +176,11 @@ void main() {
...
@@ -178,11 +176,11 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
});
});
testWidgets
(
'!pinned && !floating && !bottom && extraToolbarHeight != 0.0 ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'!pinned && !floating && !bottom && extraToolbarHeight != 0.0 ==> fade opacity'
,
(
WidgetTester
tester
)
async
{
...
@@ -199,20 +197,20 @@ void main() {
...
@@ -199,20 +197,20 @@ void main() {
);
);
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
final
RenderParagraph
render
=
tester
.
renderObject
(
find
.
text
(
'Hallo Welt!!1'
));
expect
(
render
.
text
.
style
.
color
.
opacity
,
1.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
1.0
);
controller
.
jumpTo
(
collapsedHeight
);
controller
.
jumpTo
(
collapsedHeight
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
text
.
style
.
color
.
opacity
,
0.0
);
expect
(
render
.
text
.
style
!.
color
!
.
opacity
,
0.0
);
});
});
}
}
class
_TestWidget
extends
StatelessWidget
{
class
_TestWidget
extends
StatelessWidget
{
const
_TestWidget
({
const
_TestWidget
({
this
.
pinned
,
required
this
.
pinned
,
this
.
floating
,
required
this
.
floating
,
this
.
bottom
,
required
this
.
bottom
,
this
.
controller
,
this
.
controller
,
this
.
collapsedHeight
,
this
.
collapsedHeight
,
});
});
...
@@ -220,8 +218,8 @@ class _TestWidget extends StatelessWidget {
...
@@ -220,8 +218,8 @@ class _TestWidget extends StatelessWidget {
final
bool
pinned
;
final
bool
pinned
;
final
bool
floating
;
final
bool
floating
;
final
bool
bottom
;
final
bool
bottom
;
final
ScrollController
controller
;
final
ScrollController
?
controller
;
final
double
collapsedHeight
;
final
double
?
collapsedHeight
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
...
...
packages/flutter/test/widgets/sliver_constraints_test.dart
View file @
e3184b38
...
@@ -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'
;
...
@@ -39,7 +37,7 @@ void main() {
...
@@ -39,7 +37,7 @@ void main() {
// can fit in the viewport, and the SliverList doesn't report a child count,
// can fit in the viewport, and the SliverList doesn't report a child count,
// so the SliverList leads to an infinite precedingScrollExtent.
// so the SliverList leads to an infinite precedingScrollExtent.
final
RenderViewport
renderViewport
=
tester
.
renderObject
(
find
.
byType
(
Viewport
));
final
RenderViewport
renderViewport
=
tester
.
renderObject
(
find
.
byType
(
Viewport
));
final
RenderSliver
lastRenderSliver
=
renderViewport
.
lastChild
;
final
RenderSliver
lastRenderSliver
=
renderViewport
.
lastChild
!
;
expect
(
lastRenderSliver
.
constraints
.
precedingScrollExtent
,
double
.
infinity
);
expect
(
lastRenderSliver
.
constraints
.
precedingScrollExtent
,
double
.
infinity
);
});
});
}
}
packages/flutter/test/widgets/sliver_fill_remaining_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -21,7 +19,7 @@ void main() {
...
@@ -21,7 +19,7 @@ void main() {
);
);
Widget
boilerplate
(
Widget
boilerplate
(
List
<
Widget
>
slivers
,
{
List
<
Widget
>
slivers
,
{
ScrollController
controller
,
ScrollController
?
controller
,
Axis
scrollDirection
=
Axis
.
vertical
,
Axis
scrollDirection
=
Axis
.
vertical
,
})
{
})
{
return
MaterialApp
(
return
MaterialApp
(
...
...
packages/flutter/test/widgets/sliver_fill_viewport_test.dart
View file @
e3184b38
...
@@ -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/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -174,7 +172,7 @@ void main() {
...
@@ -174,7 +172,7 @@ void main() {
);
);
final
RenderSliver
boxWithPadding
=
tester
.
renderObject
<
RenderSliver
>(
find
.
byType
(
SliverFillViewport
));
final
RenderSliver
boxWithPadding
=
tester
.
renderObject
<
RenderSliver
>(
find
.
byType
(
SliverFillViewport
));
expect
(
boxWithPadding
.
geometry
.
paintExtent
,
equals
(
600.0
));
expect
(
boxWithPadding
.
geometry
!
.
paintExtent
,
equals
(
600.0
));
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
Directionality
(
Directionality
(
...
@@ -192,6 +190,6 @@ void main() {
...
@@ -192,6 +190,6 @@ void main() {
);
);
final
RenderSliver
boxWithoutPadding
=
tester
.
renderObject
<
RenderSliver
>(
find
.
byType
(
SliverFillViewport
));
final
RenderSliver
boxWithoutPadding
=
tester
.
renderObject
<
RenderSliver
>(
find
.
byType
(
SliverFillViewport
));
expect
(
boxWithoutPadding
.
geometry
.
paintExtent
,
equals
(
300.0
));
expect
(
boxWithoutPadding
.
geometry
!
.
paintExtent
,
equals
(
300.0
));
});
});
}
}
packages/flutter/test/widgets/sliver_list_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -368,7 +366,7 @@ Widget _buildSliverListRenderWidgetChild(List<String> items) {
...
@@ -368,7 +366,7 @@ Widget _buildSliverListRenderWidgetChild(List<String> items) {
Widget
_buildSliverList
(
{
Widget
_buildSliverList
(
{
List
<
int
>
items
=
const
<
int
>[],
List
<
int
>
items
=
const
<
int
>[],
ScrollController
controller
,
ScrollController
?
controller
,
double
itemHeight
=
500.0
,
double
itemHeight
=
500.0
,
double
viewportHeight
=
300.0
,
double
viewportHeight
=
300.0
,
})
{
})
{
...
...
packages/flutter/test/widgets/sliver_prototype_item_extent_test.dart
View file @
e3184b38
...
@@ -2,16 +2,14 @@
...
@@ -2,16 +2,14 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
class
TestItem
extends
StatelessWidget
{
class
TestItem
extends
StatelessWidget
{
const
TestItem
({
Key
key
,
this
.
item
,
this
.
width
,
this
.
height
})
:
super
(
key:
key
);
const
TestItem
({
Key
?
key
,
required
this
.
item
,
this
.
width
,
this
.
height
})
:
super
(
key:
key
);
final
int
item
;
final
int
item
;
final
double
width
;
final
double
?
width
;
final
double
height
;
final
double
?
height
;
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Container
(
return
Container
(
...
@@ -23,7 +21,7 @@ class TestItem extends StatelessWidget {
...
@@ -23,7 +21,7 @@ class TestItem extends StatelessWidget {
}
}
}
}
Widget
buildFrame
(
{
int
count
,
double
width
,
double
height
,
Axis
scrollDirection
})
{
Widget
buildFrame
(
{
int
?
count
,
double
?
width
,
double
?
height
,
Axis
?
scrollDirection
})
{
return
Directionality
(
return
Directionality
(
textDirection:
TextDirection
.
ltr
,
textDirection:
TextDirection
.
ltr
,
child:
CustomScrollView
(
child:
CustomScrollView
(
...
...
packages/flutter/test/widgets/sliver_semantics_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
packages/flutter/test/widgets/sliver_visibility_test.dart
View file @
e3184b38
This diff is collapsed.
Click to expand it.
packages/flutter/test/widgets/slivers_appbar_floating_pinned_test.dart
View file @
e3184b38
...
@@ -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/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
...
@@ -336,15 +334,15 @@ void main() {
...
@@ -336,15 +334,15 @@ void main() {
);
);
final
RenderSliverFloatingPinnedPersistentHeader
render
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
));
final
RenderSliverFloatingPinnedPersistentHeader
render
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
));
expect
(
render
.
minExtent
,
greaterThan
(
availableHeight
));
// Precondition
expect
(
render
.
minExtent
,
greaterThan
(
availableHeight
));
// Precondition
expect
(
render
.
geometry
.
scrollExtent
,
120.0
);
expect
(
render
.
geometry
!
.
scrollExtent
,
120.0
);
expect
(
render
.
geometry
.
paintExtent
,
availableHeight
);
expect
(
render
.
geometry
!
.
paintExtent
,
availableHeight
);
expect
(
render
.
geometry
.
layoutExtent
,
availableHeight
);
expect
(
render
.
geometry
!
.
layoutExtent
,
availableHeight
);
controller
.
jumpTo
(
200.0
);
controller
.
jumpTo
(
200.0
);
await
tester
.
pumpAndSettle
();
await
tester
.
pumpAndSettle
();
expect
(
render
.
geometry
.
scrollExtent
,
120.0
);
expect
(
render
.
geometry
!
.
scrollExtent
,
120.0
);
expect
(
render
.
geometry
.
paintExtent
,
availableHeight
);
expect
(
render
.
geometry
!
.
paintExtent
,
availableHeight
);
expect
(
render
.
geometry
.
layoutExtent
,
0.0
);
expect
(
render
.
geometry
!
.
layoutExtent
,
0.0
);
});
});
testWidgets
(
'Pinned and floating SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Pinned and floating SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
...
@@ -378,7 +376,7 @@ void main() {
...
@@ -378,7 +376,7 @@ void main() {
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
render
.
geometry
.
paintOrigin
,
-
scrollDistance
);
expect
(
render
.
geometry
!
.
paintOrigin
,
-
scrollDistance
);
});
});
testWidgets
(
'Floating SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Floating SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
...
@@ -412,7 +410,7 @@ void main() {
...
@@ -412,7 +410,7 @@ void main() {
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
render
.
geometry
.
paintOrigin
,
-
scrollDistance
);
expect
(
render
.
geometry
!
.
paintOrigin
,
-
scrollDistance
);
});
});
testWidgets
(
'Pinned SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'Pinned SliverAppBar sticks to top the content is scroll down'
,
(
WidgetTester
tester
)
async
{
...
@@ -446,6 +444,6 @@ void main() {
...
@@ -446,6 +444,6 @@ void main() {
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
gesture
.
moveBy
(
const
Offset
(
0
,
scrollDistance
));
await
tester
.
pump
();
await
tester
.
pump
();
expect
(
render
.
geometry
.
paintOrigin
,
-
scrollDistance
);
expect
(
render
.
geometry
!
.
paintOrigin
,
-
scrollDistance
);
});
});
}
}
packages/flutter/test/widgets/slivers_appbar_floating_test.dart
View file @
e3184b38
...
@@ -2,19 +2,17 @@
...
@@ -2,19 +2,17 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
,
bool
visible
)
{
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
,
bool
visible
)
{
final
RenderSliver
target
=
key
.
currentContext
.
findRenderObject
()
as
RenderSliver
;
final
RenderSliver
target
=
key
.
currentContext
!.
findRenderObject
()!
as
RenderSliver
;
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
final
SliverPhysicalParentData
parentData
=
target
.
parentData
as
SliverPhysicalParentData
;
final
SliverPhysicalParentData
parentData
=
target
.
parentData
!
as
SliverPhysicalParentData
;
final
Offset
actual
=
parentData
.
paintOffset
;
final
Offset
actual
=
parentData
.
paintOffset
;
expect
(
actual
,
ideal
);
expect
(
actual
,
ideal
);
final
SliverGeometry
geometry
=
target
.
geometry
;
final
SliverGeometry
geometry
=
target
.
geometry
!
;
expect
(
geometry
.
visible
,
visible
);
expect
(
geometry
.
visible
,
visible
);
}
}
...
@@ -259,7 +257,7 @@ class RenderBigSliver extends RenderSliver {
...
@@ -259,7 +257,7 @@ class RenderBigSliver extends RenderSliver {
markNeedsLayout
();
markNeedsLayout
();
}
}
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
)
as
double
;
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
);
@override
@override
void
performLayout
()
{
void
performLayout
()
{
...
@@ -272,7 +270,7 @@ class RenderBigSliver extends RenderSliver {
...
@@ -272,7 +270,7 @@ class RenderBigSliver extends RenderSliver {
}
}
class
BigSliver
extends
LeafRenderObjectWidget
{
class
BigSliver
extends
LeafRenderObjectWidget
{
const
BigSliver
({
Key
key
,
this
.
height
})
:
super
(
key:
key
);
const
BigSliver
({
Key
?
key
,
required
this
.
height
})
:
super
(
key:
key
);
final
double
height
;
final
double
height
;
...
...
packages/flutter/test/widgets/slivers_appbar_pinned_test.dart
View file @
e3184b38
...
@@ -2,19 +2,17 @@
...
@@ -2,19 +2,17 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
,
bool
visible
)
{
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
,
bool
visible
)
{
final
RenderSliver
target
=
key
.
currentContext
.
findRenderObject
()
as
RenderSliver
;
final
RenderSliver
target
=
key
.
currentContext
!.
findRenderObject
()!
as
RenderSliver
;
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
final
SliverPhysicalParentData
parentData
=
target
.
parentData
as
SliverPhysicalParentData
;
final
SliverPhysicalParentData
parentData
=
target
.
parentData
!
as
SliverPhysicalParentData
;
final
Offset
actual
=
parentData
.
paintOffset
;
final
Offset
actual
=
parentData
.
paintOffset
;
expect
(
actual
,
ideal
);
expect
(
actual
,
ideal
);
final
SliverGeometry
geometry
=
target
.
geometry
;
final
SliverGeometry
geometry
=
target
.
geometry
!
;
expect
(
geometry
.
visible
,
visible
);
expect
(
geometry
.
visible
,
visible
);
}
}
...
@@ -76,7 +74,7 @@ void main() {
...
@@ -76,7 +74,7 @@ void main() {
);
);
await
tester
.
pumpAndSettle
(
const
Duration
(
milliseconds:
10
));
await
tester
.
pumpAndSettle
(
const
Duration
(
milliseconds:
10
));
final
RenderObject
renderObject
=
key
.
currentContext
.
findRenderObject
()
;
final
RenderObject
renderObject
=
key
.
currentContext
!.
findRenderObject
()!
;
// The delegate must only start throwing immediately before calling
// The delegate must only start throwing immediately before calling
// toStringDeep to avoid triggering spurious exceptions.
// toStringDeep to avoid triggering spurious exceptions.
// If the _RenderSliverPinnedPersistentHeaderForWidgets class was not
// If the _RenderSliverPinnedPersistentHeaderForWidgets class was not
...
@@ -348,7 +346,7 @@ class RenderBigSliver extends RenderSliver {
...
@@ -348,7 +346,7 @@ class RenderBigSliver extends RenderSliver {
markNeedsLayout
();
markNeedsLayout
();
}
}
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
)
as
double
;
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
);
@override
@override
void
performLayout
()
{
void
performLayout
()
{
...
@@ -361,7 +359,7 @@ class RenderBigSliver extends RenderSliver {
...
@@ -361,7 +359,7 @@ class RenderBigSliver extends RenderSliver {
}
}
class
BigSliver
extends
LeafRenderObjectWidget
{
class
BigSliver
extends
LeafRenderObjectWidget
{
const
BigSliver
({
Key
key
,
this
.
height
})
:
super
(
key:
key
);
const
BigSliver
({
Key
?
key
,
required
this
.
height
})
:
super
(
key:
key
);
final
double
height
;
final
double
height
;
...
...
packages/flutter/test/widgets/slivers_appbar_scrolling_test.dart
View file @
e3184b38
...
@@ -2,16 +2,14 @@
...
@@ -2,16 +2,14 @@
// 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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
)
{
void
verifyPaintPosition
(
GlobalKey
key
,
Offset
ideal
)
{
final
RenderObject
target
=
key
.
currentContext
.
findRenderObject
()
;
final
RenderObject
target
=
key
.
currentContext
!.
findRenderObject
()!
;
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
expect
(
target
.
parent
,
isA
<
RenderViewport
>());
final
SliverPhysicalParentData
parentData
=
target
.
parentData
as
SliverPhysicalParentData
;
final
SliverPhysicalParentData
parentData
=
target
.
parentData
!
as
SliverPhysicalParentData
;
final
Offset
actual
=
parentData
.
paintOffset
;
final
Offset
actual
=
parentData
.
paintOffset
;
expect
(
actual
,
ideal
);
expect
(
actual
,
ideal
);
}
}
...
@@ -160,7 +158,7 @@ class TestDelegate extends SliverPersistentHeaderDelegate {
...
@@ -160,7 +158,7 @@ class TestDelegate extends SliverPersistentHeaderDelegate {
class
RenderBigSliver
extends
RenderSliver
{
class
RenderBigSliver
extends
RenderSliver
{
static
const
double
height
=
550.0
;
static
const
double
height
=
550.0
;
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
)
as
double
;
double
get
paintExtent
=>
(
height
-
constraints
.
scrollOffset
).
clamp
(
0.0
,
constraints
.
remainingPaintExtent
);
@override
@override
void
performLayout
()
{
void
performLayout
()
{
...
@@ -173,7 +171,7 @@ class RenderBigSliver extends RenderSliver {
...
@@ -173,7 +171,7 @@ class RenderBigSliver extends RenderSliver {
}
}
class
BigSliver
extends
LeafRenderObjectWidget
{
class
BigSliver
extends
LeafRenderObjectWidget
{
const
BigSliver
({
Key
key
})
:
super
(
key:
key
);
const
BigSliver
({
Key
?
key
})
:
super
(
key:
key
);
@override
@override
RenderBigSliver
createRenderObject
(
BuildContext
context
)
{
RenderBigSliver
createRenderObject
(
BuildContext
context
)
{
return
RenderBigSliver
();
return
RenderBigSliver
();
...
...
packages/flutter/test/widgets/slivers_appbar_stretch_test.dart
View file @
e3184b38
...
@@ -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/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
@@ -41,9 +39,9 @@ void main() {
...
@@ -41,9 +39,9 @@ void main() {
final
RenderSliverScrollingPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverScrollingPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
200.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
200.0
));
});
});
testWidgets
(
'does not stretch without overscroll physics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'does not stretch without overscroll physics'
,
(
WidgetTester
tester
)
async
{
...
@@ -76,9 +74,9 @@ void main() {
...
@@ -76,9 +74,9 @@ void main() {
final
RenderSliverScrollingPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverScrollingPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100.0
));
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
});
});
testWidgets
(
'default trigger offset'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'default trigger offset'
,
(
WidgetTester
tester
)
async
{
...
@@ -92,9 +90,8 @@ void main() {
...
@@ -92,9 +90,8 @@ void main() {
SliverAppBar
(
SliverAppBar
(
stretch:
true
,
stretch:
true
,
expandedHeight:
100.0
,
expandedHeight:
100.0
,
onStretchTrigger:
()
{
onStretchTrigger:
()
async
{
didTrigger
=
true
;
didTrigger
=
true
;
return
;
},
},
),
),
SliverToBoxAdapter
(
SliverToBoxAdapter
(
...
@@ -132,9 +129,8 @@ void main() {
...
@@ -132,9 +129,8 @@ void main() {
stretch:
true
,
stretch:
true
,
expandedHeight:
100.0
,
expandedHeight:
100.0
,
stretchTriggerOffset:
150.0
,
stretchTriggerOffset:
150.0
,
onStretchTrigger:
()
{
onStretchTrigger:
()
async
{
didTrigger
=
true
;
didTrigger
=
true
;
return
;
},
},
),
),
SliverToBoxAdapter
(
SliverToBoxAdapter
(
...
@@ -172,9 +168,8 @@ void main() {
...
@@ -172,9 +168,8 @@ void main() {
stretch:
true
,
stretch:
true
,
expandedHeight:
100.0
,
expandedHeight:
100.0
,
stretchTriggerOffset:
150.0
,
stretchTriggerOffset:
150.0
,
onStretchTrigger:
()
{
onStretchTrigger:
()
async
{
didTrigger
=
true
;
didTrigger
=
true
;
return
;
},
},
),
),
SliverToBoxAdapter
(
SliverToBoxAdapter
(
...
@@ -200,35 +195,6 @@ void main() {
...
@@ -200,35 +195,6 @@ void main() {
expect
(
didTrigger
,
isFalse
);
expect
(
didTrigger
,
isFalse
);
});
});
testWidgets
(
'asserts stretch != null'
,
(
WidgetTester
tester
)
async
{
expect
(
()
{
return
MaterialApp
(
home:
CustomScrollView
(
physics:
const
ClampingScrollPhysics
(),
slivers:
<
Widget
>[
SliverAppBar
(
stretch:
null
,
expandedHeight:
100.0
,
),
SliverToBoxAdapter
(
child:
Container
(
height:
800
,
)
),
SliverToBoxAdapter
(
child:
Container
(
height:
800
,
)
),
],
),
);
},
throwsAssertionError
,
);
});
testWidgets
(
'asserts reasonable trigger offset'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'asserts reasonable trigger offset'
,
(
WidgetTester
tester
)
async
{
expect
(
expect
(
()
{
()
{
...
@@ -291,9 +257,9 @@ void main() {
...
@@ -291,9 +257,9 @@ void main() {
final
RenderSliverPinnedPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverPinnedPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
200.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
200.0
));
});
});
testWidgets
(
'does not stretch without overscroll physics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'does not stretch without overscroll physics'
,
(
WidgetTester
tester
)
async
{
...
@@ -326,9 +292,9 @@ void main() {
...
@@ -326,9 +292,9 @@ void main() {
final
RenderSliverPinnedPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverPinnedPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
});
});
});
});
...
@@ -363,9 +329,9 @@ void main() {
...
@@ -363,9 +329,9 @@ void main() {
final
RenderSliverFloatingPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverFloatingPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
200.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
200.0
));
});
});
testWidgets
(
'does not fill overscroll without proper physics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'does not fill overscroll without proper physics'
,
(
WidgetTester
tester
)
async
{
...
@@ -398,9 +364,9 @@ void main() {
...
@@ -398,9 +364,9 @@ void main() {
final
RenderSliverFloatingPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverFloatingPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
});
});
});
});
...
@@ -436,9 +402,9 @@ void main() {
...
@@ -436,9 +402,9 @@ void main() {
final
RenderSliverFloatingPinnedPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverFloatingPinnedPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
200.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
200.0
));
});
});
testWidgets
(
'does not fill overscroll without proper physics'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'does not fill overscroll without proper physics'
,
(
WidgetTester
tester
)
async
{
...
@@ -472,9 +438,9 @@ void main() {
...
@@ -472,9 +438,9 @@ void main() {
final
RenderSliverFloatingPinnedPersistentHeader
header
=
tester
.
renderObject
(
final
RenderSliverFloatingPinnedPersistentHeader
header
=
tester
.
renderObject
(
find
.
byType
(
SliverAppBar
)
find
.
byType
(
SliverAppBar
)
);
);
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
await
slowDrag
(
tester
,
anchor
,
const
Offset
(
0.0
,
100
));
expect
(
header
.
child
.
size
.
height
,
equals
(
100.0
));
expect
(
header
.
child
!
.
size
.
height
,
equals
(
100.0
));
});
});
});
});
}
}
...
...
packages/flutter/test/widgets/slivers_block_global_key_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -11,7 +9,7 @@ import 'package:flutter/widgets.dart';
...
@@ -11,7 +9,7 @@ import 'package:flutter/widgets.dart';
int
globalGeneration
=
0
;
int
globalGeneration
=
0
;
class
GenerationText
extends
StatefulWidget
{
class
GenerationText
extends
StatefulWidget
{
const
GenerationText
(
this
.
value
,
{
Key
key
})
:
super
(
key:
key
);
const
GenerationText
(
this
.
value
,
{
Key
?
key
})
:
super
(
key:
key
);
final
int
value
;
final
int
value
;
@override
@override
_GenerationTextState
createState
()
=>
_GenerationTextState
();
_GenerationTextState
createState
()
=>
_GenerationTextState
();
...
@@ -55,7 +53,7 @@ void verify(WidgetTester tester, List<Offset> answerKey, String text) {
...
@@ -55,7 +53,7 @@ void verify(WidgetTester tester, List<Offset> answerKey, String text) {
expect
(
testAnswers
,
equals
(
answerKey
));
expect
(
testAnswers
,
equals
(
answerKey
));
final
String
foundText
=
final
String
foundText
=
tester
.
widgetList
<
Text
>(
find
.
byType
(
Text
))
tester
.
widgetList
<
Text
>(
find
.
byType
(
Text
))
.
map
<
String
>((
Text
widget
)
=>
widget
.
data
)
.
map
<
String
>((
Text
widget
)
=>
widget
.
data
!
)
.
reduce
((
String
value
,
String
element
)
=>
value
+
element
);
.
reduce
((
String
value
,
String
element
)
=>
value
+
element
);
expect
(
foundText
,
equals
(
text
));
expect
(
foundText
,
equals
(
text
));
}
}
...
...
packages/flutter/test/widgets/slivers_block_test.dart
View file @
e3184b38
...
@@ -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_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/widgets.dart'
;
import
'package:flutter/widgets.dart'
;
...
@@ -61,7 +59,7 @@ void verify(WidgetTester tester, List<Offset> answerKey, String text) {
...
@@ -61,7 +59,7 @@ void verify(WidgetTester tester, List<Offset> answerKey, String text) {
expect
(
testAnswers
,
equals
(
answerKey
));
expect
(
testAnswers
,
equals
(
answerKey
));
final
String
foundText
=
final
String
foundText
=
tester
.
widgetList
<
Text
>(
find
.
byType
(
Text
))
tester
.
widgetList
<
Text
>(
find
.
byType
(
Text
))
.
map
<
String
>((
Text
widget
)
=>
widget
.
data
)
.
map
<
String
>((
Text
widget
)
=>
widget
.
data
!
)
.
reduce
((
String
value
,
String
element
)
=>
value
+
element
);
.
reduce
((
String
value
,
String
element
)
=>
value
+
element
);
expect
(
foundText
,
equals
(
text
));
expect
(
foundText
,
equals
(
text
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment