与设备的连接丢失

时间:2021-05-15 08:11:27

标签: android flutter dart

错误/警告

E/AndroidRuntime( 6128): FATAL EXCEPTION: main
    E/AndroidRuntime( 6128): Process: com.jiwdopani.jiwdopani, PID: 6128
    E/AndroidRuntime( 6128): java.lang.NoSuchMethodError: No virtual method nightMode(Z)Lcom/github/barteksc/pdfviewer/PDFView$Configurator; in class Lcom/github/barteksc/pdfviewer/PDFView$Configurator; or its super classes (declaration of 'com.github.barteksc.pdfviewer.PDFView$Configurator' appears in /data/app/~~9imhs-ZT6Cv2sON_Hq_pMw==/com.jiwdopani.jiwdopani-KZovUijapiB7Yjht2-zXEA==/base.apk)
    E/AndroidRuntime( 6128):    at io.endigo.plugins.pdfviewflutter.FlutterPDFView.<init>(FlutterPDFView.java:56)
    E/AndroidRuntime( 6128):    at io.endigo.plugins.pdfviewflutter.PDFViewFactory.create(PDFViewFactory.java:22)
    E/AndroidRuntime( 6128):    at io.flutter.plugin.platform.SingleViewPresentation.onCreate(SingleViewPresentation.java:186)
    E/AndroidRuntime( 6128):    at android.app.Dialog.dispatchOnCreate(Dialog.java:419)
    E/AndroidRuntime( 6128):    at android.app.Dialog.show(Dialog.java:313)
    E/AndroidRuntime( 6128):    at android.app.Presentation.show(Presentation.java:257)
    E/AndroidRuntime( 6128):    at io.flutter.plugin.platform.VirtualDisplayController.<init>(VirtualDisplayController.java:95)
    E/AndroidRuntime( 6128):    at io.flutter.plugin.platform.VirtualDisplayController.create(VirtualDisplayController.java:48)
    E/AndroidRuntime( 6128):    at io.flutter.plugin.platform.PlatformViewsController$1.createVirtualDisplayForPlatformView(PlatformViewsController.java:207)
    E/AndroidRuntime( 6128):    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.create(PlatformViewsChannel.java:104)
    E/AndroidRuntime( 6128):    at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:59)
    E/AndroidRuntime( 6128):    at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:233)
    E/AndroidRuntime( 6128):    at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85)
    E/AndroidRuntime( 6128):    at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:819)
    E/AndroidRuntime( 6128):    at android.os.MessageQueue.nativePollOnce(Native Method)
    E/AndroidRuntime( 6128):    at android.os.MessageQueue.next(MessageQueue.java:335)
    E/AndroidRuntime( 6128):    at android.os.Looper.loop(Looper.java:183)
    E/AndroidRuntime( 6128):    at android.app.ActivityThread.main(ActivityThread.java:7656)
    E/AndroidRuntime( 6128):    at java.lang.reflect.Method.invoke(Native Method)
    E/AndroidRuntime( 6128):    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    E/AndroidRuntime( 6128):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
    W/Gralloc4( 6128): allocator 3.x is not supported
    I/Process ( 6128): Sending signal. PID: 6128 SIG: 9
    Lost connection to device.

FilePage 类

 class FilePage extends StatelessWidget  {
          const FilePage({this.file});
          @override
          final FirebaseFile file;
          @override
          Widget build(BuildContext context) {
            final isPdf = ['.pdf'].any(file.name.contains);
            final isEpub = ['.epub'].any(file.name.contains);
            int _totalPages=0;
            int _currentPage=0;
            bool pdfReady=false;
            PDFViewController _pdfViewController;
        
            //initState(){
            return WillPopScope(
                onWillPop: () => Future.value(true),
                child: Scaffold(
                    appBar: AppBar(
                      title: Text(file.name),
                      centerTitle: true,
                    ),
                    body: isPdf
                        ? PDFView(
                       filePath:file.url,
                     nightMode:false,
                     pageSnap:true,
                      onError:(e){
                         print(e);
                      },
                      onRender: (_pages){
                         _totalPages=_pages;
                         pdfReady=true;
        
                    },
                      onViewCreated:(PDFViewController vc){
                         _pdfViewController =vc;
                                       },
                      onPageChanged: (int page,int total){
        
        
                      }
                                            )
                        : isEpub
                            ? EpubViewer(
        
        
                    )
                            : Image.network(
                                file.url,
                                height: double.infinity,
                                fit: BoxFit.cover,
                              )
        
                    // :Center(
                    // child: Text('Sorry')
                    ));
          }
        }

0 个答案:

没有答案