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
00a00def
Commit
00a00def
authored
Mar 03, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for icon opacity crash
Fixes #2361
parent
8af3dde3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
icon.dart
packages/flutter/lib/src/material/icon.dart
+1
-1
icon_test.dart
packages/flutter/test/widget/icon_test.dart
+25
-0
instrumentation.dart
packages/flutter_test/lib/src/instrumentation.dart
+9
-0
No files found.
packages/flutter/lib/src/material/icon.dart
View file @
00a00def
...
...
@@ -63,7 +63,7 @@ class Icon extends StatelessComponent {
final
double
iconOpacity
=
IconTheme
.
of
(
context
)?.
clampedOpacity
??
1.0
;
Color
iconColor
=
color
??
_getDefaultColor
(
context
);
if
(
iconOpacity
!=
1.0
)
iconColor
=
iconColor
.
with
Alpha
((
255.0
*
iconColor
.
opacity
*
iconOpacity
).
round
()
);
iconColor
=
iconColor
.
with
Opacity
(
iconColor
.
opacity
*
iconOpacity
);
return
new
ExcludeSemantics
(
child:
new
SizedBox
(
...
...
packages/flutter/test/widget/icon_test.dart
0 → 100644
View file @
00a00def
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter/material.dart'
;
import
'package:test/test.dart'
;
void
main
(
)
{
test
(
'Can set opacity for an Icon'
,
()
{
testWidgets
((
WidgetTester
tester
)
{
tester
.
pumpWidget
(
new
IconTheme
(
data:
new
IconThemeData
(
color:
Colors
.
green
[
500
],
opacity:
0.5
),
child:
new
Icon
(
icon:
Icons
.
add
)
)
);
Text
text
=
tester
.
findWidgetOfType
(
Text
);
expect
(
text
.
style
.
color
,
equals
(
Colors
.
green
[
500
].
withOpacity
(
0.5
)));
});
});
}
packages/flutter_test/lib/src/instrumentation.dart
View file @
00a00def
...
...
@@ -75,6 +75,15 @@ class Instrumentation {
});
}
/// Returns the first [Widget] of the given [runtimeType], if any. Returns
/// null if there is no matching widget.
Widget
findWidgetOfType
(
Type
type
)
{
Element
element
=
findElement
((
Element
element
)
{
return
element
.
widget
.
runtimeType
==
type
;
});
return
element
?.
widget
;
}
/// Returns the [State] object of the first element whose state has
/// the given [runtimeType], if any. Returns null if there is no
/// matching element.
...
...
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