syncfusion / flutter-widgets

Syncfusion Flutter widgets libraries include high quality UI widgets and file-format packages to help you create rich, high-quality applications for iOS, Android, and web from a single code base.
1.58k stars 772 forks source link

Widget Pointer Rendering issue #481

Closed JoelSuyati closed 2 years ago

JoelSuyati commented 2 years ago

Cannot hit test a render box that has never been laid out. The hitTest() method was called on this RenderBox: RenderWidgetPointer#b1426 NEEDS-LAYOUT NEEDS-PAINT: creator: WidgetPointer ← RadialAxisScope ← RadialAxisParentWidget ← RadialAxisInheritedWidget ← RadialAxis ← RadialGaugeScope ← Stack ← Expanded ← Column ← ColoredBox ← Container ← LimitedBox ← ⋯ parentData: offset=Offset(0.0, 0.0); id=null constraints: MISSING size: MISSING Unfortunately, this object's geometry is not known at this time, probably because it has never been laid out. This means it cannot be accurately hit-tested. If you are trying to perform a hit test during the layout phase itself, make sure you only hit test nodes that have completed layout (e.g. the node's children, after their layout() method has been called).. Error thrown null.

PraveenGopalsamy commented 2 years ago

Hi JoelSuyati,

Greetings from Syncfusion support.

We have checked the mentioned scenario, we cannot reproduce the mentioned issue from our side. Please check the attached sample and if you are still facing the issue, then please update us with more details on which scenario you are getting this issue. If possible please send us a code snippet or a simple sample to reproduce the issue which you are facing. This will help us to assist you in a better way by reproducing the exact same scenario which you are facing.

@override
Widget build(BuildContext context) {
  return SfRadialGauge(
    axes: <RadialAxis>[
      RadialAxis(
        minimum: 0,
        maximum: 100,
        interval: 10,
        pointers: <GaugePointer>[
          WidgetPointer(child: Icon(Icons.brightness_4), value: 0),
          WidgetPointer(child: CircleWidget(), value: 50),
          WidgetPointer(child: Icon(Icons.brightness_2), value: 100),
        ],
      ),
    ],
  );
}

class CircleWidget extends StatefulWidget {
  @override
  _CircleWidgetState createState() => _CircleWidgetState();
}

class _CircleWidgetState extends State<CircleWidget> {
  @override
  Widget build(BuildContext context) {
    return _CircleRenderObject();
  }
}

class _CircleRenderObject extends SingleChildRenderObjectWidget {
  @override
  RenderObject createRenderObject(BuildContext context) {
    return _CircleRenderObjectWidget();
  }
}

class _CircleRenderObjectWidget extends RenderBox {
  @override
  bool hitTestSelf(Offset position) {
    return true;
  }

  @override
  void performLayout() {
    size = Size(20, 20);
  }

  @override
  void paint(PaintingContext context, Offset offset) {
    final Paint paint = Paint()..color = Colors.red;
    final Offset center = offset + Offset(size.height, size.width) / 2;
    context.canvas.drawCircle(center, size.width / 2, paint);
  }
}

Please let us know if you need any further assistance in this.

Regards, Praveen G.

JoelSuyati commented 2 years ago

Hi Syncfusion/Flutter-Widgets Team,

Thanks for your Quick response and still I was facing the same issue below. I have mentioned more information for your reference.

In Widget pointer I used this particular widget Ripple animation as child below the link is

https://pub.dev/packages/ripple_animation

Thanks & Regards Joel Raj

On Thu, Dec 9, 2021 at 9:29 PM Praveen_G @.***> wrote:

Hi JoelSuyati,

Greetings from Syncfusion support.

We have checked the mentioned scenario, we cannot reproduce the mentioned issue from our side. Please check the attached sample and if you are still facing the issue, then please update us with more details on which scenario you are getting this issue. If possible please send us a code snippet or a simple sample to reproduce the issue which you are facing. This will help us to assist you in a better way by reproducing the exact same scenario which you are facing.

@override Widget build(BuildContext context) { return SfRadialGauge( axes: [ RadialAxis( minimum: 0, maximum: 100, interval: 10, pointers: [ WidgetPointer(child: Icon(Icons.brightness_4), value: 0), WidgetPointer(child: CircleWidget(), value: 50), WidgetPointer(child: Icon(Icons.brightness_2), value: 100), ], ), ], ); }

class CircleWidget extends StatefulWidget { @override _CircleWidgetState createState() => _CircleWidgetState(); }

class _CircleWidgetState extends State { @override Widget build(BuildContext context) { return _CircleRenderObject(); } }

class _CircleRenderObject extends SingleChildRenderObjectWidget { @override RenderObject createRenderObject(BuildContext context) { return _CircleRenderObjectWidget(); } }

class _CircleRenderObjectWidget extends RenderBox { @override bool hitTestSelf(Offset position) { return true; }

@override void performLayout() { size = Size(20, 20); }

@override void paint(PaintingContext context, Offset offset) { final Paint paint = Paint()..color = Colors.red; final Offset center = offset + Offset(size.height, size.width) / 2; context.canvas.drawCircle(center, size.width / 2, paint); } }

Please let us know if you need any further assistance in this.

Regards, Praveen G.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/syncfusion/flutter-widgets/issues/481#issuecomment-989985830, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATTKZ4TBHVISQRJMSK5CSILUQDG7RANCNFSM5JVMPMPA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

The information in this email may be privileged. If you have received it by mistake please notify the sender by return e-mail and delete the message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Any information in this message that does not relate to official business shall be understood to be neither given nor endorsed by Suyati Technologies Private Limited. Although the company has taken reasonable precaution to ensure no viruses are present in this email, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

P Please consider the environment before printing this e-mail -- SAVE PAPER! SAVE THE PLANET!!

PraveenGopalsamy commented 2 years ago

Hi JoelSuyati,

We have checked our Syncfusion Flutter Gauge using the mentioned widget as a child of WidgetPointer in the RadialGauge widget. But, we can’t reproduce the mentioned issue from our side. The gauge works properly at our end. We have attached a sample project and GIF for your reference. Kindly check it.

Sample: flutter_gauge_demo.zip GIF:

Please let us know if you need any further assistance in this.

Regards, Praveen G.