look ahead

This commit is contained in:
davmar
2026-09-10 00:35:54 +02:00
parent 91d6dc9e54
commit 5b22fc8694
20 changed files with 2942 additions and 799 deletions
+27
View File
@@ -0,0 +1,27 @@
/// Provides the active bottom-nav tab index for [MainShell].
library;
import 'package:flutter/material.dart';
class ShellTabScope extends InheritedWidget {
const ShellTabScope({
super.key,
required this.index,
required super.child,
});
final int index;
static int of(BuildContext context) {
final scope = context.dependOnInheritedWidgetOfExactType<ShellTabScope>();
assert(scope != null, 'ShellTabScope not found');
return scope!.index;
}
static int? maybeOf(BuildContext context) {
return context.dependOnInheritedWidgetOfExactType<ShellTabScope>()?.index;
}
@override
bool updateShouldNotify(ShellTabScope oldWidget) => index != oldWidget.index;
}