OpenMediacenterMobileFlutter/lib/drawer/drawer_context.dart

28 lines
696 B
Dart
Raw Permalink Normal View History

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;
}
}