Initial commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
|
||||
const String kWinWidthKey = 'window_width';
|
||||
const String kWinHeightKey = 'window_height';
|
||||
const String kWinXKey = 'window_x';
|
||||
const String kWinYKey = 'window_y';
|
||||
|
||||
|
||||
Future<void> saveWindowBounds() async {
|
||||
try {
|
||||
final size = await windowManager.getSize();
|
||||
final position = await windowManager.getPosition();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.setDouble(kWinWidthKey, size.width);
|
||||
await prefs.setDouble(kWinHeightKey, size.height);
|
||||
await prefs.setDouble(kWinXKey, position.dx);
|
||||
await prefs.setDouble(kWinYKey, position.dy);
|
||||
} catch (_) {}
|
||||
}
|
||||
Reference in New Issue
Block a user