There was an error while loading. Please reload this page.
1 parent 6f4e07c commit 3c112d0Copy full SHA for 3c112d0
1 file changed
navigation_and_routing/lib/src/screens/books.dart
@@ -31,6 +31,14 @@ class _BooksScreenState extends State<BooksScreen>
31
..addListener(_handleTabIndexChanged);
32
}
33
34
+ @override
35
+ void didUpdateWidget(covariant BooksScreen oldWidget) {
36
+ super.didUpdateWidget(oldWidget);
37
+ if (oldWidget.selectedIndex != widget.selectedIndex) {
38
+ _tabController.index = widget.selectedIndex;
39
+ }
40
41
+
42
@override
43
void dispose() {
44
_tabController.removeListener(_handleTabIndexChanged);
@@ -39,7 +47,6 @@ class _BooksScreenState extends State<BooksScreen>
47
48
49
Widget build(BuildContext context) {
- _tabController.index = widget.selectedIndex;
50
return Scaffold(
51
appBar: AppBar(
45
52
title: const Text('Books'),
0 commit comments