fluttercandies / flutter_filereader

Flutter实现的本地文件(pdf word excel 等)查看插件,非在线预览
Other
109 stars 51 forks source link

在FileReaderView外面加一层ListView一直报错 #63

Open qinjinze opened 2 years ago

qinjinze commented 2 years ago

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown during performResize(): RenderAndroidView object was given an infinite size during layout. This probably means that it is a render object that tries to be as big as possible, but it was put inside another render object that allows its children to pick their own size. The nearest ancestor providing an unbounded height constraint is: RenderIndexedSemantics#14dc3 relayoutBoundary=up14 NEEDS-LAYOUT NEEDS-PAINT: needs compositing creator: IndexedSemantics ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← KeyedSubtree ← SliverList ← MediaQuery ← SliverPadding ← ShrinkWrappingViewport ← IgnorePointer-[GlobalKey#75a48] ← Semantics ← Listener ← ⋯ parentData: index=0; layoutOffset=0.0 (can use size) constraints: BoxConstraints(w=330.0, 0.0<=h<=Infinity) semantic boundary size: Size(330.0, 20.0) index: 0 The constraints that applied to the RenderAndroidView were: BoxConstraints(0.0<=w<=330.0, 0.0<=h<=Infinity) The exact size it was given was: Size(330.0, Infinity) See https://flutter.dev/docs/development/ui/layout/box-constraints for more information.

The relevant error-causing widget was: AndroidView AndroidView:file:///E:/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_filereader-3.0.0/lib/flutter_filereader.dart:109:12

When the exception was thrown, this was the stack:

0 RenderBox.debugAssertDoesMeetConstraints. (package:flutter/src/rendering/box.dart:2205:9)

1 RenderBox.debugAssertDoesMeetConstraints (package:flutter/src/rendering/box.dart:2299:6)

2 RenderBox.size=. (package:flutter/src/rendering/box.dart:1991:7)

3 RenderBox.size= (package:flutter/src/rendering/box.dart:1993:6)

4 RenderBox.performResize (package:flutter/src/rendering/box.dart:2331:5)

5 RenderAndroidView.performResize (package:flutter/src/rendering/platform_view.dart:173:11)

6 RenderObject.layout (package:flutter/src/rendering/object.dart:1837:9)

7 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

8 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

9 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:437:14)

10 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

11 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

12 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

13 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

14 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

15 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:213:28)

16 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

17 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)

18 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)

19 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

20 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)

21 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1923:12)

22 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1881:20)

23 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

24 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

25 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

26 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

27 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

28 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

29 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

30 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

31 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

32 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

33 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

34 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

35 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

36 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

37 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

38 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

39 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)

40 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

41 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)

42 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

43 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:277:14)

44 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)

45 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)

46 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1097:7)

47 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)

48 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)

49 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1713:7)

50 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:885:18)

51 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)

52 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)

53 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)

54 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)

55 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)

56 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)

60 _invoke (dart:ui/hooks.dart:166:10)

61 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)

62 _drawFrame (dart:ui/hooks.dart:129:31)

(elided 3 frames from dart:async)

The following RenderObject was being processed when the exception was fired: RenderAndroidView#6b64c NEEDS-LAYOUT NEEDS-PAINT: needs compositing creator: _AndroidPlatformView ← Semantics ← _FocusMarker ← Focus ← AndroidView ← FileReaderView ← Center ← RepaintBoundary ← IndexedSemantics ← NotificationListener ← KeepAlive ← AutomaticKeepAlive ← ⋯ parentData: (can use size) constraints: BoxConstraints(0.0<=w<=330.0, 0.0<=h<=Infinity) semantic boundary size: Size(330.0, Infinity) This RenderObject has no descendants. ════════════════════════════════════════════════════════════════════════════════════════════════════

Another exception was thrown: RenderAndroidView object was given an infinite size during layout.

Another exception was thrown: RenderSemanticsAnnotations object was given an infinite size during layout.

Another exception was thrown: RenderPositionedBox object was given an infinite size during layout.

Another exception was thrown: RenderRepaintBoundary object was given an infinite size during layout.

Another exception was thrown: RenderIndexedSemantics object was given an infinite size during layout.

qinjinze commented 2 years ago
  body: Container(
    child:
    ListView(
      shrinkWrap : true,

      // 设置方向
      scrollDirection: Axis.vertical,
      // 设置到边缘后的效果
      physics: new AlwaysScrollableScrollPhysics(),
      // 添加监听器
      controller: _controller,
      children: [
        Center(
          child: widget.filePath == null || widget.filePath == ""
              ? Text("点击左上角按钮打开阅读内容")
              : FileReaderView(
                  filePath: widget.filePath,
                ),
        )
      ],
    ),
  ),