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
4b87e334
Commit
4b87e334
authored
Jan 02, 2019
by
Chema Molins
Committed by
Hans Muller
Jan 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Setting icon color to first ListTile in ExpansionTile. Fixes #23053 (#23118)
parent
94aab29e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
7 deletions
+104
-7
AUTHORS
AUTHORS
+1
-0
expansion_tile.dart
packages/flutter/lib/src/material/expansion_tile.dart
+4
-7
expansion_tile_test.dart
packages/flutter/test/material/expansion_tile_test.dart
+99
-0
No files found.
AUTHORS
View file @
4b87e334
...
...
@@ -28,6 +28,7 @@ Christian Mürtz <teraarts@t-online.de>
Lukasz Piliszczuk <lukasz@intheloup.io>
Felix Schmidt <felix.free@gmx.de>
Artur Rymarz <artur.rymarz@gmail.com>
Chema Molins <chemamolins@gmail.com>
Stefan Mitev <mr.mitew@gmail.com>
Jasper van Riet <jaspervanriet@gmail.com>
Mattijs Fuijkschot <mattijs.fuijkschot@gmail.com>
packages/flutter/lib/src/material/expansion_tile.dart
View file @
4b87e334
...
...
@@ -142,7 +142,6 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
Widget
_buildChildren
(
BuildContext
context
,
Widget
child
)
{
final
Color
borderSideColor
=
_borderColor
.
value
??
Colors
.
transparent
;
final
Color
titleColor
=
_headerColor
.
value
;
return
Container
(
decoration:
BoxDecoration
(
...
...
@@ -155,15 +154,13 @@ class _ExpansionTileState extends State<ExpansionTile> with SingleTickerProvider
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
IconTheme
.
merge
(
data:
IconThemeData
(
color:
_iconColor
.
value
),
ListTileTheme
.
merge
(
iconColor:
_iconColor
.
value
,
textColor:
_headerColor
.
value
,
child:
ListTile
(
onTap:
_handleTap
,
leading:
widget
.
leading
,
title:
DefaultTextStyle
(
style:
Theme
.
of
(
context
).
textTheme
.
subhead
.
copyWith
(
color:
titleColor
),
child:
widget
.
title
,
),
title:
widget
.
title
,
trailing:
widget
.
trailing
??
RotationTransition
(
turns:
_iconTurns
,
child:
const
Icon
(
Icons
.
expand_more
),
...
...
packages/flutter/test/material/expansion_tile_test.dart
View file @
4b87e334
...
...
@@ -6,8 +6,47 @@ import 'package:flutter_test/flutter_test.dart';
import
'package:flutter/widgets.dart'
;
import
'package:flutter/material.dart'
;
class
TestIcon
extends
StatefulWidget
{
const
TestIcon
({
Key
key
})
:
super
(
key:
key
);
@override
TestIconState
createState
()
=>
TestIconState
();
}
class
TestIconState
extends
State
<
TestIcon
>
{
IconThemeData
iconTheme
;
@override
Widget
build
(
BuildContext
context
)
{
iconTheme
=
IconTheme
.
of
(
context
);
return
const
Icon
(
Icons
.
expand_more
);
}
}
class
TestText
extends
StatefulWidget
{
const
TestText
(
this
.
text
,
{
Key
key
})
:
super
(
key:
key
);
final
String
text
;
@override
TestTextState
createState
()
=>
TestTextState
();
}
class
TestTextState
extends
State
<
TestText
>
{
TextStyle
textStyle
;
@override
Widget
build
(
BuildContext
context
)
{
textStyle
=
DefaultTextStyle
.
of
(
context
).
style
;
return
Text
(
widget
.
text
);
}
}
void
main
(
)
{
const
Color
_dividerColor
=
Color
(
0x1f333333
);
const
Color
_accentColor
=
Colors
.
blueAccent
;
const
Color
_unselectedWidgetColor
=
Colors
.
black54
;
const
Color
_headerColor
=
Colors
.
black45
;
testWidgets
(
'ExpansionTile initial state'
,
(
WidgetTester
tester
)
async
{
final
Key
topKey
=
UniqueKey
();
...
...
@@ -116,4 +155,64 @@ void main() {
expect
(
collapsedContainerDecoration
.
border
.
top
.
color
,
_dividerColor
);
expect
(
collapsedContainerDecoration
.
border
.
bottom
.
color
,
_dividerColor
);
});
testWidgets
(
'ListTileTheme'
,
(
WidgetTester
tester
)
async
{
final
Key
expandedTitleKey
=
UniqueKey
();
final
Key
collapsedTitleKey
=
UniqueKey
();
final
Key
expandedIconKey
=
UniqueKey
();
final
Key
collapsedIconKey
=
UniqueKey
();
await
tester
.
pumpWidget
(
MaterialApp
(
theme:
ThemeData
(
platform:
TargetPlatform
.
iOS
,
accentColor:
_accentColor
,
unselectedWidgetColor:
_unselectedWidgetColor
,
textTheme:
const
TextTheme
(
subhead:
TextStyle
(
color:
_headerColor
)),
),
home:
Material
(
child:
SingleChildScrollView
(
child:
Column
(
children:
<
Widget
>[
const
ListTile
(
title:
Text
(
'Top'
)),
ExpansionTile
(
initiallyExpanded:
true
,
title:
TestText
(
'Expanded'
,
key:
expandedTitleKey
),
backgroundColor:
Colors
.
red
,
children:
const
<
Widget
>[
ListTile
(
title:
Text
(
'0'
))],
trailing:
TestIcon
(
key:
expandedIconKey
),
),
ExpansionTile
(
initiallyExpanded:
false
,
title:
TestText
(
'Collapsed'
,
key:
collapsedTitleKey
),
children:
const
<
Widget
>[
ListTile
(
title:
Text
(
'0'
))],
trailing:
TestIcon
(
key:
collapsedIconKey
),
),
],
),
),
),
),
);
Color
iconColor
(
Key
key
)
=>
tester
.
state
<
TestIconState
>(
find
.
byKey
(
key
)).
iconTheme
.
color
;
Color
textColor
(
Key
key
)
=>
tester
.
state
<
TestTextState
>(
find
.
byKey
(
key
)).
textStyle
.
color
;
expect
(
textColor
(
expandedTitleKey
),
_accentColor
);
expect
(
textColor
(
collapsedTitleKey
),
_headerColor
);
expect
(
iconColor
(
expandedIconKey
),
_accentColor
);
expect
(
iconColor
(
collapsedIconKey
),
_unselectedWidgetColor
);
// Tap both tiles to change their state: collapse and extend respectively
await
tester
.
tap
(
find
.
text
(
'Expanded'
));
await
tester
.
tap
(
find
.
text
(
'Collapsed'
));
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
await
tester
.
pump
(
const
Duration
(
seconds:
1
));
expect
(
textColor
(
expandedTitleKey
),
_headerColor
);
expect
(
textColor
(
collapsedTitleKey
),
_accentColor
);
expect
(
iconColor
(
expandedIconKey
),
_unselectedWidgetColor
);
expect
(
iconColor
(
collapsedIconKey
),
_accentColor
);
});
}
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