import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_cached_pdfview/flutter_cached_pdfview.dart';
import '../widgets_util.dart';



class PDFViewerFromUrl extends StatelessWidget {
  PDFViewerFromUrl({Key? key, required this.url, this.onCallBack}) : super(key: key);
  Function()? onCallBack;
  final String url;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
       toolbarHeight: 0,
      ),
      body: Container(
        width: getWidth(context),
        child: PDF(
          swipeHorizontal: false,
          fitEachPage: true,
          enableSwipe: true,
          autoSpacing: true,
          pageFling: true,
        ).fromUrl(
          url,
          placeholder: (double progress) {
            if(progress==100.0){

            }
            return Center(child: Text('$progress %'));
          },
          errorWidget: (dynamic error) => Center(child: Text(error.toString())),
        ),
      ),
    );
  }
}