Closed Mu7ammadRasul closed 6 months ago
Hey, thanks for opening the issue!
In theory the ListView
s should be supported. You can run the test in test/widget_multichild_test.dart
and check the output.
Could you add a minimal reproduction of the issue, e.g. how you use the package exactly?
Well i have wrapped "ExportedFrame" within body of Scaffold for the state and i have had frameId declared within the scope of the current statefull widget, The following is what should be captured and exported to pdfDoc,
But the following is what ends up to be when i save it to a local storage,
Also the following is how i implemented the crucial parts of the flutter_to_pdf
widget,
String frameId = 'imvoice_printing'; final ExportDelegate exportDelegate = ExportDelegate(ttfFonts: { 'NRT': 'assets/font/NRT-Reg.ttf', }, options: const ExportOptions(pageFormatOptions: PageFormatOptions.a4()));
And
ExportFrame( frameId: frameId, exportDelegate: exportDelegate,...
Note that the buttons at the bottom of the first screenshot are not meant to be included and they are not included.
And
final ExportOptions overrideOptions = const ExportOptions( pageFormatOptions: PageFormatOptions.a4(), );
`Future
await file.writeAsBytes(await document.save());
await Share.shareXFiles([XFile(file.path)], text: 'Here is a PDF.');
debugPrint('Saved exported PDF at: ${file.path}');
}`
And
AppBar( actions: [ IconButton( onPressed: () async { final pdf = await exportDelegate.exportToPdfDocument(frameId, overrideOptions: overrideOptions); saveFile(pdf, widget.id); }, icon: const Icon(Icons.print)) ],)
Just checked the tests for the multi child widgets, specifically the ListView
test. And seems like there is some issue ListView
s at the moment.
Not sure whether that's due to a recent flutter update or due to the underlying pdf
package, since I didn't do much investigation.
Will have to dig a bit deeper, but won't happen until middle of next month, since I got a lot on my plate at the moment.
In case you want to investigate, feel free to open a PR.
Furthermore, to narrow down the issue it would be good to provide the flutter doctor
output. Since I'm having the same issue when running the test - here is mine:
Doctor summary (to see all details, run flutter doctor -v):
[!] Flutter (Channel stable, 3.16.7, on macOS 14.4.1 23E224 darwin-x64, locale de-DE)
! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.18.6/libexec/bin/dart, which is not inside your current Flutter SDK checkout at /Users/josephgrabinger/Development/flutter.
Consider adding /Users/josephgrabinger/Development/flutter/bin to the front of your path.
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
[✓] Chrome - develop for the web
[!] Android Studio (version unknown)
✗ Unable to determine Android Studio version.
✗ Unable to find bundled Java version.
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.88.1)
[✓] Connected device (2 available)
[✓] Network resources
! Doctor found issues in 2 categories.
hi, thanks for reaching out back to me,
[√] Flutter (Channel stable, 3.19.6, on Microsoft Windows [Version 10.0.22631.3527], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.6.2)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
development with C++" workload, and include these components:
MSVC v142 - VS 2019 C++ x64/x86 build tools
- If there are multiple build tool versions available, install the latest
C++ CMake tools for Windows
Windows 10 SDK
[√] Android Studio (version 2023.2)
[√] VS Code (version 1.89.0)
[√] Connected device (4 available)
[√] Network resources
! Doctor found issues in 1 category.
i might've had flutter upgraded by now than previously when i had the issue or not but the issue is persisting and dang it I'm too busy to investigate into it, the current project is quite massive to just hold it off, i hope you get your situation back to progress and really do the work which is highly appreciated though...
Nested ListViews with shrinkwrap still break the export for me so I had to replace them with Columns
i have a page where a list of items alongside some other text widgets are shown but the "flutter_to_pdf" widget only works when i wrap it to the text widgets but if i wrap the whole page with the two variants of widgets "Text and ListView/StreamBuilder" it doesn't even convert anything to a pdf file! it also doesn't convert Texts to pdf files.