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
64f7bf7e
Unverified
Commit
64f7bf7e
authored
Apr 07, 2022
by
Taha Tesser
Committed by
GitHub
Apr 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ListTile debugFillProperties (#100765)
parent
c7d29350
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
105 additions
and
0 deletions
+105
-0
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+33
-0
list_tile_test.dart
packages/flutter/test/material/list_tile_test.dart
+72
-0
No files found.
packages/flutter/lib/src/material/list_tile.dart
View file @
64f7bf7e
...
@@ -798,6 +798,39 @@ class ListTile extends StatelessWidget {
...
@@ -798,6 +798,39 @@ class ListTile extends StatelessWidget {
),
),
);
);
}
}
@override
void
debugFillProperties
(
DiagnosticPropertiesBuilder
properties
)
{
super
.
debugFillProperties
(
properties
);
properties
.
add
(
DiagnosticsProperty
<
Widget
>(
'leading'
,
leading
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Widget
>(
'title'
,
title
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Widget
>(
'subtitle'
,
subtitle
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Widget
>(
'trailing'
,
trailing
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'isThreeLine'
,
value:
isThreeLine
,
ifTrue:
'THREE_LINE'
,
ifFalse:
'TWO_LINE'
,
showName:
true
,
defaultValue:
false
));
properties
.
add
(
FlagProperty
(
'dense'
,
value:
dense
,
ifTrue:
'true'
,
ifFalse:
'false'
,
showName:
true
));
properties
.
add
(
DiagnosticsProperty
<
VisualDensity
>(
'visualDensity'
,
visualDensity
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ShapeBorder
>(
'shape'
,
shape
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
ListTileStyle
>(
'style'
,
style
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'selectedColor'
,
selectedColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'iconColor'
,
iconColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'textColor'
,
textColor
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
EdgeInsetsGeometry
>(
'contentPadding'
,
contentPadding
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'enabled'
,
value:
enabled
,
ifTrue:
'true'
,
ifFalse:
'false'
,
showName:
true
,
defaultValue:
true
));
properties
.
add
(
DiagnosticsProperty
<
Function
>(
'onTap'
,
onTap
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
Function
>(
'onLongPress'
,
onLongPress
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
MouseCursor
>(
'mouseCursor'
,
mouseCursor
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'selected'
,
value:
selected
,
ifTrue:
'true'
,
ifFalse:
'false'
,
showName:
true
,
defaultValue:
false
));
properties
.
add
(
ColorProperty
(
'focusColor'
,
focusColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'hoverColor'
,
hoverColor
,
defaultValue:
null
));
properties
.
add
(
DiagnosticsProperty
<
FocusNode
>(
'focusNode'
,
focusNode
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'autofocus'
,
value:
autofocus
,
ifTrue:
'true'
,
ifFalse:
'false'
,
showName:
true
,
defaultValue:
false
));
properties
.
add
(
ColorProperty
(
'tileColor'
,
tileColor
,
defaultValue:
null
));
properties
.
add
(
ColorProperty
(
'selectedTileColor'
,
selectedTileColor
,
defaultValue:
null
));
properties
.
add
(
FlagProperty
(
'enableFeedback'
,
value:
enableFeedback
,
ifTrue:
'true'
,
ifFalse:
'false'
,
showName:
true
));
properties
.
add
(
DoubleProperty
(
'horizontalTitleGap'
,
horizontalTitleGap
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'minVerticalPadding'
,
minVerticalPadding
,
defaultValue:
null
));
properties
.
add
(
DoubleProperty
(
'minLeadingWidth'
,
minLeadingWidth
,
defaultValue:
null
));
}
}
}
// Identifies the children of a _ListTileElement.
// Identifies the children of a _ListTileElement.
...
...
packages/flutter/test/material/list_tile_test.dart
View file @
64f7bf7e
...
@@ -2228,6 +2228,78 @@ void main() {
...
@@ -2228,6 +2228,78 @@ void main() {
trailing
=
_getTextRenderObject
(
tester
,
'trailing'
);
trailing
=
_getTextRenderObject
(
tester
,
'trailing'
);
expect
(
trailing
.
text
.
style
!.
color
,
theme
.
textTheme
.
bodyText2
!.
color
);
expect
(
trailing
.
text
.
style
!.
color
,
theme
.
textTheme
.
bodyText2
!.
color
);
});
});
testWidgets
(
'Default ListTile debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
ListTile
().
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
expect
(
description
,
<
String
>[]);
});
testWidgets
(
'ListTile implements debugFillProperties'
,
(
WidgetTester
tester
)
async
{
final
DiagnosticPropertiesBuilder
builder
=
DiagnosticPropertiesBuilder
();
const
ListTile
(
leading:
Text
(
'leading'
),
title:
Text
(
'title'
),
subtitle:
Text
(
'trailing'
),
trailing:
Text
(
'trailing'
),
isThreeLine:
true
,
dense:
true
,
visualDensity:
VisualDensity
.
standard
,
shape:
RoundedRectangleBorder
(),
style:
ListTileStyle
.
list
,
selectedColor:
Color
(
0xff0000ff
),
iconColor:
Color
(
0xff00ff00
),
textColor:
Color
(
0xffff0000
),
contentPadding:
EdgeInsets
.
zero
,
enabled:
false
,
selected:
true
,
focusColor:
Color
(
0xff00ffff
),
hoverColor:
Color
(
0xff0000ff
),
autofocus:
true
,
tileColor:
Color
(
0xffffff00
),
selectedTileColor:
Color
(
0xff123456
),
enableFeedback:
false
,
horizontalTitleGap:
4.0
,
minVerticalPadding:
2.0
,
minLeadingWidth:
6.0
,
).
debugFillProperties
(
builder
);
final
List
<
String
>
description
=
builder
.
properties
.
where
((
DiagnosticsNode
node
)
=>
!
node
.
isFiltered
(
DiagnosticLevel
.
info
))
.
map
((
DiagnosticsNode
node
)
=>
node
.
toString
())
.
toList
();
expect
(
description
[
0
],
'leading: Text'
);
expect
(
description
[
1
],
'title: Text'
);
expect
(
description
[
2
],
'subtitle: Text'
);
expect
(
description
[
3
],
'trailing: Text'
);
expect
(
description
[
4
],
'isThreeLine: THREE_LINE'
);
expect
(
description
[
5
],
'dense: true'
);
expect
(
description
[
6
],
equalsIgnoringHashCodes
(
'visualDensity: VisualDensity#00000(h: 0.0, v: 0.0)'
));
expect
(
description
[
7
],
'shape: RoundedRectangleBorder(BorderSide(Color(0xff000000), 0.0, BorderStyle.none), BorderRadius.zero)'
);
expect
(
description
[
8
],
'style: ListTileStyle.list'
);
expect
(
description
[
9
],
'selectedColor: Color(0xff0000ff)'
);
expect
(
description
[
10
],
'iconColor: Color(0xff00ff00)'
);
expect
(
description
[
11
],
'textColor: Color(0xffff0000)'
);
expect
(
description
[
12
],
'contentPadding: EdgeInsets.zero'
);
expect
(
description
[
13
],
'enabled: false'
);
expect
(
description
[
14
],
'selected: true'
);
expect
(
description
[
15
],
'focusColor: Color(0xff00ffff)'
);
expect
(
description
[
16
],
'hoverColor: Color(0xff0000ff)'
);
expect
(
description
[
17
],
'autofocus: true'
);
expect
(
description
[
18
],
'tileColor: Color(0xffffff00)'
);
expect
(
description
[
19
],
'selectedTileColor: Color(0xff123456)'
);
expect
(
description
[
20
],
'enableFeedback: false'
);
expect
(
description
[
21
],
'horizontalTitleGap: 4.0'
);
expect
(
description
[
22
],
'minVerticalPadding: 2.0'
);
expect
(
description
[
23
],
'minLeadingWidth: 6.0'
);
});
}
}
RenderParagraph
_getTextRenderObject
(
WidgetTester
tester
,
String
text
)
{
RenderParagraph
_getTextRenderObject
(
WidgetTester
tester
,
String
text
)
{
...
...
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