24 lines
522 B
Dart
24 lines
522 B
Dart
import 'package:flutter/widgets.dart';
|
|
|
|
class LauncherVersionScope extends InheritedWidget {
|
|
const LauncherVersionScope({
|
|
super.key,
|
|
required this.version,
|
|
required super.child,
|
|
});
|
|
|
|
final String version;
|
|
|
|
static String of(BuildContext context) {
|
|
return context
|
|
.dependOnInheritedWidgetOfExactType<LauncherVersionScope>()
|
|
?.version ??
|
|
'dev';
|
|
}
|
|
|
|
@override
|
|
bool updateShouldNotify(LauncherVersionScope oldWidget) {
|
|
return version != oldWidget.version;
|
|
}
|
|
}
|