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
6a1fc9ea
Unverified
Commit
6a1fc9ea
authored
Aug 22, 2022
by
hangyu
Committed by
GitHub
Aug 22, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
InputDecorator iconColor/prefixIconColor/suffixIconColor (#109988)
parent
c43e44b4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
3 deletions
+30
-3
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+6
-3
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+24
-0
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
6a1fc9ea
...
...
@@ -1991,17 +1991,20 @@ class _InputDecoratorState extends State<InputDecorator> with TickerProviderStat
}
Color
_getIconColor
(
ThemeData
themeData
,
InputDecorationTheme
defaults
)
{
return
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
iconColor
,
materialState
)
return
MaterialStateProperty
.
resolveAs
(
decoration
.
iconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
iconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
defaults
.
iconColor
!,
materialState
);
}
Color
_getPrefixIconColor
(
ThemeData
themeData
,
InputDecorationTheme
defaults
)
{
return
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
prefixIconColor
,
materialState
)
return
MaterialStateProperty
.
resolveAs
(
decoration
.
prefixIconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
prefixIconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
defaults
.
prefixIconColor
!,
materialState
);
}
Color
_getSuffixIconColor
(
ThemeData
themeData
,
InputDecorationTheme
defaults
)
{
return
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
suffixIconColor
,
materialState
)
return
MaterialStateProperty
.
resolveAs
(
decoration
.
suffixIconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
themeData
.
inputDecorationTheme
.
suffixIconColor
,
materialState
)
??
MaterialStateProperty
.
resolveAs
(
defaults
.
suffixIconColor
!,
materialState
);
}
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
6a1fc9ea
...
...
@@ -1657,6 +1657,30 @@ void main() {
expect
(
tester
.
getTopRight
(
find
.
text
(
'text'
)).
dx
,
lessThanOrEqualTo
(
tester
.
getTopLeft
(
find
.
text
(
's'
)).
dx
));
});
testWidgets
(
'InputDecorator iconColor/prefixIconColor/suffixIconColor'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
MaterialApp
(
home:
Material
(
child:
TextField
(
decoration:
InputDecoration
(
icon:
Icon
(
Icons
.
cabin
),
prefixIcon:
Icon
(
Icons
.
sailing
),
suffixIcon:
Icon
(
Icons
.
close
),
iconColor:
Colors
.
amber
,
prefixIconColor:
Colors
.
green
,
suffixIconColor:
Colors
.
red
,
filled:
true
,
),
),
),
),
);
expect
(
tester
.
widget
<
IconTheme
>(
find
.
widgetWithIcon
(
IconTheme
,
Icons
.
cabin
).
first
).
data
.
color
,
Colors
.
amber
);
expect
(
tester
.
widget
<
IconTheme
>(
find
.
widgetWithIcon
(
IconTheme
,
Icons
.
sailing
).
first
).
data
.
color
,
Colors
.
green
);
expect
(
tester
.
widget
<
IconTheme
>(
find
.
widgetWithIcon
(
IconTheme
,
Icons
.
close
).
first
).
data
.
color
,
Colors
.
red
);
});
testWidgets
(
'InputDecorator prefix/suffix widgets'
,
(
WidgetTester
tester
)
async
{
const
Key
pKey
=
Key
(
'p'
);
const
Key
sKey
=
Key
(
's'
);
...
...
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