feat: window size presets — 4x8 screen-ratio grid in settings (v1.8.0)
- Settings 'Size' section: 8 col x 4 row grid, 31 buttons labeled a:b (a splits H, b splits W); top-left cell empty placeholder (no 1:1 — title bar double click already maximizes) - Click resizes the window to work.width/b x work.height/a of the display's work area (screen_retriever visibleSize, taskbar excluded); position unchanged, no selection state tracking - minimumSize 400x300 -> 160x100 (4:8 cell needs it) - Settings file-properties rows left-aligned (were centered under path)
This commit is contained in:
1 parent
8a80cba116
commit
9a7480cd68
11 files changed
+150
-3
No files matched your search
@@ -13,11 +13,12 @@ import '../services/crop_save_service.dart';
|
||||
import '../widgets/custom_title_bar.dart';
|
||||
import '../widgets/image_canvas.dart';
|
||||
import '../widgets/window_resize_zones.dart';
|
||||
import '../widgets/window_size_selector.dart';
|
||||
import '../shortcuts/app_shortcuts.dart';
|
||||
import '../services/window_persistence.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
const appVersion = '1.7.2';
|
||||
const appVersion = '1.8.0';
|
||||
|
||||
class ViewerScreen extends StatefulWidget {
|
||||
final List<String> initialFiles;
|
||||
@@ -137,6 +138,11 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
},
|
||||
),
|
||||
const Divider(color: Colors.white24, height: 24),
|
||||
WindowSizeSelector(
|
||||
workArea: _workArea,
|
||||
onPick: _applyWindowSize,
|
||||
),
|
||||
const Divider(color: Colors.white24, height: 24),
|
||||
if (_hasImages) ...[
|
||||
Text(AppLocalizations.of(context)!.fileProperties,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 13)),
|
||||
@@ -146,6 +152,7 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
builder: (context, snap) {
|
||||
if (!snap.hasData) return const SizedBox(height: 20);
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: snap.data!.map((r) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 2),
|
||||
child: Text.rich(
|
||||
@@ -259,6 +266,19 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
|
||||
void _flipHorizontal() => _canvasKey.currentState?.toggleFlipH();
|
||||
|
||||
Future<Size?> _workArea() async {
|
||||
final pos = await windowManager.getPosition();
|
||||
return WindowPersistence.workAreaSize(windowPosition: pos);
|
||||
}
|
||||
|
||||
Future<void> _applyWindowSize(int rows, int cols, Size work) async {
|
||||
try {
|
||||
await windowManager.setSize(Size(work.width / cols, work.height / rows));
|
||||
} catch (_) {
|
||||
// Boyutlandırma başarısız olursa sessizce geç (buton saf eylem).
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _cropSave() async {
|
||||
final path = ImageManager.instance.currentImagePath;
|
||||
final state = _canvasKey.currentState;
|
||||
|
||||
Reference in new issue
Block a user