ScerIO / packages.flutter

👨‍💻 Plugins and packages for Flutter framework
https://pub.dev/publishers/serge.software/packages
MIT License
453 stars 442 forks source link

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

Open ortemmetro opened 7 months ago

ortemmetro commented 7 months ago

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):

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