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
14136ae3
Unverified
Commit
14136ae3
authored
Jun 01, 2023
by
Hans Muller
Committed by
GitHub
Jun 01, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated custom ListTile examples (#128071)
parent
35174cc2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
56 deletions
+33
-56
custom_list_item.1.dart
examples/api/lib/material/list_tile/custom_list_item.1.dart
+32
-44
custom_list_item.1_test.dart
.../api/test/material/list_tile/custom_list_item.1_test.dart
+1
-8
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+0
-4
No files found.
examples/api/lib/material/list_tile/custom_list_item.1.dart
View file @
14136ae3
...
@@ -13,8 +13,9 @@ class CustomListItemApp extends StatelessWidget {
...
@@ -13,8 +13,9 @@ class CustomListItemApp extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
const
MaterialApp
(
return
MaterialApp
(
home:
CustomListItemExample
(),
theme:
ThemeData
(
useMaterial3:
true
),
home:
const
CustomListItemExample
(),
);
);
}
}
}
}
...
@@ -39,51 +40,38 @@ class _ArticleDescription extends StatelessWidget {
...
@@ -39,51 +40,38 @@ class _ArticleDescription extends StatelessWidget {
return
Column
(
return
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
<
Widget
>[
children:
<
Widget
>[
Expanded
(
Text
(
child:
Column
(
title
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
maxLines:
2
,
children:
<
Widget
>[
overflow:
TextOverflow
.
ellipsis
,
Text
(
style:
const
TextStyle
(
title
,
fontWeight:
FontWeight
.
bold
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
const
TextStyle
(
fontWeight:
FontWeight
.
bold
,
),
),
const
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
2.0
)),
Text
(
subtitle
,
maxLines:
2
,
overflow:
TextOverflow
.
ellipsis
,
style:
const
TextStyle
(
fontSize:
12.0
,
color:
Colors
.
black54
,
),
),
],
),
),
),
),
const
Padding
(
padding:
EdgeInsets
.
only
(
bottom:
2.0
)),
Expanded
(
Expanded
(
child:
Column
(
child:
Text
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
subtitle
,
mainAxisAlignment:
MainAxisAlignment
.
end
,
maxLines:
2
,
children:
<
Widget
>[
overflow:
TextOverflow
.
ellipsis
,
Text
(
style:
const
TextStyle
(
author
,
fontSize:
12.0
,
style:
const
TextStyle
(
color:
Colors
.
black54
,
fontSize:
12.0
,
),
color:
Colors
.
black87
,
),
),
),
),
Text
(
Text
(
author
,
'
$publishDate
-
$readDuration
'
,
style:
const
TextStyle
(
style:
const
TextStyle
(
fontSize:
12.0
,
fontSize:
12.0
,
color:
Colors
.
black87
,
color:
Colors
.
black54
,
),
),
),
),
Text
(
],
'
$publishDate
-
$readDuration
'
,
style:
const
TextStyle
(
fontSize:
12.0
,
color:
Colors
.
black54
,
),
),
),
),
],
],
...
...
examples/api/test/material/list_tile/custom_list_item.1_test.dart
View file @
14136ae3
...
@@ -20,7 +20,7 @@ void main() {
...
@@ -20,7 +20,7 @@ void main() {
expect
(
thumbnailAspectRatio
.
aspectRatio
,
1.0
);
expect
(
thumbnailAspectRatio
.
aspectRatio
,
1.0
);
// The Expanded widget is used to control the size of the text.
// The Expanded widget is used to control the size of the text.
Expanded
textExpanded
=
tester
.
widget
(
find
.
ancestor
(
final
Expanded
textExpanded
=
tester
.
widget
(
find
.
ancestor
(
of:
find
.
text
(
'Flutter 1.0 Launch'
),
of:
find
.
text
(
'Flutter 1.0 Launch'
),
matching:
find
.
byType
(
Expanded
).
at
(
0
),
matching:
find
.
byType
(
Expanded
).
at
(
0
),
));
));
...
@@ -32,12 +32,5 @@ void main() {
...
@@ -32,12 +32,5 @@ void main() {
matching:
find
.
byType
(
AspectRatio
),
matching:
find
.
byType
(
AspectRatio
),
));
));
expect
(
thumbnailAspectRatio
.
aspectRatio
,
1.0
);
expect
(
thumbnailAspectRatio
.
aspectRatio
,
1.0
);
// The Expanded widget is used to control the size of the text.
textExpanded
=
tester
.
widget
(
find
.
ancestor
(
of:
find
.
text
(
'Flutter 1.2 Release - Continual updates to the framework'
),
matching:
find
.
byType
(
Expanded
).
at
(
3
),
));
expect
(
textExpanded
.
flex
,
1
);
});
});
}
}
packages/flutter/lib/src/material/list_tile.dart
View file @
14136ae3
...
@@ -296,8 +296,6 @@ enum ListTileTitleAlignment {
...
@@ -296,8 +296,6 @@ enum ListTileTitleAlignment {
/// Here is an example of a custom list item that resembles a YouTube-related
/// Here is an example of a custom list item that resembles a YouTube-related
/// video list item created with [Expanded] and [Container] widgets.
/// video list item created with [Expanded] and [Container] widgets.
///
///
/// ![Custom list item a](https://flutter.github.io/assets-for-api-docs/assets/widgets/custom_list_item_a.png)
///
/// ** See code in examples/api/lib/material/list_tile/custom_list_item.0.dart **
/// ** See code in examples/api/lib/material/list_tile/custom_list_item.0.dart **
/// {@end-tool}
/// {@end-tool}
///
///
...
@@ -306,8 +304,6 @@ enum ListTileTitleAlignment {
...
@@ -306,8 +304,6 @@ enum ListTileTitleAlignment {
/// subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
/// subtitles. It utilizes [Row]s and [Column]s, as well as [Expanded] and
/// [AspectRatio] widgets to organize its layout.
/// [AspectRatio] widgets to organize its layout.
///
///
/// ![Custom list item b](https://flutter.github.io/assets-for-api-docs/assets/widgets/custom_list_item_b.png)
///
/// ** See code in examples/api/lib/material/list_tile/custom_list_item.1.dart **
/// ** See code in examples/api/lib/material/list_tile/custom_list_item.1.dart **
/// {@end-tool}
/// {@end-tool}
///
///
...
...
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