Add about page
This commit is contained in:
37
lib/features/common/runtime_details.dart
Normal file
37
lib/features/common/runtime_details.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:hiddify/utils/utils.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'runtime_details.freezed.dart';
|
||||
part 'runtime_details.g.dart';
|
||||
|
||||
// TODO implement clash version
|
||||
@Riverpod(keepAlive: true)
|
||||
class RuntimeDetailsNotifier extends _$RuntimeDetailsNotifier with AppLogger {
|
||||
@override
|
||||
Future<RuntimeDetails> build() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
return RuntimeDetails(
|
||||
version: packageInfo.version,
|
||||
buildNumber: packageInfo.buildNumber,
|
||||
installerStore: packageInfo.installerStore,
|
||||
clashVersion: "",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
class RuntimeDetails with _$RuntimeDetails {
|
||||
const RuntimeDetails._();
|
||||
|
||||
const factory RuntimeDetails({
|
||||
required String version,
|
||||
required String buildNumber,
|
||||
String? installerStore,
|
||||
required String clashVersion,
|
||||
}) = _RuntimeDetails;
|
||||
|
||||
factory RuntimeDetails.fromJson(Map<String, dynamic> json) =>
|
||||
_$RuntimeDetailsFromJson(json);
|
||||
}
|
||||
Reference in New Issue
Block a user