Closed FetFrumos closed 3 months ago
Hi @FetFrumos, We are unable to replicate the reported issue. Please check the video recording of the issue replication and let us know what we are missing in replicating the video.
https://github.com/user-attachments/assets/41c46404-3ab0-497c-a364-3690259478b4
dependencies:
flutter:
sdk: flutter
syncfusion_flutter_pdfviewer: '26.1.39'
path_provider:
file_picker:
import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
void main() {
runApp(const MainApp());
}
class MainApp extends StatelessWidget {
const MainApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
home: PDFViewerPage(),
);
}
}
class PDFViewerPage extends StatefulWidget {
const PDFViewerPage({super.key});
@override
State<PDFViewerPage> createState() => _PDFViewerPageState();
}
class _PDFViewerPageState extends State<PDFViewerPage> {
File? _file;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [
IconButton(
onPressed: _open,
icon: const Icon(Icons.folder),
),
],
),
body: _file != null
? SfPdfViewer.file(
_file!,
pageLayoutMode: PdfPageLayoutMode.single,
pageSpacing: 20,
canShowScrollStatus: false,
canShowScrollHead: false,
enableTextSelection: false,
enableDoubleTapZooming: false,
onTap: (details) {
print('Page number: ${details.pageNumber}');
},
)
: const Center(child: CircularProgressIndicator()),
);
}
Future<void> _open() async {
final result = await FilePicker.platform.pickFiles(
type: FileType.custom,
allowedExtensions: ['pdf'],
);
if (result != null) {
final path = result.files.single.path!;
setState(() {
_file = File(path);
});
}
}
}
@immankumarsync Please, please check the versions that are older 26.1.40. I checked with 26.2.7 and 26.2.8. These versions have issue "Null check operator used on a null value"
@FetFrumos, we are able to replicate the reported issue rarely when switching the documents faster. We will fix the issue based on the provided stack trace. This will be included in our August 20,2024 weekly release.
@FetFrumos, we have resolved the issue based on the stack trace and fix is available in our latest weekly release. Package link: syncfusion_flutter_pdfviewer v26.2.10
Kindly let us know whether the issue is resolved on your end.
@immankumarsync - it is fixed, thanks.
Bug description
I used syncfusion_flutter_pdfviewer 26.2.7 in my Flutter(3.22) app. This is my code:
return SfPdfViewer.file(file, pageSpacing: pageSpacing, pageLayoutMode: pageLayoutMode, canShowScrollStatus: canShowScrollStatus, canShowScrollHead: canShowScrollHead, enableTextSelection: enableTextSelection, enableDoubleTapZooming: enableDoubleTapZooming, onTap: (details) {
Screenshots or Video
Screenshots / Video demonstration
![image](https://github.com/user-attachments/assets/8bbf21b2-0c4e-4ebd-9ac3-a6c7b5f33402)Stack Traces
Stack Traces
Null check operator used on a null value The relevant error-causing widget was: ```dart When the exception was thrown, this was the stack: #0 SinglePageViewState.build.On which target platforms have you observed this bug?
Android
Flutter Doctor output
Doctor output
```console [✓] Flutter (Channel stable, 3.22.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-UA) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.4) [✓] Chrome - develop for the web [✓] Android Studio (version 2024.1) [✓] VS Code (version 1.92.1) [✓] Connected device (4 available) [✓] Network resources • No issues found! ```