28 lines
696 B
Dart
28 lines
696 B
Dart
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
import 'drawer_page.dart';
|
||
|
|
||
|
class DrawerContext extends InheritedWidget {
|
||
|
const DrawerContext({
|
||
|
Key? key,
|
||
|
required Widget child,
|
||
|
required this.onChangePage,
|
||
|
required this.routeName,
|
||
|
}) : super(key: key, child: child);
|
||
|
|
||
|
final void Function(Section) onChangePage;
|
||
|
final String routeName;
|
||
|
|
||
|
static DrawerContext of(BuildContext context) {
|
||
|
final DrawerContext? result =
|
||
|
context.dependOnInheritedWidgetOfExactType<DrawerContext>();
|
||
|
assert(result != null, 'No DrawerContext found in context');
|
||
|
return result!;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
bool updateShouldNotify(covariant InheritedWidget oldWidget) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|