From ca84cc235c523adcea1f8c4b47c1814cc3285f18 Mon Sep 17 00:00:00 2001 From: Ayush Bherwani Date: Mon, 19 Oct 2020 20:47:03 +0530 Subject: [PATCH] [MergeSemantics] added code snippet (#68123) --- packages/flutter/lib/src/widgets/basic.dart | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/flutter/lib/src/widgets/basic.dart b/packages/flutter/lib/src/widgets/basic.dart index 431ee703c8..cfb1f3333f 100644 --- a/packages/flutter/lib/src/widgets/basic.dart +++ b/packages/flutter/lib/src/widgets/basic.dart @@ -6960,6 +6960,25 @@ class Semantics extends SingleChildRenderObjectWidget { /// would be presented as a separate feature than the checkbox, and /// 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: [ +/// Checkbox( +/// value: true, +/// onChanged: (bool value) => null, +/// ), +/// const Text("Settings"), +/// ], +/// ), +/// ) +/// ``` +/// {@end-tool} +/// /// Be aware that if two nodes in the subtree have conflicting /// semantics, the result may be nonsensical. For example, a subtree /// with a checked checkbox and an unchecked checkbox will be