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
20d554c1
Commit
20d554c1
authored
Sep 21, 2016
by
Adam Barth
Committed by
GitHub
Sep 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document two-level lists (#5972)
These are the last dartdocs needed in the material library.
parent
fc83640c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
2 deletions
+83
-2
list_item.dart
packages/flutter/lib/src/material/list_item.dart
+1
-1
two_level_list.dart
packages/flutter/lib/src/material/two_level_list.dart
+82
-1
No files found.
packages/flutter/lib/src/material/list_item.dart
View file @
20d554c1
...
...
@@ -76,7 +76,7 @@ class ListItem extends StatelessWidget {
/// Whether this list item is interactive.
///
/// If
false
, this list item is styled with the disabled color from the
/// If
`false`
, this list item is styled with the disabled color from the
/// current [Theme] and the [onTap] and [onLongPress] callbacks are
/// inoperative.
final
bool
enabled
;
...
...
packages/flutter/lib/src/material/two_level_list.dart
View file @
20d554c1
...
...
@@ -16,22 +16,61 @@ import 'theme_data.dart';
const
Duration
_kExpand
=
const
Duration
(
milliseconds:
200
);
/// An item in a [TwoLevelList] or a [TwoLevelSublist].
///
/// A two-level list item is similar to a [ListItem], but a two-level list item
/// automatically sizes itself to fit properly within its ancestor
/// [TwoLevelList].
///
/// See also:
///
/// * [TwoLevelList]
/// * [TwoLevelSublist]
/// * [ListItem]
class
TwoLevelListItem
extends
StatelessWidget
{
/// Creates an item in a two-level list.
TwoLevelListItem
({
Key
key
,
this
.
leading
,
this
.
title
,
this
.
trailing
,
this
.
enabled
:
true
,
this
.
onTap
,
this
.
onLongPress
})
:
super
(
key:
key
)
{
assert
(
title
!=
null
);
}
/// A widget to display before the title.
///
/// Typically a [CircleAvatar] widget.
final
Widget
leading
;
/// The primary content of the list item.
///
/// Typically a [Text] widget.
final
Widget
title
;
/// A widget to display after the title.
///
/// Typically an [Icon] widget.
final
Widget
trailing
;
/// Whether this list item is interactive.
///
/// If `false`, this list item is styled with the disabled color from the
/// current [Theme] and the [onTap] and [onLongPress] callbacks are
/// inoperative.
final
bool
enabled
;
/// Called when the user taps this list item.
///
/// Inoperative if [enabled] is false.
final
GestureTapCallback
onTap
;
/// Called when the user long-presses on this list item.
///
/// Inoperative if [enabled] is false.
final
GestureLongPressCallback
onLongPress
;
@override
...
...
@@ -45,6 +84,7 @@ class TwoLevelListItem extends StatelessWidget {
leading:
leading
,
title:
title
,
trailing:
trailing
,
enabled:
enabled
,
onTap:
onTap
,
onLongPress:
onLongPress
)
...
...
@@ -52,7 +92,18 @@ class TwoLevelListItem extends StatelessWidget {
}
}
/// An item in a [TwoLevelList] that can expand and collapse.
///
/// A two-level sublist is similar to a [ListItem], but the trailing widget is
/// a button that expands or collapses a sublist of items.
///
/// See also:
///
/// * [TwoLevelList]
/// * [TwoLevelListItem]
/// * [ListItem]
class
TwoLevelSublist
extends
StatefulWidget
{
/// Creates an item in a two-level list that can expland and collapse.
TwoLevelSublist
({
Key
key
,
this
.
leading
,
...
...
@@ -62,10 +113,29 @@ class TwoLevelSublist extends StatefulWidget {
this
.
children
})
:
super
(
key:
key
);
/// A widget to display before the title.
///
/// Typically a [CircleAvatar] widget.
final
Widget
leading
;
/// The primary content of the list item.
///
/// Typically a [Text] widget.
final
Widget
title
;
/// Called when the sublist expands or collapses.
///
/// When the sublist starts expanding, this function is called with the value
/// `true`. When the sublist starts collapsing, this function is called with
/// the value `false`.
final
ValueChanged
<
bool
>
onOpenChanged
;
/// The widgets that are displayed when the sublist expands.
///
/// Typically [TwoLevelListItem] widgets.
final
List
<
Widget
>
children
;
/// The color to display behind the sublist when expanded.
final
Color
backgroundColor
;
@override
...
...
@@ -179,14 +249,25 @@ class _TwoLevelSublistState extends State<TwoLevelSublist> {
}
}
/// A scrollable list of items that can expand and collapse.
///
/// See also:
///
/// * [TwoLevelSublist]
/// * [TwoLevelListItem]
class
TwoLevelList
extends
StatelessWidget
{
/// Creates a scrollable list of items that can expand and collapse.
///
/// The [type] argument must not be null.
TwoLevelList
({
Key
key
,
this
.
scrollableKey
,
this
.
children
,
this
.
type
:
MaterialListType
.
twoLine
,
this
.
padding
})
:
super
(
key:
key
);
})
:
super
(
key:
key
)
{
assert
(
type
!=
null
);
}
/// The widgets to display in this list.
///
...
...
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