Skip to content

Commit 7db8439

Browse files
committed
v1.10.2: P0 versions sync + P1 FormatUtils résiduels + cap image annotate
1 parent 3403c3d commit 7db8439

9 files changed

Lines changed: 53 additions & 59 deletions

File tree

‎android/app/build.gradle.kts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ android {
5454
defaultConfig {
5555
applicationId = "com.pdftech.pdf_tech"
5656
minSdk = flutter.minSdkVersion
57-
// Pinné explicitement à 35 (cohérence avec compileSdk = 35) au lieu
57+
// Pinné explicitement à 35 (cohérence avec compileSdk = 36) au lieu
5858
// de suivre `flutter.targetSdkVersion` qui peut diverger selon le SDK.
5959
targetSdk = 35
6060
versionCode = flutter.versionCode

‎lib/screens/about_screen.dart‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class AboutScreen extends StatefulWidget {
1010
}
1111

1212
class _AboutScreenState extends State<AboutScreen> {
13-
static const _version = '1.10.0';
13+
static const _version = '1.10.2';
1414
static const _author = 'Patrice Haltaya';
1515

1616
bool _checkingUpdate = false;
@@ -216,7 +216,7 @@ class _AboutScreenState extends State<AboutScreen> {
216216
),
217217
const SizedBox(height: 8),
218218
Text(
219-
'Gestionnaire de PDF complet — 23 outils',
219+
'Gestionnaire de PDF complet — 22 outils',
220220
style: Theme.of(context).textTheme.bodySmall,
221221
textAlign: TextAlign.center,
222222
),

‎lib/screens/cloud/google_drive_screen.dart‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,8 @@ class _GoogleDriveScreenState extends State<GoogleDriveScreen> {
158158
}
159159

160160
String _formatSize(String? sizeStr) {
161-
if (sizeStr == null) return '';
162-
final bytes = int.tryParse(sizeStr);
163-
if (bytes == null) return '';
164-
if (bytes < 1024) return '$bytes o';
165-
if (bytes < 1024 * 1024) return '${(bytes / 1024).toStringAsFixed(1)} Ko';
166-
return '${(bytes / (1024 * 1024)).toStringAsFixed(2)} Mo';
161+
final n = int.tryParse(sizeStr ?? '') ?? 0;
162+
return FormatUtils.bytes(n);
167163
}
168164

169165
String _formatDate(DateTime? dt) {

‎lib/screens/tools/decrypt_screen.dart‎

Lines changed: 7 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'package:flutter/material.dart';
22
import 'package:share_plus/share_plus.dart';
33
import '../../services/pdf_tools_service.dart';
4+
import '../../widgets/pdf_file_header.dart';
45
import '../../widgets/pdf_picker_screen.dart';
56

67
class DecryptScreen extends StatefulWidget {
@@ -145,43 +146,12 @@ class _DecryptScreenState extends State<DecryptScreen> {
145146
// Fichier
146147
Text('Fichier PDF', style: Theme.of(context).textTheme.titleSmall),
147148
const SizedBox(height: 8),
148-
_path == null
149-
? SizedBox(
150-
width: double.infinity,
151-
child: OutlinedButton.icon(
152-
onPressed: _pickFile,
153-
icon: const Icon(Icons.folder_open),
154-
label: const Text('Choisir un PDF'),
155-
style: OutlinedButton.styleFrom(
156-
minimumSize: const Size(0, 48),
157-
),
158-
),
159-
)
160-
: ListTile(
161-
contentPadding: EdgeInsets.zero,
162-
leading: Container(
163-
width: 40,
164-
height: 40,
165-
decoration: BoxDecoration(
166-
color: Colors.red.withValues(alpha: 0.1),
167-
borderRadius: BorderRadius.circular(8),
168-
),
169-
child: const Icon(
170-
Icons.picture_as_pdf,
171-
color: Colors.red,
172-
size: 22,
173-
),
174-
),
175-
title: Text(
176-
_name!,
177-
overflow: TextOverflow.ellipsis,
178-
style: const TextStyle(fontSize: 13),
179-
),
180-
trailing: TextButton(
181-
onPressed: _pickFile,
182-
child: const Text('Changer'),
183-
),
184-
),
149+
PdfFilePickerCard(
150+
fileName: _name,
151+
onPick: _pickFile,
152+
pickLabel: _path == null ? 'Choisir' : 'Changer',
153+
emptyLabel: 'Choisir un PDF',
154+
),
185155
const SizedBox(height: 24),
186156

187157
// Mot de passe

‎lib/screens/tools/images_to_pdf_screen.dart‎

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,42 @@ class _ImagesToPdfScreenState extends State<ImagesToPdfScreen> {
4343
bool _isProcessing = false;
4444

4545
Future<void> _pickImages() async {
46+
final messenger = ScaffoldMessenger.of(context);
4647
final result = await FilePicker.pickFiles(
4748
type: FileType.image,
4849
allowMultiple: true,
4950
);
5051
if (result == null) return;
51-
setState(() {
52-
for (final f in result.files) {
53-
if (f.path != null && !_images.contains(f.path)) {
54-
_images.add(f.path!);
52+
final accepted = <String>[];
53+
var skipped = 0;
54+
for (final f in result.files) {
55+
final p = f.path;
56+
if (p == null || _images.contains(p)) continue;
57+
try {
58+
final len = await File(p).length();
59+
if (len > 20 * 1024 * 1024) {
60+
skipped++;
61+
continue;
5562
}
63+
} catch (_) {
64+
skipped++;
65+
continue;
5666
}
67+
accepted.add(p);
68+
}
69+
if (!mounted) return;
70+
setState(() {
71+
_images.addAll(accepted);
5772
});
73+
if (skipped > 0) {
74+
messenger.showSnackBar(
75+
SnackBar(
76+
content: Text(
77+
'$skipped image${skipped > 1 ? 's' : ''} ignorée${skipped > 1 ? 's' : ''} (>20 Mo)',
78+
),
79+
),
80+
);
81+
}
5882
}
5983

6084
Future<void> _convert() async {

‎lib/screens/tools/merge_screen.dart‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22
import 'package:flutter/material.dart';
3+
import 'package:files_tech_core/files_tech_core.dart';
34
import '../../services/pdf_tools_service.dart';
45
import '../../widgets/pdf_picker_screen.dart';
56
import '../../widgets/result_sheet.dart';
@@ -73,12 +74,7 @@ class _MergeScreenState extends State<MergeScreen> {
7374
}
7475

7576
String _fileName(String path) => path.split(RegExp(r'[/\\]')).last;
76-
String _fileSize(String path) {
77-
final bytes = _fileSizes[path] ?? 0;
78-
return bytes < 1024 * 1024
79-
? '${(bytes / 1024).toStringAsFixed(1)} Ko'
80-
: '${(bytes / (1024 * 1024)).toStringAsFixed(1)} Mo';
81-
}
77+
String _fileSize(String path) => FormatUtils.bytes(_fileSizes[path] ?? 0);
8278

8379
@override
8480
Widget build(BuildContext context) {

‎lib/screens/tools/pdf_annotate_screen.dart‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,15 @@ class _PdfAnnotateScreenState extends State<PdfAnnotateScreen> {
133133
final messenger = ScaffoldMessenger.of(context);
134134
final res = await FilePicker.pickFiles(type: FileType.image);
135135
if (res == null || res.files.single.path == null) return;
136-
final bytes = await File(res.files.single.path!).readAsBytes();
136+
final imgFile = File(res.files.single.path!);
137+
final length = await imgFile.length();
138+
if (length > 30 * 1024 * 1024) {
139+
messenger.showSnackBar(
140+
const SnackBar(content: Text('Image trop volumineuse (>30 Mo)')),
141+
);
142+
return;
143+
}
144+
final bytes = await imgFile.readAsBytes();
137145
if (bytes.isEmpty) return;
138146
// Validation : on tente de décoder via PdfBitmap pour détecter les
139147
// images non supportées (HEIC sans codec, fichiers corrompus, etc.)

‎lib/services/app_update.dart‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import 'package:files_tech_core/files_tech_core.dart';
66
const appUpdateService = UpdateService(
77
owner: 'gitubpatrice',
88
repo: 'PDF-TECH',
9-
currentVersion: '1.10.0',
9+
currentVersion: '1.10.2',
1010
);

‎pubspec.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: pdf_tech
22
description: "Application de gestion de PDF - lecture, annotation, création, partage"
33
publish_to: 'none'
4-
version: 1.10.1+11001
4+
version: 1.10.2+11002
55

66
environment:
77
sdk: ^3.11.5

0 commit comments

Comments
 (0)