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
e118e1a6
Unverified
Commit
e118e1a6
authored
Nov 25, 2020
by
Andrey Kabylin
Committed by
GitHub
Nov 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix #24469 and #67354 (#69668)
parent
83ef26e4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
5 deletions
+68
-5
AUTHORS
AUTHORS
+1
-0
routes.dart
packages/flutter/lib/src/widgets/routes.dart
+2
-4
routes_test.dart
packages/flutter/test/widgets/routes_test.dart
+65
-1
No files found.
AUTHORS
View file @
e118e1a6
...
...
@@ -70,3 +70,4 @@ YeungKC <flutter@yeungkc.com>
Nobuhiro Tabuki <japanese.around30@gmail.com>
nt4f04uNd <nt4f04und@gmail.com>
Anurag Roy <anuragr9847@gmail.com>
Andrey Kabylin <andrey@kabylin.ru>
packages/flutter/lib/src/widgets/routes.dart
View file @
e118e1a6
...
...
@@ -27,8 +27,6 @@ import 'transitions.dart';
// dynamic routeObserver;
// NavigatorState navigator;
const
Color
_kTransparent
=
Color
(
0x00000000
);
/// A route that displays widgets in the [Navigator]'s [Overlay].
abstract
class
OverlayRoute
<
T
>
extends
Route
<
T
>
{
/// Creates a route that knows how to interact with an [Overlay].
...
...
@@ -1475,10 +1473,10 @@ abstract class ModalRoute<T> extends TransitionRoute<T> with LocalHistoryRoute<T
Widget
_buildModalBarrier
(
BuildContext
context
)
{
Widget
barrier
;
if
(
barrierColor
!=
null
&&
barrierColor
!.
alpha
!=
0
&&
!
offstage
)
{
// changedInternalState is called if barrierColor or offstage updates
assert
(
barrierColor
!=
_kTransparent
);
assert
(
barrierColor
!=
barrierColor
!.
withOpacity
(
0.0
)
);
final
Animation
<
Color
?>
color
=
animation
!.
drive
(
ColorTween
(
begin:
_kTransparent
,
begin:
barrierColor
!.
withOpacity
(
0.0
)
,
end:
barrierColor
,
// changedInternalState is called if barrierColor updates
).
chain
(
CurveTween
(
curve:
barrierCurve
)),
// changedInternalState is called if barrierCurve updates
);
...
...
packages/flutter/test/widgets/routes_test.dart
View file @
e118e1a6
...
...
@@ -1425,6 +1425,69 @@ void main() {
expect
(
modalBarrierAnimation
.
value
,
Colors
.
black
);
});
testWidgets
(
'white barrierColor'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Material
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
return
Center
(
child:
ElevatedButton
(
child:
const
Text
(
'X'
),
onPressed:
()
{
Navigator
.
of
(
context
).
push
<
void
>(
_TestDialogRouteWithCustomBarrierCurve
<
void
>(
child:
const
Text
(
'Hello World'
),
barrierColor:
Colors
.
white
,
)
);
},
),
);
}
),
),
));
final
CurveTween
_defaultBarrierTween
=
CurveTween
(
curve:
Curves
.
ease
);
int
_getExpectedBarrierTweenAlphaValue
(
double
t
)
{
return
Color
.
getAlphaFromOpacity
(
_defaultBarrierTween
.
transform
(
t
));
}
await
tester
.
tap
(
find
.
text
(
'X'
));
await
tester
.
pump
();
final
Finder
animatedModalBarrier
=
find
.
byType
(
AnimatedModalBarrier
);
expect
(
animatedModalBarrier
,
findsOneWidget
);
Animation
<
Color
?>
modalBarrierAnimation
;
modalBarrierAnimation
=
tester
.
widget
<
AnimatedModalBarrier
>(
animatedModalBarrier
).
color
;
expect
(
modalBarrierAnimation
.
value
,
Colors
.
white
.
withOpacity
(
0
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
25
));
modalBarrierAnimation
=
tester
.
widget
<
AnimatedModalBarrier
>(
animatedModalBarrier
).
color
;
expect
(
modalBarrierAnimation
.
value
!.
alpha
,
closeTo
(
_getExpectedBarrierTweenAlphaValue
(
0.25
),
1
),
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
25
));
modalBarrierAnimation
=
tester
.
widget
<
AnimatedModalBarrier
>(
animatedModalBarrier
).
color
;
expect
(
modalBarrierAnimation
.
value
!.
alpha
,
closeTo
(
_getExpectedBarrierTweenAlphaValue
(
0.50
),
1
),
);
await
tester
.
pump
(
const
Duration
(
milliseconds:
25
));
modalBarrierAnimation
=
tester
.
widget
<
AnimatedModalBarrier
>(
animatedModalBarrier
).
color
;
expect
(
modalBarrierAnimation
.
value
!.
alpha
,
closeTo
(
_getExpectedBarrierTweenAlphaValue
(
0.75
),
1
),
);
await
tester
.
pumpAndSettle
();
modalBarrierAnimation
=
tester
.
widget
<
AnimatedModalBarrier
>(
animatedModalBarrier
).
color
;
expect
(
modalBarrierAnimation
.
value
,
Colors
.
white
);
});
testWidgets
(
'modal route semantics order'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/46625.
final
SemanticsTester
semantics
=
SemanticsTester
(
tester
);
...
...
@@ -1781,6 +1844,7 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> {
_TestDialogRouteWithCustomBarrierCurve
({
required
Widget
child
,
this
.
barrierLabel
,
this
.
barrierColor
=
Colors
.
black
,
Curve
?
barrierCurve
,
})
:
_barrierCurve
=
barrierCurve
,
_child
=
child
;
...
...
@@ -1794,7 +1858,7 @@ class _TestDialogRouteWithCustomBarrierCurve<T> extends PopupRoute<T> {
final
String
?
barrierLabel
;
@override
Color
get
barrierColor
=>
Colors
.
black
;
// easier value to test against
final
Color
?
barrierColor
;
@override
Curve
get
barrierCurve
{
...
...
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