Use ExcludeFocus widget when IndexedStack child is not selected for better tab traversal with keyboard / screen reader.

This commit is contained in:
Shawn 2024-01-23 10:31:23 -07:00
parent 1bfecc0ba7
commit b527acba1c

View File

@ -39,7 +39,9 @@ class LazyIndexedStackState extends State<LazyIndexedStack> {
// Mark current index as active
_activated[widget.index] = true;
final children = List.generate(_activated.length, (i) {
return _activated[i] ? widget.children[i] : const SizedBox.shrink();
Widget child = _activated[i] ? widget.children[i] : const SizedBox.shrink();
bool isSelected = widget.index == i;
return ExcludeFocus(excluding: !isSelected, child: child);
});
return IndexedStack(
alignment: widget.alignment,