feat: taskbar title shows file name, icon sizes 16-256, settings order, fixed 4-col size grid (v1.9.0)
This commit is contained in:
1 parent
eed0646237
commit
a5969cf28f
13 files changed
+135
-98
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:desktop_drop/desktop_drop.dart';
|
||||
import 'package:pdf/pdf.dart';
|
||||
@@ -18,7 +19,7 @@ import '../shortcuts/app_shortcuts.dart';
|
||||
import '../services/window_persistence.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
|
||||
const appVersion = '1.8.0';
|
||||
const appVersion = '1.9.0';
|
||||
|
||||
class ViewerScreen extends StatefulWidget {
|
||||
final List<String> initialFiles;
|
||||
@@ -45,7 +46,10 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
if (widget.initialFiles.isNotEmpty) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
FileHandler.loadImagesFromPaths(widget.initialFiles);
|
||||
_updateTitle();
|
||||
});
|
||||
} else {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => _updateTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +89,18 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
|
||||
void _onImageManagerChanged() {
|
||||
setState(() => _hasImages = ImageManager.instance.images.isNotEmpty);
|
||||
_updateTitle();
|
||||
}
|
||||
|
||||
/// Taskbar/alt-tab başlığı = açılan dosyanın adı (görsel yoksa uygulama adı).
|
||||
Future<void> _updateTitle() async {
|
||||
final image = ImageManager.instance.currentImagePath;
|
||||
final name = image.isEmpty ? 'imajViewer' : p.basename(image);
|
||||
try {
|
||||
await windowManager.setTitle(name);
|
||||
} catch (_) {
|
||||
// Başlık güncellenemezse sessizce geç.
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _doSave() async {
|
||||
@@ -111,6 +127,36 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (_hasImages) ...[
|
||||
Text(AppLocalizations.of(context)!.fileProperties,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 13)),
|
||||
const SizedBox(height: 4),
|
||||
FutureBuilder<List<(String, String)>>(
|
||||
future: _fileProperties(ImageManager.instance.currentImagePath),
|
||||
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(
|
||||
TextSpan(children: [
|
||||
TextSpan(text: '${r.$1}: ', style: const TextStyle(color: Colors.white70, fontSize: 13)),
|
||||
TextSpan(text: r.$2, style: const TextStyle(color: Colors.white, fontSize: 13)),
|
||||
]),
|
||||
),
|
||||
)).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const Divider(color: Colors.white24, height: 24),
|
||||
],
|
||||
WindowSizeSelector(
|
||||
workArea: _workArea,
|
||||
onPick: _applyWindowSize,
|
||||
),
|
||||
const Divider(color: Colors.white24, height: 24),
|
||||
Text(AppLocalizations.of(context)!.sortBy,
|
||||
style: const TextStyle(color: Colors.white70, fontSize: 13)),
|
||||
RadioListTile<bool>(
|
||||
@@ -137,36 +183,6 @@ class _ViewerScreenState extends State<ViewerScreen> with WindowListener {
|
||||
setDialogState(() {});
|
||||
},
|
||||
),
|
||||
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)),
|
||||
const SizedBox(height: 4),
|
||||
FutureBuilder<List<(String, String)>>(
|
||||
future: _fileProperties(ImageManager.instance.currentImagePath),
|
||||
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(
|
||||
TextSpan(children: [
|
||||
TextSpan(text: '${r.$1}: ', style: const TextStyle(color: Colors.white70, fontSize: 13)),
|
||||
TextSpan(text: r.$2, style: const TextStyle(color: Colors.white, fontSize: 13)),
|
||||
]),
|
||||
),
|
||||
)).toList(),
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
Text('imajViewer $appVersion',
|
||||
style: const TextStyle(color: Colors.white, fontSize: 15)),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
Reference in new issue
Block a user