packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

When the PDF is one-page-long and user zooms in, he cannot zoom out completely.

Open ortemmetro opened this issue 5 months ago • 0 comments

Describe the bug When the PDF is one-page-long and user zooms in, he cannot zoom out completely.

To Reproduce

https://github.com/ScerIO/packages.flutter/assets/79922019/0b053b88-b81e-4308-a031-c6ecbb336b53

Code:

import 'package:pdfx/pdfx.dart';

void main() {
  runApp(const MyTestApp());
}

class MyTestApp extends StatefulWidget {
  const MyTestApp({super.key});

  @override
  State<MyTestApp> createState() => _MyTestAppState();
}

class _MyTestAppState extends State<MyTestApp> {
  late PdfControllerPinch controller;

  @override
  void initState() {
    super.initState();

    controller = PdfControllerPinch(
      document: PdfDocument.openAsset('assets/test.pdf'),
    );
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: SafeArea(
          child: Column(
            children: [
              Container(
                decoration: BoxDecoration(color: Colors.red),
                child: Text(
                  'Some title',
                  style: TextStyle(
                    color: Colors.white,
                  ),
                ),
              ),
              Expanded(
                child: PdfViewPinch(
                  controller: controller,
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Expected behavior A pdfViewer should be able to zoom out fully to see a whole page with device width.

Smartphone (please complete the following information):

  • Device: IOS simulator, Iphone 15 pro max
  • OS: IOS
  • Version: 17.2

Additional context With pdf where more than one page it works. One page pdf neither work on Android emulator, nor IOS simulator.

ortemmetro avatar Feb 21 '24 11:02 ortemmetro