OpenMediacenterMobileFlutter/lib/login/login_context.dart

26 lines
657 B
Dart

import 'package:flutter/material.dart';
class LoginContext extends InheritedWidget {
const LoginContext(
{Key? key,
required Widget child,
required this.loggedIn,
required this.onLoggin})
: super(key: key, child: child);
final bool loggedIn;
final void Function(bool) onLoggin;
static LoginContext of(BuildContext context) {
final LoginContext? result =
context.dependOnInheritedWidgetOfExactType<LoginContext>();
assert(result != null, 'No LoginContext found in context');
return result!;
}
@override
bool updateShouldNotify(LoginContext old) {
return loggedIn != old.loggedIn;
}
}