xqwzts / flutter_circular_chart

Animated radial and pie charts for Flutter
MIT License
402 stars 140 forks source link

Issue since FLUTTER 2.0 upgrade #30

Open vigshrav opened 3 years ago

vigshrav commented 3 years ago

Filename: .../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/flutter_circular_chart-0.1.0/lib/src/animated_circular_chart.dart

The below line is giving error while building app: line 121, 122: final AnimatedCircularChartState result = context .ancestorStateOfType(const TypeMatcher());

ERROR: _The method 'ancestorStateOfType' isn't defined for the class 'BuildContext'.

FAILURE: Build failed with an exception.

BUILD FAILED in 20s Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 21.9s Exception: Gradle task assembleDebug failed with exit code 1_

locrianmark commented 3 years ago

ancestorStateOfType has been depreciated. final AnimatedCircularChartState result = context.ancestorStateOfType(const TypeMatcher()); becomes: final AnimatedCircularChartState result = context.findAncestorStateOfType();

GusRodrigues86 commented 3 years ago

I'd forked the project and published the fix @locrianmark https://pub.dev/packages/flutter_circular_chart_two

shliama commented 3 years ago

@GusRodrigues86 thanks. Gotta ditch this library asap, but your fork just saved me some time 🙌

xjodoin commented 2 years ago

for a null safety version https://pub.dev/packages/awesome_circular_chart

pratikbaid3 commented 2 years ago

@xjodoin I am unable to update the chart using your fork. This is what I am getting when I run widget._chartKey.currentState!.updateData(nextData);


The following RenderObject was being processed when the exception was fired: _RenderColoredBox#19f3e relayoutBoundary=up11
...  parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...  constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...  size: MISSING
...  behavior: opaque
RenderObject: _RenderColoredBox#19f3e relayoutBoundary=up11
  parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
  constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
  size: MISSING
  behavior: opaque
...  child: RenderPadding#20c9c relayoutBoundary=up12 NEEDS-PAINT
...    parentData: <none> (can use size)
...    constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...    size: MISSING
...    padding: EdgeInsets(0.0, 0.0, 0.0, 15.0)
...    textDirection: ltr
...    child: RenderFlex#af33f relayoutBoundary=up13 NEEDS-PAINT
...      parentData: offset=Offset(0.0, 0.0) (can use size)
...      constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...      size: MISSING
...      direction: horizontal
...      mainAxisAlignment: center
...      mainAxisSize: max
...      crossAxisAlignment: center
...      textDirection: ltr
...      verticalDirection: down
...      child 1: RenderStack#9e3ec relayoutBoundary=up14 NEEDS-PAINT
...        parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...        constraints: BoxConstraints(unconstrained)
...        size: MISSING
...        alignment: AlignmentDirectional.topStart
...        textDirection: ltr
...        fit: loose
====================================================================================================

======== Exception caught by rendering library =====================================================
The following assertion was thrown during paint():
RenderBox was not laid out: _RenderColoredBox#f7d07 relayoutBoundary=up11
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1927 pos 12: 'hasSize'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

The relevant error-causing widget was: 
  Container Container:file:///Users/pratikbaid/Desktop/Work/FlutterDev/tg_final/lib/view/screens/tab_screen/tabs/collection_screen/collection_overview_screen.dart:311:27
When the exception was thrown, this was the stack: 
#2      RenderBox.size (package:flutter/src/rendering/box.dart:1927:12)
#3      _RenderColoredBox.paint (package:flutter/src/widgets/basic.dart:7526:9)
#4      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
#5      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#6      RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2792:15)
#7      RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#8      RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
#9      PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#10     RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2792:15)
#11     RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#12     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
#13     PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#14     _RenderSingleChildViewport.paint.paintContents (package:flutter/src/widgets/single_child_scroll_view.dart:542:17)
#15     _RenderSingleChildViewport.paint (package:flutter/src/widgets/single_child_scroll_view.dart:556:9)
#16     RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2403:7)
#17     PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#18     PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#19     PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:973:29)
#20     RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:499:19)
#21     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#22     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:363:5)
#23     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145:15)
#24     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
#25     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#29     _invoke (dart:ui/hooks.dart:150:10)
#30     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#31     _drawFrame (dart:ui/hooks.dart:114:31)
(elided 5 frames from class _AssertionError and dart:async)
The following RenderObject was being processed when the exception was fired: _RenderColoredBox#f7d07 relayoutBoundary=up11
...  parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...  constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...  size: MISSING
...  behavior: opaque
RenderObject: _RenderColoredBox#f7d07 relayoutBoundary=up11
  parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
  constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
  size: MISSING
  behavior: opaque
...  child: RenderPadding#8cc4a relayoutBoundary=up12 NEEDS-PAINT
...    parentData: <none> (can use size)
...    constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...    size: MISSING
...    padding: EdgeInsets(0.0, 0.0, 0.0, 15.0)
...    textDirection: ltr
...    child: RenderFlex#7a140 relayoutBoundary=up13 NEEDS-PAINT
...      parentData: offset=Offset(0.0, 0.0) (can use size)
...      constraints: BoxConstraints(0.0<=w<=428.0, 0.0<=h<=Infinity)
...      size: MISSING
...      direction: horizontal
...      mainAxisAlignment: center
...      mainAxisSize: max
...      crossAxisAlignment: center
...      textDirection: ltr
...      verticalDirection: down
...      child 1: RenderStack#fc142 relayoutBoundary=up14 NEEDS-PAINT
...        parentData: offset=Offset(0.0, 0.0); flex=null; fit=null (can use size)
...        constraints: BoxConstraints(unconstrained)
...        size: MISSING
...        alignment: AlignmentDirectional.topStart
...        textDirection: ltr
...        fit: loose
====================================================================================================```
xjodoin commented 2 years ago

I don't think is related to the project. Did you try to set the explicitly the size https://stackoverflow.com/questions/64947936/flutter-errorfailed-assertion-line-1785-pos-12-hassize

GusRodrigues86 commented 2 years ago

Set the mainAxisSize to minimum.