[MergeSemantics] added code snippet (#68123)

This commit is contained in:
Ayush Bherwani 2020-10-19 20:47:03 +05:30 committed by GitHub
parent f26fbb6bdd
commit ca84cc235c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6960,6 +6960,25 @@ class Semantics extends SingleChildRenderObjectWidget {
/// would be presented as a separate feature than the checkbox, and /// would be presented as a separate feature than the checkbox, and
/// the user would not be able to be sure that they were related. /// the user would not be able to be sure that they were related.
/// ///
/// {@tool snippet}
/// This snippet shows how to use [MergeSemantics] to merge the semantics of
/// a [Checkbox] and [Text] widget.
///
/// ```dart
/// MergeSemantics(
/// child: Row(
/// children: <Widget>[
/// Checkbox(
/// value: true,
/// onChanged: (bool value) => null,
/// ),
/// const Text("Settings"),
/// ],
/// ),
/// )
/// ```
/// {@end-tool}
///
/// Be aware that if two nodes in the subtree have conflicting /// Be aware that if two nodes in the subtree have conflicting
/// semantics, the result may be nonsensical. For example, a subtree /// semantics, the result may be nonsensical. For example, a subtree
/// with a checked checkbox and an unchecked checkbox will be /// with a checked checkbox and an unchecked checkbox will be