dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

PdfPreview does not work inside column or row

Open neeoder opened this issue 1 year ago • 0 comments

Describe the bug When put inside a row or column widget the following error gets thrown: "The following assertion was thrown during performLayout(): 'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 346 pos 12: 'child!.hasSize': is not true." Same error on windows, chrome and android. The error gets thrown a bunch of times at the start and at every touch/click.

Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 17025dd882 (2 weeks ago) • 2024-12-17 03:23:09 +0900 Engine • revision cb4b5fff73 Tools • Dart 3.6.0 • DevTools 2.40.2

To Reproduce Code snippet to reproduce the behavior:

return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        alignment: Alignment.center,
        child: Column(
          children: [
            PdfPreview(
              build: (format) => _generatePdf(format),
            ),
            ElevatedButton(
              child: Text('Print'),
              onPressed: () {},
            )
          ],
        ),
      ),
    );

Expected behavior The Pdf preview over a simple button

Flutter Doctor [√] Flutter (Channel stable, 3.27.1, on Microsoft Windows [Version 10.0.22631.4602], locale de-DE) • Flutter version 3.27.1 on channel stable at C:\dev\flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 17025dd882 (2 weeks ago), 2024-12-17 03:23:09 +0900 • Engine revision cb4b5fff73 • Dart version 3.6.0 • DevTools version 2.40.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0) • Android SDK at C:\Users\Felix B. Nickel\AppData\Local\Android\sdk • Platform android-35, build-tools 35.0.0 • Java binary at: C:\Users\Felix B. Nickel\AppData\Local\Programs\Android Studio\jbr\bin\java • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4) • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community • Visual Studio Community 2022 version 17.7.34031.279 • Windows 10 SDK version 10.0.22621.0

[√] Android Studio (version 2022.1) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.15+0-b2043.56-9505619)

[√] Android Studio (version 2024.1) • Android Studio at C:\Users\Felix B. Nickel\AppData\Local\Programs\Android Studio • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)

[√] IntelliJ IDEA Community Edition (version 2024.2) • IntelliJ at C:\Users\Felix B. Nickel\AppData\Local\Programs\IntelliJ IDEA Community Edition • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart

[√] IntelliJ IDEA Ultimate Edition (version 2024.2) • IntelliJ at C:\Users\Felix B. Nickel\AppData\Local\Programs\IntelliJ IDEA Ultimate • Flutter plugin can be installed from: https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: https://plugins.jetbrains.com/plugin/6351-dart

[√] VS Code (version 1.86.0) • VS Code at C:\Users\Felix B. Nickel\AppData\Local\Programs\Microsoft VS Code • Flutter extension can be installed from: https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4602] • Chrome (web) • chrome • web-javascript • Google Chrome 130.0.6723.117 • Edge (web) • edge • web-javascript • Microsoft Edge 130.0.2849.80

[√] Network resources • All expected network resources are available.

• No issues found!

Desktop (please complete the following information):

  • [ ] iOS
  • [x] Android
  • [x] Browser
  • [x] Windows
  • [ ] Linux

Smartphone (please complete the following information):

  • Device: PC / Pixel 7a
  • OS: Windows 11 / Android
  • Desktop Application / APK / Browser chrome

neeoder avatar Dec 30 '24 11:12 neeoder