feat: record window position (#692)

This commit is contained in:
Noo6
2025-02-05 20:59:04 +08:00
committed by GitHub
parent 900686f955
commit 20a39f0292
3 changed files with 25 additions and 13 deletions

View File

@@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:fl_lib/fl_lib.dart';
import 'package:server_box/data/model/app/menu/server_func.dart';
import 'package:server_box/data/model/app/server_detail_card.dart';
@@ -223,9 +225,14 @@ class SettingStore extends HiveStore {
late final betaTest = propertyDefault('betaTest', false);
/// If it's empty, skip change window size.
/// Format: {width}x{height}
late final windowSize = propertyDefault('windowSize', '');
/// For desktop only.
/// Record the position and size of the window.
late final windowState = property<WindowState>(
'windowState',
fromStr: (jsonStr) =>
WindowState.fromJson(jsonDecode(jsonStr) as Map<String, dynamic>),
toStr: (state) => state == null ? null : jsonEncode(state.toJson()),
);
late final introVer = propertyDefault('introVer', 0);