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
f63eb0b2
Unverified
Commit
f63eb0b2
authored
Jan 15, 2021
by
Hans Muller
Committed by
GitHub
Jan 15, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BorderTween.lerp supports null begin/end values (#73992)
parent
8d72307c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
2 deletions
+46
-2
implicit_animations.dart
packages/flutter/lib/src/widgets/implicit_animations.dart
+6
-2
nav_bar_test.dart
packages/flutter/test/cupertino/nav_bar_test.dart
+40
-0
No files found.
packages/flutter/lib/src/widgets/implicit_animations.dart
View file @
f63eb0b2
...
...
@@ -143,7 +143,7 @@ class BorderRadiusTween extends Tween<BorderRadius> {
/// [Border.lerp].
///
/// See [Tween] for a discussion on how to use interpolation objects.
class
BorderTween
extends
Tween
<
Border
>
{
class
BorderTween
extends
Tween
<
Border
?
>
{
/// Creates a [Border] tween.
///
/// The [begin] and [end] properties may be null; the null value
...
...
@@ -152,7 +152,11 @@ class BorderTween extends Tween<Border> {
/// Returns the value this variable has at the given animation clock value.
@override
Border
lerp
(
double
t
)
=>
Border
.
lerp
(
begin
,
end
,
t
)!;
Border
?
lerp
(
double
t
)
{
if
(
begin
==
null
||
end
==
null
)
return
t
<
0.5
?
begin
:
end
;
return
Border
.
lerp
(
begin
!,
end
!,
t
);
}
}
/// An interpolation between two [Matrix4]s.
...
...
packages/flutter/test/cupertino/nav_bar_test.dart
View file @
f63eb0b2
...
...
@@ -1292,6 +1292,46 @@ void main() {
initialTrailingTextToLargeTitleOffset
.
dy
.
abs
(),
);
});
testWidgets
(
'Null NavigationBar border transition'
,
(
WidgetTester
tester
)
async
{
// This is a regression test for https://github.com/flutter/flutter/issues/71389
await
tester
.
pumpWidget
(
const
CupertinoApp
(
home:
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
middle:
Text
(
'Page 1'
),
border:
null
,
),
child:
Placeholder
(),
),
),
);
tester
.
state
<
NavigatorState
>(
find
.
byType
(
Navigator
)).
push
(
CupertinoPageRoute
<
void
>(
builder:
(
BuildContext
context
)
{
return
const
CupertinoPageScaffold
(
navigationBar:
CupertinoNavigationBar
(
middle:
Text
(
'Page 2'
),
border:
null
,
),
child:
Placeholder
(),
);
},
),
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
find
.
text
(
'Page 1'
),
findsNothing
);
expect
(
find
.
text
(
'Page 2'
),
findsOneWidget
);
await
tester
.
tap
(
find
.
text
(
String
.
fromCharCode
(
CupertinoIcons
.
back
.
codePoint
)));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
500
));
expect
(
find
.
text
(
'Page 1'
),
findsOneWidget
);
expect
(
find
.
text
(
'Page 2'
),
findsNothing
);
});
}
class
_ExpectStyles
extends
StatelessWidget
{
...
...
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