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
c7ce24d3
Unverified
Commit
c7ce24d3
authored
Jul 13, 2022
by
Taha Tesser
Committed by
GitHub
Jul 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update `ListTile` and `ListTile` based widget docs for Material usage (#107104)
parent
a2c2d1ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
107 additions
and
14 deletions
+107
-14
checkbox_list_tile.dart
packages/flutter/lib/src/material/checkbox_list_tile.dart
+29
-0
list_tile.dart
packages/flutter/lib/src/material/list_tile.dart
+16
-12
radio_list_tile.dart
packages/flutter/lib/src/material/radio_list_tile.dart
+30
-0
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+32
-2
No files found.
packages/flutter/lib/src/material/checkbox_list_tile.dart
View file @
c7ce24d3
...
...
@@ -39,6 +39,35 @@ import 'theme_data.dart';
/// [secondary] widget is placed on the opposite side. This maps to the
/// [ListTile.leading] and [ListTile.trailing] properties of [ListTile].
///
/// This widget requires a [Material] widget ancestor in the tree to paint
/// itself on, which is typically provided by the app's [Scaffold].
/// The [tileColor], and [selectedTileColor] are not painted by the
/// [CheckboxListTile] itself but by the [Material] widget ancestor.
/// In this case, one can wrap a [Material] widget around the [CheckboxListTile],
/// e.g.:
///
/// {@tool snippet}
/// ```dart
/// Container(
/// color: Colors.green,
/// child: Material(
/// child: CheckboxListTile(
/// tileColor: Colors.red,
/// title: const Text('CheckboxListTile with red background'),
/// value: true,
/// onChanged:(bool? value) { },
/// ),
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ## Performance considerations when wrapping [CheckboxListTile] with [Material]
///
/// Wrapping a large number of [CheckboxListTile]s individually with [Material]s
/// is expensive. Consider only wrapping the [CheckboxListTile]s that require it
/// or include a common [Material] ancestor where possible.
///
/// To show the [CheckboxListTile] as disabled, pass null as the [onChanged]
/// callback.
///
...
...
packages/flutter/lib/src/material/list_tile.dart
View file @
c7ce24d3
...
...
@@ -87,28 +87,32 @@ enum ListTileControlAffinity {
/// List tiles are typically used in [ListView]s, or arranged in [Column]s in
/// [Drawer]s and [Card]s.
///
/// One ancestor must be a [Material] widget and typically this is
/// provided by the app's [Scaffold]. The [tileColor],
/// [selectedTileColor], [focusColor], and [hoverColor] are not
/// painted by the list tile itself but by the material widget
/// ancestor. This generally has no effect. However, if an opaque
/// widget, like `Container(color: Colors.white)`, is included in
/// between the [ListTile] and its [Material] ancestor, then the
/// opaque widget will obscure the material widget and its background
/// [tileColor], etc. If this a problem, one can wrap a [Material]
/// widget around the list tile, e.g.:
/// This widget requires a [Material] widget ancestor in the tree to paint
/// itself on, which is typically provided by the app's [Scaffold].
/// The [tileColor], [selectedTileColor], [focusColor], and [hoverColor]
/// are not painted by the [ListTile] itself but by the [Material] widget
/// ancestor. In this case, one can wrap a [Material] widget around the
/// [ListTile], e.g.:
///
/// {@tool snippet}
/// ```dart
/// Container(
/// color: Colors.green,
/// child: Material(
/// child:
const
Material(
/// child: ListTile(
/// title:
const
Text('ListTile with red background'),
/// title: Text('ListTile with red background'),
/// tileColor: Colors.red,
/// ),
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ## Performance considerations when wrapping [ListTile] with [Material]
///
/// Wrapping a large number of [ListTile]s individually with [Material]s
/// is expensive. Consider only wrapping the [ListTile]s that require it
/// or include a common [Material] ancestor where possible.
///
/// {@tool snippet}
///
...
...
packages/flutter/lib/src/material/radio_list_tile.dart
View file @
c7ce24d3
...
...
@@ -12,6 +12,7 @@ import 'theme_data.dart';
// Examples can assume:
// void setState(VoidCallback fn) { }
// enum Meridiem { am, pm }
/// A [ListTile] with a [Radio]. In other words, a radio button with a label.
///
...
...
@@ -40,6 +41,35 @@ import 'theme_data.dart';
/// [secondary] widget is placed on the opposite side. This maps to the
/// [ListTile.leading] and [ListTile.trailing] properties of [ListTile].
///
/// This widget requires a [Material] widget ancestor in the tree to paint
/// itself on, which is typically provided by the app's [Scaffold].
/// The [tileColor], and [selectedTileColor] are not painted by the
/// [RadioListTile] itself but by the [Material] widget ancestor. In this
/// case, one can wrap a [Material] widget around the [RadioListTile], e.g.:
///
/// {@tool snippet}
/// ```dart
/// Container(
/// color: Colors.green,
/// child: Material(
/// child: RadioListTile<Meridiem>(
/// tileColor: Colors.red,
/// title: const Text('AM'),
/// groupValue: Meridiem.am,
/// value: Meridiem.am,
/// onChanged:(Meridiem? value) { },
/// ),
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ## Performance considerations when wrapping [RadioListTile] with [Material]
///
/// Wrapping a large number of [RadioListTile]s individually with [Material]s
/// is expensive. Consider only wrapping the [RadioListTile]s that require it
/// or include a common [Material] ancestor where possible.
///
/// To show the [RadioListTile] as disabled, pass null as the [onChanged]
/// callback.
///
...
...
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
c7ce24d3
...
...
@@ -12,7 +12,7 @@ import 'theme_data.dart';
// Examples can assume:
// void setState(VoidCallback fn) { }
// bool _isSelected;
// bool _isSelected
= true
;
enum
_SwitchListTileType
{
material
,
adaptive
}
...
...
@@ -47,6 +47,34 @@ enum _SwitchListTileType { material, adaptive }
/// in the [ListTile.trailing] slot) which can be changed using [controlAffinity].
/// The [secondary] widget is placed in the [ListTile.leading] slot.
///
/// This widget requires a [Material] widget ancestor in the tree to paint
/// itself on, which is typically provided by the app's [Scaffold].
/// The [tileColor], and [selectedTileColor] are not painted by the
/// [SwitchListTile] itself but by the [Material] widget ancestor. In this
/// case, one can wrap a [Material] widget around the [SwitchListTile], e.g.:
///
/// {@tool snippet}
/// ```dart
/// Container(
/// color: Colors.green,
/// child: Material(
/// child: SwitchListTile(
/// tileColor: Colors.red,
/// title: const Text('SwitchListTile with red background'),
/// value: true,
/// onChanged:(bool? value) { },
/// ),
/// ),
/// )
/// ```
/// {@end-tool}
///
/// ## Performance considerations when wrapping [SwitchListTile] with [Material]
///
/// Wrapping a large number of [SwitchListTile]s individually with [Material]s
/// is expensive. Consider only wrapping the [SwitchListTile]s that require it
/// or include a common [Material] ancestor where possible.
///
/// To show the [SwitchListTile] as disabled, pass null as the [onChanged]
/// callback.
///
...
...
@@ -217,6 +245,7 @@ class SwitchListTile extends StatelessWidget {
/// [StatefulWidget] using the [State.setState] method, so that the parent
/// gets rebuilt; for example:
///
/// {@tool snippet}
/// ```dart
/// SwitchListTile(
/// value: _isSelected,
...
...
@@ -225,9 +254,10 @@ class SwitchListTile extends StatelessWidget {
/// _isSelected = newValue;
/// });
/// },
/// title: Text('Selection'),
/// title:
const
Text('Selection'),
/// )
/// ```
/// {@end-tool}
final
ValueChanged
<
bool
>?
onChanged
;
/// The color to use when this switch is on.
...
...
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