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
743960df
Unverified
Commit
743960df
authored
Nov 19, 2018
by
jslavitz
Committed by
GitHub
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cupertino picker null color fix (#24529)
*null fix and test
parent
9d81c67a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
picker.dart
packages/flutter/lib/src/cupertino/picker.dart
+1
-1
picker_test.dart
packages/flutter/test/cupertino/picker_test.dart
+43
-0
No files found.
packages/flutter/lib/src/cupertino/picker.dart
View file @
743960df
...
...
@@ -215,7 +215,7 @@ class _CupertinoPickerState extends State<CupertinoPicker> {
if
(
widget
.
backgroundColor
!=
null
&&
widget
.
backgroundColor
.
alpha
<
255
)
return
Container
();
final
Color
widgetBackgroundColor
=
widget
.
backgroundColor
;
final
Color
widgetBackgroundColor
=
widget
.
backgroundColor
??
const
Color
(
0xFFFFFFFF
)
;
return
Positioned
.
fill
(
child:
IgnorePointer
(
child:
Container
(
...
...
packages/flutter/test/cupertino/picker_test.dart
View file @
743960df
...
...
@@ -132,6 +132,49 @@ void main() {
expect
(
boxDecoration
.
gradient
,
isNull
);
expect
(
boxDecoration
.
color
,
isNotNull
);
});
testWidgets
(
'gradient displays correctly with null background color'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Align
(
alignment:
Alignment
.
topLeft
,
child:
SizedBox
(
height:
300.0
,
width:
300.0
,
child:
CupertinoPicker
(
backgroundColor:
null
,
itemExtent:
15.0
,
children:
const
<
Widget
>[
Text
(
'1'
),
Text
(
'1'
),
Text
(
'1'
),
Text
(
'1'
),
Text
(
'1'
),
Text
(
'1'
),
Text
(
'1'
),
],
onSelectedItemChanged:
(
int
i
)
{},
),
),
),
),
);
// If the background color is null, the gradient color should be white.
const
Color
backgroundColor
=
Color
(
0xFFFFFFFF
);
final
Container
container
=
tester
.
firstWidget
(
find
.
byType
(
Container
));
final
BoxDecoration
boxDecoration
=
container
.
decoration
;
expect
(
boxDecoration
.
gradient
.
colors
,
<
Color
>[
backgroundColor
,
backgroundColor
.
withAlpha
(
0xF2
),
backgroundColor
.
withAlpha
(
0xDD
),
backgroundColor
.
withAlpha
(
0x00
),
backgroundColor
.
withAlpha
(
0x00
),
backgroundColor
.
withAlpha
(
0xDD
),
backgroundColor
.
withAlpha
(
0xF2
),
backgroundColor
,
]);
});
});
group
(
'scroll'
,
()
{
...
...
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