dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

Expand doesn't expand with rotated image as child

Open Vera-Spoettl opened this issue 1 year ago • 1 comments

I have a document with header and footer. Everything else in between is space dedicated to the content, which is an image.

While it works perfectly fine when I don't rotate the image (the image fills the full horizontal space), image it doesn't take the available space when I rotate the picture: image

I have tried to move the Transform widget up in the tree, but I don't manage to get an rotated image that takes the full available height.

To Reproduce Widget build(Context context) { final head = Row(mainAxisSize: MainAxisSize.max, children: [ Expanded( child: Container( child: getHeader(context), ), ), ]);

final body = Image(MemoryImage(contentBytes!));

return Container(
  color: PdfColors.green100,
  child: Column(
    mainAxisAlignment: MainAxisAlignment.start,
    mainAxisSize: MainAxisSize.max,
    children: <Widget>[
      head,
      SizedBox(
        height: kHeaderContentPadding * PdfPageFormat.mm,
      ),
      Expanded(
        child: Align(
            alignment: Alignment.topLeft,
            child: Transform.rotateBox(
                angle: rotateContent ? pi / 2 : 0, child: body)),
      ),
      getFooter(context)
    ],
  ),
);

}

Expected behavior The rotated image should be scaled to fit into the available space.

Flutter Doctor `[✓] Flutter (Channel stable, 3.13.7, on macOS 14.0 23A344 darwin-arm64, locale de-DE) • Flutter version 3.13.7 on channel stable at /Users/veraspottl/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision 2f708eb839 (5 weeks ago), 2023-10-09 09:58:08 -0500 • Engine revision a794cf2681 • Dart version 3.1.3 • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1) • Android SDK at /Users/veraspottl/Library/Android/sdk • Platform android-33, build-tools 32.1.0-rc1 • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.13.0

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3) • Android Studio at /Applications/Android Studio.app/Contents • 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.13+0-b1751.21-8125866)

[✓] IntelliJ IDEA Community Edition (version 2021.3.2) • IntelliJ at /Applications/Dev/IntelliJ IDEA CE.app • Flutter plugin version 69.0.3 • Dart plugin version 213.7227

[✓] VS Code (version 1.84.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.76.0

[✓] Connected device (2 available) • macOS (desktop) • macos • darwin-arm64 • macOS 14.0 23A344 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.123

[✓] Network resources • All expected network resources are available.`

Desktop (please complete the following information):

  • [x] MacOS

Any help would be highly appreciated.

Vera-Spoettl avatar Nov 10 '23 12:11 Vera-Spoettl

I have no time , but hurry anwer : you know your page size , give height or width manually. Sorry , i may look at it on monday.

bksbora avatar Nov 17 '23 15:11 bksbora