diff --git a/packages/flutter/lib/src/material/tabs.dart b/packages/flutter/lib/src/material/tabs.dart index 25bc23206f..eb7b9e7a94 100644 --- a/packages/flutter/lib/src/material/tabs.dart +++ b/packages/flutter/lib/src/material/tabs.dart @@ -729,14 +729,21 @@ class _TabBarState extends State { // Add the tap handler to each tab. If the tab bar is scrollable // then give all of the tabs equal flexibility so that their widths // reflect the intrinsic width of their labels. - for (int index = 0; index < widget.tabs.length; index++) { + final int tabCount = widget.tabs.length; + for (int index = 0; index < tabCount; index++) { wrappedTabs[index] = new MergeSemantics( - child: new Semantics( - selected: index == _currentIndex, - child: new InkWell( - onTap: () { _handleTap(index); }, - child: wrappedTabs[index], - ), + child: new Stack( + children: [ + new InkWell( + onTap: () { _handleTap(index); }, + child: wrappedTabs[index], + ), + new Semantics( + selected: index == _currentIndex, + // TODO(goderbauer): I10N-ify + label: 'Tab ${index + 1} of $tabCount', + ), + ], ), ); if (!widget.isScrollable) diff --git a/packages/flutter/test/material/tabs_test.dart b/packages/flutter/test/material/tabs_test.dart index 47c32922e0..7e9c0221a3 100644 --- a/packages/flutter/test/material/tabs_test.dart +++ b/packages/flutter/test/material/tabs_test.dart @@ -940,14 +940,14 @@ void main() { id: 2, actions: SemanticsAction.tap.index, flags: SemanticsFlags.isSelected.index, - label: 'TAB #0', + label: 'TAB #0\nTab 1 of 2', rect: new Rect.fromLTRB(0.0, 0.0, 108.0, 46.0), transform: new Matrix4.translationValues(0.0, 276.0, 0.0), ), new TestSemantics( - id: 4, + id: 5, actions: SemanticsAction.tap.index, - label: 'TAB #1', + label: 'TAB #1\nTab 2 of 2', rect: new Rect.fromLTRB(0.0, 0.0, 108.0, 46.0), transform: new Matrix4.translationValues(108.0, 276.0, 0.0), ),