22 lines
592 B
Dart
22 lines
592 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'widgets/bottom_nav_bar.dart';
|
|
|
|
/// Allows routes (e.g. progress screen) to request switching to a tab when popping.
|
|
class TabSelectorScope extends InheritedWidget {
|
|
const TabSelectorScope({
|
|
super.key,
|
|
required this.selectTab,
|
|
required super.child,
|
|
});
|
|
|
|
final void Function(NavTab) selectTab;
|
|
|
|
static TabSelectorScope? maybeOf(BuildContext context) {
|
|
return context.dependOnInheritedWidgetOfExactType<TabSelectorScope>();
|
|
}
|
|
|
|
@override
|
|
bool updateShouldNotify(TabSelectorScope old) => selectTab != old.selectTab;
|
|
}
|