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
03dcd1bd
Unverified
Commit
03dcd1bd
authored
Aug 14, 2020
by
Declan Woods
Committed by
GitHub
Aug 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SafeArea and SliverSafeArea debug flag properties (#63455)
parent
5ec7426b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
6 deletions
+38
-6
safe_area.dart
packages/flutter/lib/src/widgets/safe_area.dart
+6
-6
safe_area_test.dart
packages/flutter/test/widgets/safe_area_test.dart
+32
-0
No files found.
packages/flutter/lib/src/widgets/safe_area.dart
View file @
03dcd1bd
...
...
@@ -125,9 +125,9 @@ class SafeArea extends StatelessWidget {
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
FlagProperty
(
'left'
,
value:
left
,
ifTrue:
'avoid left padding'
));
properties
.
add
(
FlagProperty
(
'top'
,
value:
left
,
ifTrue:
'avoid top padding'
));
properties
.
add
(
FlagProperty
(
'right'
,
value:
lef
t
,
ifTrue:
'avoid right padding'
));
properties
.
add
(
FlagProperty
(
'bottom'
,
value:
left
,
ifTrue:
'avoid bottom padding'
));
properties
.
add
(
FlagProperty
(
'top'
,
value:
top
,
ifTrue:
'avoid top padding'
));
properties
.
add
(
FlagProperty
(
'right'
,
value:
righ
t
,
ifTrue:
'avoid right padding'
));
properties
.
add
(
FlagProperty
(
'bottom'
,
value:
bottom
,
ifTrue:
'avoid bottom padding'
));
}
}
...
...
@@ -219,8 +219,8 @@ class SliverSafeArea extends StatelessWidget {
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
FlagProperty
(
'left'
,
value:
left
,
ifTrue:
'avoid left padding'
));
properties
.
add
(
FlagProperty
(
'top'
,
value:
left
,
ifTrue:
'avoid top padding'
));
properties
.
add
(
FlagProperty
(
'right'
,
value:
lef
t
,
ifTrue:
'avoid right padding'
));
properties
.
add
(
FlagProperty
(
'bottom'
,
value:
left
,
ifTrue:
'avoid bottom padding'
));
properties
.
add
(
FlagProperty
(
'top'
,
value:
top
,
ifTrue:
'avoid top padding'
));
properties
.
add
(
FlagProperty
(
'right'
,
value:
righ
t
,
ifTrue:
'avoid right padding'
));
properties
.
add
(
FlagProperty
(
'bottom'
,
value:
bottom
,
ifTrue:
'avoid bottom padding'
));
}
}
packages/flutter/test/widgets/safe_area_test.dart
View file @
03dcd1bd
...
...
@@ -89,6 +89,22 @@ void main() {
expect
(
tester
.
getBottomRight
(
find
.
byType
(
Placeholder
)),
const
Offset
(
800.0
,
600.0
));
});
testWidgets
(
'SafeArea - properties'
,
(
WidgetTester
tester
)
async
{
final
SafeArea
child
=
SafeArea
(
left:
true
,
right:
false
,
bottom:
false
,
child:
Container
()
);
final
DiagnosticPropertiesBuilder
properties
=
DiagnosticPropertiesBuilder
();
child
.
debugFillProperties
(
properties
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid left padding'
),
true
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid right padding'
),
false
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid top padding'
),
true
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid bottom padding'
),
false
);
});
group
(
'SafeArea maintains bottom viewPadding when specified for consumed bottom padding'
,
()
{
Widget
boilerplate
(
Widget
child
)
{
return
Localizations
(
...
...
@@ -300,4 +316,20 @@ void main() {
]);
});
});
testWidgets
(
'SliverSafeArea - properties'
,
(
WidgetTester
tester
)
async
{
const
SliverSafeArea
child
=
SliverSafeArea
(
left:
true
,
right:
false
,
bottom:
false
,
sliver:
SliverToBoxAdapter
(
child:
SizedBox
(
width:
800.0
,
height:
100.0
,
child:
Text
(
'padded'
))),
);
final
DiagnosticPropertiesBuilder
properties
=
DiagnosticPropertiesBuilder
();
child
.
debugFillProperties
(
properties
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid left padding'
),
true
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid right padding'
),
false
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid top padding'
),
true
);
expect
(
properties
.
properties
.
any
((
DiagnosticsNode
n
)
=>
n
is
FlagProperty
&&
n
.
toString
()
==
'avoid bottom padding'
),
false
);
});
}
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