US Office

1176 Shadeville Rd, Crawfordville Florida 32327, USA

 +1 (850) 780-1313

India Office

Office No 405, Kabir Shilp, Opp. Kansar Hotel, Opp. Landmark, Kudasan, Gandhinagar, Gujarat 382421

[email protected]

ExcludeSemantics Widget – Flutter Widget Guide By Flutter Agency

ExcludeSemantic Widget - Flutter Widget Guide By Flutter Agency

ExcludeSemantics Widget – Flutter Widget Guide By Flutter Agency

Earlier, we have been through SlideTransition Widget  which is used to animate the position of a widget relative to its normal position so now this is the time for something new widget called ExcludeSemantics Widget.

What is Semantics in Flutter?

Semantics is a widget that annotates the widget tree with a description of the meaning of the widgets.

It is used by accessibility tools, search engines, and other semantic analysis software to determine the meaning of the application.

Seems pretty much exciting about it? Let’s dive into it.

What is ExcludeSemantics Widget in Flutter?

ExcludeSemantics Widget is a widget that drops all semantics of it’s a descendant or in words, we can say that when a user doesn’t want to read particular element or screen user can wrap that element into ExcludeSemantics Widget.

ExcludeSemantics Widget which makes Flutter discard all the semantic information from the widget subtree starting with Exclude Semantics’ child.

Default constructor of it will look like below:

Key key, 
bool excluding: true, 
Widget child,

In the Above constructor, all fields marked with @required must not be empty. We will understand all properties with detail on it.


  • Key key: This attribute represents how one widget should replace another widget in a tree.
  • bool excluding: This attribute is used to define whether this widget is excluded in the semantic tree.
  • Widget child: This attribute is used to define the widget below this widget in the tree. This widget can only have one child. To layout multiple children, let this widget’s child be a widget such as Row WidgetColumn Widget, or Stack Widget, which have a children’s property, and then provide the children to that widget.

How to use ExcludeSemantics Widget in Flutter?

The following code snippet tells us how to implement ExcludeSemantics Widget in Flutter.

  label: 'Counter button',
  hint: 'Press to increase',
  value: '$_counter',
  onTap: () { setState(() { _counter++; }); }
  child: ExcludeSemantics(
    child: Text(
      style: Theme.of(context).textTheme.display1,

What is BlockSemantics in Flutter?

While ExcludeSemantics works in many cases, you can imagine how cumbersome would it be, to add it whenever you open a popup in order to hide the background widget’s features. In such cases, it’s better to use BlockSemantics, which is a more convenient way to exclude semantics of sibling widgets. It’s smart enough to only do that for widgets that were painted before the BlockSemantics child, which means that you don’t need to manually determine which ones should, and which shouldn’t be ignored.

  children: <Widget>[
      top: 0, left: 0, width: 50, height: 50,
      child: Semantics(label: "Red", child: Container(color:,
      top: 25, left: 25, width: 50, height: 50,
      child: Semantics(label: "Green", child: Container(color:,
      top: 50, left: 50, width: 50, height: 50,
      child: Semantics(label: "Blue", child: Container(color:,

The above code will give us output like below:

BlockSemantics Widget - Flutter Widget Guide By Flutter Agency

BlockSemantics Widget

What is MergeSemantics in Flutter?

The last of the useful Semantics widgets is MergeSemantics. Imagine that you have a Container Widget which appears as a single widget, but actually is composed of multiple widgets. We will get into a separate article for it.


In this article, we have been through What is Semantics, ExcludeSemantics Widget, and MergeSemantics in Flutter.

That’s it for today.

Still, need support for Flutter? We Would love to help you. is our portal Platform dedicated to Flutter Technology and Flutter Developers. The portal is full of cool resources from Flutter like Flutter Widget Guide, Flutter Projects, Code libs and etc. is one of the most popular online portal dedicated to Flutter Technology and daily thousands of unique visitors come to this portal to enhance their knowledge on Flutter.

Post a Comment