Unverified Commit 4d5c0264 authored by Kate Lovett's avatar Kate Lovett Committed by GitHub

MaterialStateProperty Docs (#96532)

parent 177cfc49
......@@ -161,6 +161,25 @@ class Checkbox extends StatefulWidget {
/// * [MaterialState.hovered].
/// * [MaterialState.focused].
/// * [MaterialState.disabled].
///
/// {@tool snippet}
/// This example resolves the [fillColor] based on the current [MaterialState]
/// of the [Checkbox], providing a different [Color] when it is
/// [MaterialState.disabled].
///
/// ```dart
/// Checkbox(
/// value: true,
/// onChanged: (_){},
/// fillColor: MaterialStateProperty.resolveWith<Color>((states) {
/// if (states.contains(MaterialState.disabled)) {
/// return Colors.orange.withOpacity(.32);
/// }
/// return Colors.orange;
/// })
/// )
/// ```
/// {@end-tool}
/// {@endtemplate}
///
/// If null, then the value of [activeColor] is used in the selected
......
......@@ -189,6 +189,26 @@ class Radio<T> extends StatefulWidget {
/// * [MaterialState.hovered].
/// * [MaterialState.focused].
/// * [MaterialState.disabled].
///
/// {@tool snippet}
/// This example resolves the [fillColor] based on the current [MaterialState]
/// of the [Radio], providing a different [Color] when it is
/// [MaterialState.disabled].
///
/// ```dart
/// Radio<int>(
/// value: 1,
/// groupValue: 1,
/// onChanged: (_){},
/// fillColor: MaterialStateProperty.resolveWith<Color>((states) {
/// if (states.contains(MaterialState.disabled)) {
/// return Colors.orange.withOpacity(.32);
/// }
/// return Colors.orange;
/// })
/// )
/// ```
/// {@end-tool}
/// {@endtemplate}
///
/// If null, then the value of [activeColor] is used in the selected state. If
......
......@@ -229,6 +229,25 @@ class Switch extends StatelessWidget {
/// * [MaterialState.hovered].
/// * [MaterialState.focused].
/// * [MaterialState.disabled].
///
/// {@tool snippet}
/// This example resolves the [thumbColor] based on the current
/// [MaterialState] of the [Switch], providing a different [Color] when it is
/// [MaterialState.disabled].
///
/// ```dart
/// Switch(
/// value: true,
/// onChanged: (_) => true,
/// thumbColor: MaterialStateProperty.resolveWith<Color>((states) {
/// if (states.contains(MaterialState.disabled)) {
/// return Colors.orange.withOpacity(.48);
/// }
/// return Colors.orange;
/// }),
/// )
/// ```
/// {@end-tool}
/// {@endtemplate}
///
/// If null, then the value of [activeColor] is used in the selected
......@@ -251,6 +270,25 @@ class Switch extends StatelessWidget {
/// * [MaterialState.hovered].
/// * [MaterialState.focused].
/// * [MaterialState.disabled].
///
/// {@tool snippet}
/// This example resolves the [trackColor] based on the current
/// [MaterialState] of the [Switch], providing a different [Color] when it is
/// [MaterialState.disabled].
///
/// ```dart
/// Switch(
/// value: true,
/// onChanged: (_) => true,
/// thumbColor: MaterialStateProperty.resolveWith<Color>((states) {
/// if (states.contains(MaterialState.disabled)) {
/// return Colors.orange.withOpacity(.48);
/// }
/// return Colors.orange;
/// }),
/// )
/// ```
/// {@end-tool}
/// {@endtemplate}
///
/// If null, then the value of [activeTrackColor] is used in the selected
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment