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
b921a244
Unverified
Commit
b921a244
authored
Mar 23, 2021
by
Ren You
Committed by
GitHub
Mar 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "InteractiveViewer.builder (#77414)" (#78867)
This reverts commit
2c2c8a75
.
parent
5d37734e
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
408 deletions
+41
-408
interactive_viewer.dart
packages/flutter/lib/src/widgets/interactive_viewer.dart
+41
-301
interactive_viewer_test.dart
packages/flutter/test/widgets/interactive_viewer_test.dart
+0
-107
No files found.
packages/flutter/lib/src/widgets/interactive_viewer.dart
View file @
b921a244
This diff is collapsed.
Click to expand it.
packages/flutter/test/widgets/interactive_viewer_test.dart
View file @
b921a244
...
...
@@ -1026,89 +1026,6 @@ void main() {
findsOneWidget
,
);
});
testWidgets
(
'builder can change widgets that are off-screen'
,
(
WidgetTester
tester
)
async
{
final
TransformationController
transformationController
=
TransformationController
();
const
double
childHeight
=
10.0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
SizedBox
(
height:
50.0
,
child:
InteractiveViewer
.
builder
(
transformationController:
transformationController
,
scaleEnabled:
false
,
boundaryMargin:
const
EdgeInsets
.
all
(
double
.
infinity
),
// Build visible children green, off-screen children red.
builder:
(
BuildContext
context
,
Quad
viewportQuad
)
{
final
Rect
viewport
=
_axisAlignedBoundingBox
(
viewportQuad
);
final
List
<
Container
>
children
=
<
Container
>[];
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
final
double
childTop
=
i
*
childHeight
;
final
double
childBottom
=
childTop
+
childHeight
;
final
bool
visible
=
(
childBottom
>=
viewport
.
top
&&
childBottom
<=
viewport
.
bottom
)
||
(
childTop
>=
viewport
.
top
&&
childTop
<=
viewport
.
bottom
);
children
.
add
(
Container
(
height:
childHeight
,
color:
visible
?
Colors
.
green
:
Colors
.
red
,
));
}
return
Column
(
children:
children
,
);
},
),
),
),
),
),
);
expect
(
transformationController
.
value
,
equals
(
Matrix4
.
identity
()));
// The first six are partially visible and therefore green.
int
i
=
0
;
for
(
final
Element
element
in
find
.
byType
(
Container
,
skipOffstage:
false
).
evaluate
())
{
final
Container
container
=
element
.
widget
as
Container
;
if
(
i
<
6
)
{
expect
(
container
.
color
,
Colors
.
green
);
}
else
{
expect
(
container
.
color
,
Colors
.
red
);
}
i
++;
}
// Drag to pan down past the first child.
final
Offset
childOffset
=
tester
.
getTopLeft
(
find
.
byType
(
SizedBox
));
const
double
translationY
=
15.0
;
final
Offset
childInterior
=
Offset
(
childOffset
.
dx
,
childOffset
.
dy
+
translationY
,
);
final
TestGesture
gesture
=
await
tester
.
startGesture
(
childInterior
);
addTearDown
(
gesture
.
removePointer
);
await
tester
.
pump
();
await
gesture
.
moveTo
(
childOffset
);
await
tester
.
pump
();
await
gesture
.
up
();
await
tester
.
pumpAndSettle
();
expect
(
transformationController
.
value
,
isNot
(
Matrix4
.
identity
()));
expect
(
transformationController
.
value
.
getTranslation
().
y
,
-
translationY
);
// After scrolling down a bit, the first child is not visible, the next
// six are, and the final three are not.
i
=
0
;
for
(
final
Element
element
in
find
.
byType
(
Container
,
skipOffstage:
false
).
evaluate
())
{
final
Container
container
=
element
.
widget
as
Container
;
if
(
i
>
0
&&
i
<
7
)
{
expect
(
container
.
color
,
Colors
.
green
);
}
else
{
expect
(
container
.
color
,
Colors
.
red
);
}
i
++;
}
});
});
group
(
'getNearestPointOnLine'
,
()
{
...
...
@@ -1318,27 +1235,3 @@ void main() {
});
});
}
// Returns the axis aligned bounding box for the given Quad, which might not
// be axis aligned.
Rect
_axisAlignedBoundingBox
(
Quad
quad
)
{
double
?
xMin
;
double
?
xMax
;
double
?
yMin
;
double
?
yMax
;
for
(
final
Vector3
point
in
<
Vector3
>[
quad
.
point0
,
quad
.
point1
,
quad
.
point2
,
quad
.
point3
])
{
if
(
xMin
==
null
||
point
.
x
<
xMin
)
{
xMin
=
point
.
x
;
}
if
(
xMax
==
null
||
point
.
x
>
xMax
)
{
xMax
=
point
.
x
;
}
if
(
yMin
==
null
||
point
.
y
<
yMin
)
{
yMin
=
point
.
y
;
}
if
(
yMax
==
null
||
point
.
y
>
yMax
)
{
yMax
=
point
.
y
;
}
}
return
Rect
.
fromLTRB
(
xMin
!,
yMin
!,
xMax
!,
yMax
!);
}
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