Files
blumia 2185054aab feat: split settings into category pages and add an about page
- the settings screen is now an index: 通用 → 聊天, 外观 → 主题 / 宠物,
  帮助与关于 → 关于; each row opens its own page, the controls moved
  there unchanged
- 关于 shows the app version, the server's OpenCode (/api/info) and
  OpenChamber (/api/version) versions with a refresh, and the open-source
  licenses, listed per package with their full text on tap
- the app version is read from the platform at startup
  (package_info_plus), so pubspec.yaml is the only place it is written;
  the pairing/relay handshake now sends it too instead of a constant that
  had drifted
2026-11-25 12:39:48 +08:00

23 lines
921 B
Dart

// The build's version: shown in 设置 → 关于 and sent to the server in pairing
// and relay handshakes. Read from the platform at startup, so pubspec.yaml
// stays the only place the number is written.
import 'package:package_info_plus/package_info_plus.dart';
/// The version this build was made from, empty until [loadAppVersion] has
/// read it. The Android build number is left out on purpose: an ABI split
/// prefixes it with its own digit, so it would differ between the APKs of one
/// release.
String appVersion = '';
/// Reads the version this build was made from. Failure leaves [appVersion]
/// empty: the handshake still works and 关于 says the version is unknown.
Future<void> loadAppVersion() async {
try {
final info =
await PackageInfo.fromPlatform().timeout(const Duration(seconds: 3));
appVersion = info.version.trim();
} catch (_) {
// Keep the empty fallback.
}
}