断言失败:第 1205 行第 12 行:“<optimized out>”:不是真的
Failed assertion: line 1205 pos 12: '<optimized out>': is not true
我是 Flutter 新手,在 Syncfusion Calendar 小部件中遇到问题。任何帮助将不胜感激。这是我的构建小部件中的代码:
return Scaffold(
resizeToAvoidBottomInset: false, // set it to false
body: SafeArea(
child: SfCalendar(
view: CalendarView.month,
dataSource:getData(),
monthViewSettings: MonthViewSettings(showAgenda: true,),
),
),
);
'dart:ui/painting.dart': Failed assertion: line 1205 pos 12: '': is not true.
Here is the exception line:4 > child: SfCalendar()
这是堆栈跟踪:
**> 导致错误的相关小部件是:SfCalendar
file:///Users/kashif/Desktop/AppRack/clique/lib/bottomDashboard/Calendar.dart:47:16
When the exception was thrown, this was the stack:
#2 Paint.color= (dart:ui/painting.dart:1205:12)
#3 _AppointmentRenderObject._drawMonthAppointmentIndicator (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:2042:15)
#4 _AppointmentRenderObject._drawMonthAppointment (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1698:9)
#5 _AppointmentRenderObject._drawCustomAppointmentView (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1662:11)
#6 _AppointmentRenderObject.paint (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1614:7)
#7 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2396:7)
#8 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:139:11)
#9 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#10 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:975:29)
#11 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:464:19)
#12 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:879:13)
#13 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
#14 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#15 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#16 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#20 _invoke (dart:ui/hooks.dart:163:10)
#21 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
#22 _drawFrame (dart:ui/hooks.dart:126:31) (elided 5 frames from class _AssertionError and dart:async) The following RenderObject was
being processed when the exception was fired:
_AppointmentRenderObject#b4ead ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=411.4,
h=452.8) ... layer: OffsetLayer#2d0bc ... engine layer:
OffsetEngineLayer#fc8e9 ... offset: Offset(0.0, 0.0) ... size:
Size(411.4, 452.8) RenderObject: _AppointmentRenderObject#b4ead
needs compositing parentData: (can use size) constraints:
BoxConstraints(w=411.4, h=452.8) layer: OffsetLayer#2d0bc
engine layer: OffsetEngineLayer#fc8e9
offset: Offset(0.0, 0.0) size: Size(411.4, 452.8)
====================================================================================================**
根据我们提供的信息,我们已经检查过,我们无法重现上述问题。我们为此准备了一个简单的样本,基于给定的堆栈,我们怀疑样本中的约会颜色设置为空。请找到相同的代码片段。
代码片段:
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
void main() => runApp(AgendaView());
class AgendaView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Agenda(),
);
}
}
class Agenda extends StatefulWidget {
@override
State<StatefulWidget> createState() => AgendaExample();
}
class AgendaExample extends State<Agenda> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(
child: SfCalendar(
view: CalendarView.month,
dataSource: MeetingDateSource(_getDataSource()),
monthViewSettings: MonthViewSettings(showAgenda: true),
),
),
);
}
}
List<Meeting> _getDataSource() {
List<Meeting> meets = <Meeting>[];
meets.add(Meeting('Meeting', DateTime.now(),
DateTime.now().add(Duration(minutes: 30)), Colors.pink, true));
return meets;
}
class MeetingDateSource extends CalendarDataSource {
MeetingDateSource(List<Meeting> source) {
appointments = source;
}
@override
String getSubject(int index) {
return appointments![index].eventname;
}
@override
DateTime getStartTime(int index) {
return appointments![index].from;
}
@override
DateTime getEndTime(int index) {
return appointments![index].to;
}
@override
Color getColor(int index) {
return appointments![index].bgclr;
}
@override
bool isAllDay(int index) {
return appointments![index].bval;
}
}
class Meeting {
Meeting(this.eventname, this.from, this.to, this.bgclr, this.bval);
String eventname;
DateTime from;
DateTime to;
Color bgclr;
bool bval;
}
如果分享的信息不符合您的要求,请您修改分享的示例以重现问题,或者如果可能的话,分享复制过程中使用的日历代码片段,以便我们进一步分析并为您提供最早可能的解决方案。
我是 Flutter 新手,在 Syncfusion Calendar 小部件中遇到问题。任何帮助将不胜感激。这是我的构建小部件中的代码:
return Scaffold(
resizeToAvoidBottomInset: false, // set it to false
body: SafeArea(
child: SfCalendar(
view: CalendarView.month,
dataSource:getData(),
monthViewSettings: MonthViewSettings(showAgenda: true,),
),
),
);
'dart:ui/painting.dart': Failed assertion: line 1205 pos 12: '': is not true.
Here is the exception line:4 > child: SfCalendar()
这是堆栈跟踪:
**> 导致错误的相关小部件是:SfCalendar
file:///Users/kashif/Desktop/AppRack/clique/lib/bottomDashboard/Calendar.dart:47:16 When the exception was thrown, this was the stack: #2 Paint.color= (dart:ui/painting.dart:1205:12) #3 _AppointmentRenderObject._drawMonthAppointmentIndicator (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:2042:15) #4 _AppointmentRenderObject._drawMonthAppointment (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1698:9) #5 _AppointmentRenderObject._drawCustomAppointmentView (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1662:11) #6 _AppointmentRenderObject.paint (package:syncfusion_flutter_calendar/src/calendar/appointment_layout/appointment_layout.dart:1614:7) #7 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2396:7) #8 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:139:11) #9 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5) #10 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:975:29) #11 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:464:19) #12 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:879:13) #13 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5) #14 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15) #15 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9) #16 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5) #20 _invoke (dart:ui/hooks.dart:163:10) #21 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5) #22 _drawFrame (dart:ui/hooks.dart:126:31) (elided 5 frames from class _AssertionError and dart:async) The following RenderObject was being processed when the exception was fired: _AppointmentRenderObject#b4ead ... needs compositing ... parentData: (can use size) ... constraints: BoxConstraints(w=411.4, h=452.8) ... layer: OffsetLayer#2d0bc ... engine layer: OffsetEngineLayer#fc8e9 ... offset: Offset(0.0, 0.0) ... size: Size(411.4, 452.8) RenderObject: _AppointmentRenderObject#b4ead
needs compositing parentData: (can use size) constraints: BoxConstraints(w=411.4, h=452.8) layer: OffsetLayer#2d0bc engine layer: OffsetEngineLayer#fc8e9 offset: Offset(0.0, 0.0) size: Size(411.4, 452.8) ====================================================================================================**
根据我们提供的信息,我们已经检查过,我们无法重现上述问题。我们为此准备了一个简单的样本,基于给定的堆栈,我们怀疑样本中的约会颜色设置为空。请找到相同的代码片段。
代码片段:
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/widgets.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';
void main() => runApp(AgendaView());
class AgendaView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Agenda(),
);
}
}
class Agenda extends StatefulWidget {
@override
State<StatefulWidget> createState() => AgendaExample();
}
class AgendaExample extends State<Agenda> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: SafeArea(
child: SfCalendar(
view: CalendarView.month,
dataSource: MeetingDateSource(_getDataSource()),
monthViewSettings: MonthViewSettings(showAgenda: true),
),
),
);
}
}
List<Meeting> _getDataSource() {
List<Meeting> meets = <Meeting>[];
meets.add(Meeting('Meeting', DateTime.now(),
DateTime.now().add(Duration(minutes: 30)), Colors.pink, true));
return meets;
}
class MeetingDateSource extends CalendarDataSource {
MeetingDateSource(List<Meeting> source) {
appointments = source;
}
@override
String getSubject(int index) {
return appointments![index].eventname;
}
@override
DateTime getStartTime(int index) {
return appointments![index].from;
}
@override
DateTime getEndTime(int index) {
return appointments![index].to;
}
@override
Color getColor(int index) {
return appointments![index].bgclr;
}
@override
bool isAllDay(int index) {
return appointments![index].bval;
}
}
class Meeting {
Meeting(this.eventname, this.from, this.to, this.bgclr, this.bval);
String eventname;
DateTime from;
DateTime to;
Color bgclr;
bool bval;
}
如果分享的信息不符合您的要求,请您修改分享的示例以重现问题,或者如果可能的话,分享复制过程中使用的日历代码片段,以便我们进一步分析并为您提供最早可能的解决方案。