gpt4 book ai didi

flutter - 偏移量参数包含 NaN 值

转载 作者:行者123 更新时间:2023-12-03 02:48:16 25 4
gpt4 key购买 nike

我正在处理堆栈中的可拖动小部件。每次我重新启动应用程序并启动状态时,它都会给我“Offset argument contained a NaN value”。

主事件包含标签栏堆栈和可拖动的帮助小部件。我将可拖动小部件的初始位置 offset(300,300) 设置在页面的右下角。

import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:marqoum/Bookmarks.dart';
import 'Helper.dart';
import 'PdfViewPage.dart';
import 'HelpingList.dart';

class MainActivityPage extends StatefulWidget {
final String path;

const MainActivityPage({Key key, this.path}) : super(key: key);
@override
State<StatefulWidget> createState() {
return bMainActivityPage();
}
}

class bMainActivityPage extends State<MainActivityPage>
with TickerProviderStateMixin {
static final myTabbedPageKey = new GlobalKey<bMainActivityPage>();

TabController etabController;

bool isClicked = false;
int delay = 1000;
@override
void initState() {
super.initState();

etabController = TabController(vsync: this, length: 2);
}

@override
void dispose() {
etabController.dispose();
super.dispose();
}

@override
Widget build(BuildContext context) {
List<Widget> myTabs = [PdfViewPage(path: widget.path), Bookmarks()];

return DefaultTabController(
length: 2,
initialIndex: 0,
child: Scaffold(
bottomNavigationBar: Container(
margin: EdgeInsets.only(bottom: 20),
child: TabBar(
controller: etabController,
onTap: (tappedPage) {
setState(() {
if (tappedPage == 1) {
print("Hi one");
}
});
},
tabs: <Widget>[
Tab(
text: 'الكتاب ',
icon: Icon(
Icons.picture_as_pdf,
),
),
Tab(
text: 'المفضلة ',
icon: Icon(
Icons.bookmark_border,
),
),
],
unselectedLabelColor: Colors.black,
labelColor: Color(0xfffc3b398),
indicatorColor: Color(0xfffc3b398),
indicatorWeight: 2,
),
),
body: Stack(
children: <Widget>[
TabBarView(
controller: etabController,
children: myTabs,
physics: NeverScrollableScrollPhysics(),
),
Helper(
initPos: Offset(232, 2),
isPressed: (bool isPressed) {
setState(() {
isClicked = isPressed;
});
},
),
Visibility(
child: HelpingList(),
visible: isClicked,
)
],
)),
);
}
}

可拖动

import 'package:flutter/material.dart'; 
class Helper extends StatefulWidget {
//DECLARING THE HELPING WIDGET INITIAL POSITION
final Offset initPos;
final Function(bool ispressed) isPressed;

//INITIAL POITION'S CONSTRUCTOR
Helper({this.initPos, this.isPressed});

@override
State<StatefulWidget> createState() {
return _helper();
}
}

class _helper extends State<Helper> {
Offset position ;
double height = 50, width = 50;
bool isclicked = false;
@override
void initState() {
super.initState();
position = widget.initPos;
}

@override
Widget build(BuildContext context) {
return Positioned(
left: position.dx,
top: position.dy,
child: Draggable(
child: helpingButton(),
onDraggableCanceled: (velocity, offset) {
setState(() {
isclicked = false;
widget.isPressed(isclicked);
height = 50;
width = 50;
position = offset;
});
},
feedback: feedBackHelpingButton()));
}

Widget helpingButton() {
return AnimatedContainer(
height: height,
width: width,
duration: Duration(milliseconds: 300),
curve: Curves.easeInSine,
child: FloatingActionButton(
backgroundColor: Color(0xfffc3b398),
child: helpingIcon(),
onPressed: () {
setState(() {
isclicked = true;
isclicked
? {
height = 100,
width = 100,
widget.isPressed(isclicked),
position = Offset(150, 150),
}
: {
isclicked = false,
};
});
},
),
);
}

Widget helpingIcon() {
return Icon(
Icons.list,
color: Colors.white,
);
}

Widget feedBackHelpingButton() {
return Container(
height: height + 10,
width: width + 10,
child: FloatingActionButton(
backgroundColor: Color(0xfffc3b398).withOpacity(0.5),
child: helpingIcon(),
onPressed: () {
return null;
},
));
}
}
D/jniPdfium(12697): Destroy FPDF library
W/libEGL (12697): EGLNativeWindowType 0x71ea582010 disconnect failed
Restarted application in 1,865ms.
I/flutter (12697): /data/user/0/com.example.marqoum/app_flutter/test.pdf
V/AudioManager(12697): playSoundEffect effectType: 0
E/BufferQueueProducer(12697): [] [hwsched]Can not get hwsched service
D/CubicBezierInterpolator(12697): CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator(12697): CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
D/CubicBezierInterpolator(12697): CubicBezierInterpolator mControlPoint1x = 0.23, mControlPoint1y = 0.06, mControlPoint2x = 0.09, mControlPoint2y = 0.97
D/CubicBezierInterpolator(12697): CubicBezierInterpolator mControlPoint1x = 0.6, mControlPoint1y = 0.9, mControlPoint2x = 0.8, mControlPoint2y = 1.0
D/com.shockwave.pdfium.PdfiumCore(12697): Starting PdfiumAndroid 1.9.0
D/HwRTBlurUtils(12697): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@616db92, Nhwext : 0, get Blur : disable with , null
D/HwRTBlurUtils(12697): check blur style for HwPhoneWindow, themeResId : 0x0103023e, context : android.app.Presentation$3@616db92, Nhwext : 0, get Blur : disable with , null
D/OpenGLRenderer(12697): HWUI Binary is enabled
I/PressGestureDetector(12697): HiTouch restricted: Sub windows restricted.
D/jniPdfium(12697): Init FPDF library
D/mali_winsys(12697): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
D/OpenGLRenderer(12697): HWUI Binary is enabled
I/flutter (12697): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (12697): The following assertion was thrown during paint():
I/flutter (12697): Offset argument contained a NaN value.
I/flutter (12697): 'dart:ui/painting.dart': Failed assertion: line 38: '<optimized out>'
I/flutter (12697):
I/flutter (12697): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (12697): more information in this error message to help you determine and fix the underlying cause.
I/flutter (12697): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (12697): https://github.com/flutter/flutter/issues/new?template=BUG.md
I/flutter (12697):
I/flutter (12697): When the exception was thrown, this was the stack:
I/flutter (12697): #2 _offsetIsValid (dart:ui/painting.dart:38:10)
I/flutter (12697): #3 Canvas.drawCircle (dart:ui/painting.dart:3382:12)
I/flutter (12697): #4 _BoxDecorationPainter._paintBox
I/flutter (12697): #5 _BoxDecorationPainter._paintBackgroundColor
I/flutter (12697): #6 _BoxDecorationPainter.paint
I/flutter (12697): #7 RenderDecoratedBox.paint
I/flutter (12697): #8 RenderObject._paintWithContext
I/flutter (12697): #9 PaintingContext.paintChild
I/flutter (12697): #10 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #11 RenderObject._paintWithContext
I/flutter (12697): #12 PaintingContext.paintChild
I/flutter (12697): #13 RenderShiftedBox.paint
I/flutter (12697): #14 RenderObject._paintWithContext
I/flutter (12697): #15 PaintingContext.paintChild
I/flutter (12697): #16 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #17 RenderFractionalTranslation.paint
I/flutter (12697): #18 RenderObject._paintWithContext
I/flutter (12697): #19 PaintingContext.paintChild
I/flutter (12697): #20 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #21 RenderTransform.paint
I/flutter (12697): #22 RenderObject._paintWithContext
I/flutter (12697): #23 PaintingContext.paintChild
I/flutter (12697): #24 _RenderLayoutBuilder.paint
I/flutter (12697): #25 RenderObject._paintWithContext
I/flutter (12697): #26 PaintingContext.paintChild
I/flutter (12697): #27 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
I/flutter (12697): #28 RenderStack.paintStack
I/flutter (12697): #29 RenderStack.paint
I/flutter (12697): #30 RenderObject._paintWithContext
I/flutter (12697): #31 PaintingContext.paintChild
I/flutter (12697): #32 RenderShiftedBox.paint
I/flutter (12697): #33 RenderObject._paintWithContext
I/flutter (12697): #34 PaintingContext.paintChild
I/flutter (12697): #35 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #36 RenderObject._paintWithContext
I/flutter (12697): #37 PaintingContext.paintChild
I/flutter (12697): #38 RenderShiftedBox.paint
I/flutter (12697): #39 RenderObject._paintWithContext
I/flutter (12697): #40 PaintingContext.paintChild
I/flutter (12697): #41 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #42 RenderObject._paintWithContext
I/flutter (12697): #43 PaintingContext.paintChild
I/flutter (12697): #44 RenderShiftedBox.paint
I/flutter (12697): #45 RenderObject._paintWithContext
I/flutter (12697): #46 PaintingContext.paintChild
I/flutter (12697): #47 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #48 RenderDecoratedBox.paint
I/flutter (12697): #49 RenderObject._paintWithContext
I/flutter (12697): #50 PaintingContext.paintChild
I/flutter (12697): #51 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #52 RenderObject._paintWithContext
I/flutter (12697): #53 PaintingContext.paintChild
I/flutter (12697): #54 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #55 RenderPointerListener.paint
I/flutter (12697): #56 RenderObject._paintWithContext
I/flutter (12697): #57 PaintingContext.paintChild
I/flutter (12697): #58 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #59 RenderObject._paintWithContext
I/flutter (12697): #60 PaintingContext.paintChild
I/flutter (12697): #61 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #62 RenderDecoratedBox.paint
I/flutter (12697): #63 RenderObject._paintWithContext
I/flutter (12697): #64 PaintingContext.paintChild
I/flutter (12697): #65 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #66 RenderObject._paintWithContext
I/flutter (12697): #67 PaintingContext.paintChild
I/flutter (12697): #68 RenderShiftedBox.paint
I/flutter (12697): #69 RenderObject._paintWithContext
I/flutter (12697): #70 PaintingContext.paintChild
I/flutter (12697): #71 RenderShiftedBox.paint
I/flutter (12697): #72 RenderObject._paintWithContext
I/flutter (12697): #73 PaintingContext.paintChild
I/flutter (12697): #74 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
I/flutter (12697): #75 RenderStack.paintStack
I/flutter (12697): #76 RenderStack.paint
I/flutter (12697): #77 RenderObject._paintWithContext
I/flutter (12697): #78 PaintingContext.paintChild
I/flutter (12697): #79 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #80 RenderObject._paintWithContext
I/flutter (12697): #81 PaintingContext._repaintCompositedChild
I/flutter (12697): #82 PaintingContext.repaintCompositedChild
I/flutter (12697): #83 PaintingContext._compositeChild
I/flutter (12697): #84 PaintingContext.paintChild
I/flutter (12697): #85 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #86 RenderObject._paintWithContext
I/flutter (12697): #87 PaintingContext.paintChild
I/flutter (12697): #88 RenderSliverMultiBoxAdaptor.paint
I/flutter (12697): #89 RenderObject._paintWithContext
I/flutter (12697): #90 PaintingContext.paintChild
I/flutter (12697): #91 RenderViewportBase._paintContents
I/flutter (12697): #92 PaintingContext.pushLayer
I/flutter (12697): #93 PaintingContext.pushClipRect
I/flutter (12697): #94 RenderViewportBase.paint
I/flutter (12697): #95 RenderObject._paintWithContext
I/flutter (12697): #96 PaintingContext._repaintCompositedChild
I/flutter (12697): #97 PaintingContext.repaintCompositedChild
I/flutter (12697): #98 PaintingContext._compositeChild
I/flutter (12697): #99 PaintingContext.paintChild
I/flutter (12697): #100 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #101 RenderObject._paintWithContext
I/flutter (12697): #102 PaintingContext.paintChild
I/flutter (12697): #103 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #104 RenderObject._paintWithContext
I/flutter (12697): #105 PaintingContext.paintChild
I/flutter (12697): #106 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #107 RenderPointerListener.paint
I/flutter (12697): #108 RenderObject._paintWithContext
I/flutter (12697): #109 PaintingContext.paintChild
I/flutter (12697): #110 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #111 RenderObject._paintWithContext
I/flutter (12697): #112 PaintingContext.paintChild
I/flutter (12697): #113 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #114 RenderPointerListener.paint
I/flutter (12697): #115 RenderObject._paintWithContext
I/flutter (12697): #116 PaintingContext.paintChild
I/flutter (12697): #117 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #118 RenderObject._paintWithContext
I/flutter (12697): #119 PaintingContext.paintChild
I/flutter (12697): #120 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #121 RenderObject._paintWithContext
I/flutter (12697): #122 PaintingContext._repaintCompositedChild
I/flutter (12697): [onPageChanged, {total: 22, page: 0}]
I/flutter (12697): [onRender, {pages: 22}]
I/flutter (12697): [onPageChanged, {total: 22, page: 0}]
I/flutter (12697): [onPageChanged, {total: 22, page: 0}]
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): Failed to handle method call
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): java.lang.IllegalStateException: Reply already submitted
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:124)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:204)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.endigo.plugins.pdfviewflutter.FlutterPDFView.setPage(FlutterPDFView.java:119)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.endigo.plugins.pdfviewflutter.FlutterPDFView.onMethodCall(FlutterPDFView.java:102)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:201)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:88)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:219)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at android.os.MessageQueue.nativePollOnce(Native Method)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at android.os.MessageQueue.next(MessageQueue.java:379)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at android.os.Looper.loop(Looper.java:144)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at android.app.ActivityThread.main(ActivityThread.java:7555)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at java.lang.reflect.Method.invoke(Native Method)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
E/MethodChannel#plugins.endigo.io/pdfview_0(12697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
E/DartMessenger(12697): Uncaught exception in binary message listener
E/DartMessenger(12697): java.lang.IllegalStateException: Reply already submitted
E/DartMessenger(12697): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:124)
E/DartMessenger(12697): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:219)
E/DartMessenger(12697): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:88)
E/DartMessenger(12697): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:219)
E/DartMessenger(12697): at android.os.MessageQueue.nativePollOnce(Native Method)
E/DartMessenger(12697): at android.os.MessageQueue.next(MessageQueue.java:379)
E/DartMessenger(12697): at android.os.Looper.loop(Looper.java:144)
E/DartMessenger(12697): at android.app.ActivityThread.main(ActivityThread.java:7555)
E/DartMessenger(12697): at java.lang.reflect.Method.invoke(Native Method)
E/DartMessenger(12697): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:469)
E/DartMessenger(12697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:963)
I/flutter (12697): #123 PaintingContext.repaintCompositedChild
I/flutter (12697): #124 PaintingContext._compositeChild
I/flutter (12697): #125 PaintingContext.paintChild
I/flutter (12697): #126 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #127 RenderCustomPaint.paint
I/flutter (12697): #128 RenderObject._paintWithContext
I/flutter (12697): #129 PaintingContext.paintChild
I/flutter (12697): #130 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #131 RenderObject._paintWithContext
I/flutter (12697): #132 PaintingContext._repaintCompositedChild
I/flutter (12697): #133 PaintingContext.repaintCompositedChild
I/flutter (12697): #134 PaintingContext._compositeChild
I/flutter (12697): #135 PaintingContext.paintChild
I/flutter (12697): #136 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
I/flutter (12697): #137 RenderStack.paintStack
I/flutter (12697): #138 RenderStack.paint
I/flutter (12697): #139 RenderObject._paintWithContext
I/flutter (12697): #140 PaintingContext.paintChild
I/flutter (12697): #141 _RenderCustomMultiChildLayoutBox&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
I/flutter (12697): #142 RenderCustomMultiChildLayoutBox.paint
I/flutter (12697): #143 RenderObject._paintWithContext
I/flutter (12697): #144 PaintingContext.paintChild
I/flutter (12697): #145 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #146 _RenderInkFeatures.paint
I/flutter (12697): #147 RenderObject._paintWithContext
I/flutter (12697): #148 PaintingContext.paintChild
I/flutter (12697): #149 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #150 PaintingContext.pushLayer
I/flutter (12697): #151 RenderPhysicalModel.paint
I/flutter (12697): #152 RenderObject._paintWithContext
I/flutter (12697): #153 PaintingContext.paintChild
I/flutter (12697): #154 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #155 RenderObject._paintWithContext
I/flutter (12697): #156 PaintingContext.paintChild
I/flutter (12697): #157 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #158 RenderObject._paintWithContext
I/flutter (12697): #159 PaintingContext._repaintCompositedChild
I/flutter (12697): #160 PaintingContext.repaintCompositedChild
I/flutter (12697): #161 PaintingContext._compositeChild
I/flutter (12697): #162 PaintingContext.paintChild
I/flutter (12697): #163 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #164 RenderObject._paintWithContext
I/flutter (12697): #165 PaintingContext.paintChild
I/flutter (12697): #166 RenderAnimatedOpacity.paint
I/flutter (12697): #167 RenderObject._paintWithContext
I/flutter (12697): #168 PaintingContext.paintChild
I/flutter (12697): #169 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #170 RenderFractionalTranslation.paint
I/flutter (12697): #171 RenderObject._paintWithContext
I/flutter (12697): #172 PaintingContext.paintChild
I/flutter (12697): #173 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #174 RenderObject._paintWithContext
I/flutter (12697): #175 PaintingContext._repaintCompositedChild
I/flutter (12697): #176 PaintingContext.repaintCompositedChild
I/flutter (12697): #177 PaintingContext._compositeChild
I/flutter (12697): #178 PaintingContext.paintChild
I/flutter (12697): #179 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #180 RenderObject._paintWithContext
I/flutter (12697): #181 PaintingContext.paintChild
I/flutter (12697): #182 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #183 RenderOffstage.paint
I/flutter (12697): #184 RenderObject._paintWithContext
I/flutter (12697): #185 PaintingContext.paintChild
I/flutter (12697): #186 _RenderStack&RenderBox&ContainerRenderObjectMixin&RenderBoxContainerDefaultsMixin.defaultPaint
I/flutter (12697): #187 RenderStack.paintStack
I/flutter (12697): #188 RenderStack.paint
I/flutter (12697): #189 RenderObject._paintWithContext
I/flutter (12697): #190 PaintingContext.paintChild
I/flutter (12697): #191 __RenderTheatre&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #192 RenderObject._paintWithContext
I/flutter (12697): #193 PaintingContext.paintChild
I/flutter (12697): #194 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #195 RenderObject._paintWithContext
I/flutter (12697): #196 PaintingContext.paintChild
I/flutter (12697): #197 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #198 RenderObject._paintWithContext
I/flutter (12697): #199 PaintingContext.paintChild
I/flutter (12697): #200 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #201 RenderPointerListener.paint
I/flutter (12697): #202 RenderObject._paintWithContext
I/flutter (12697): #203 PaintingContext.paintChild
I/flutter (12697): #204 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #205 RenderCustomPaint.paint
I/flutter (12697): #206 RenderObject._paintWithContext
I/flutter (12697): #207 PaintingContext.paintChild
I/flutter (12697): #208 _RenderProxyBox&RenderBox&RenderObjectWithChildMixin&RenderProxyBoxMixin.paint
I/flutter (12697): #209 RenderObject._paintWithContext
I/flutter (12697): #210 PaintingContext.paintChild
I/flutter (12697): #211 RenderView.paint
I/flutter (12697): #212 RenderObject._paintWithContext
I/flutter (12697): #213 PaintingContext._repaintCompositedChild
I/flutter (12697): #214 PaintingContext.repaintCompositedChild
I/flutter (12697): #215 PipelineOwner.flushPaint
I/flutter (12697): #216 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding.drawFrame
I/flutter (12697): #217 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding&WidgetsBinding.drawFrame
I/flutter (12697): #218 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&SemanticsBinding&RendererBinding._handlePersistentFrameCallback
I/flutter (12697): #219 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback
I/flutter (12697): #220 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame
I/flutter (12697): #221 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame
I/flutter (12697): #225 _invoke (dart:ui/hooks.dart:219:10)
I/flutter (12697): #226 _drawFrame (dart:ui/hooks.dart:178:3)
I/flutter (12697): (elided 5 frames from class _AssertionError and package dart:async)
I/flutter (12697):
I/flutter (12697): The following RenderObject was being processed when the exception was fired:
I/flutter (12697): RenderDecoratedBox#0f20d
I/flutter (12697): creator: DecoratedBox ← ConstrainedBox ← Container ← CircleThumb ← Center ← FractionalTranslation
I/flutter (12697): ← Transform ← LayoutBuilder ← Stack ← Padding ← AspectRatio ← Center ← ⋯
I/flutter (12697): parentData: <none> (can use size)
I/flutter (12697): constraints: BoxConstraints(w=20.0, h=20.0)
I/flutter (12697): size: Size(20.0, 20.0)
I/flutter (12697): decoration: BoxDecoration
I/flutter (12697): configuration: ImageConfiguration(bundle: PlatformAssetBundle#0f312(), devicePixelRatio: 3.0,
I/flutter (12697): locale: en_US, textDirection: TextDirection.ltr, platform: android)
I/flutter (12697): This RenderObject has no descendants.
I/flutter (12697): ════════════════════════════════════════════════════════════════════════════════════════════════════
I/flutter (12697): Another exception was thrown: Offset argument contained a NaN value.
I/flutter (12697): Another exception was thrown: Offset argument contained a NaN value.

最佳答案

错误 NaN 可能是由除以不能转换为数字的变量引起的。

Flutter 在除以 0 时不会抛出错误。因此您可以使用以下方法检查 NaN:

if (number == double.nan)

关于flutter - 偏移量参数包含 NaN 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56852760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com