Tap events handling on top of Gauge issue

Looks like tap events are handled by Gauge itself so I cant handle taps on Gauge widget.
Here is example widget where 'onTap' is not working:

Card(
     child: InkWell(
           onTap: () => print('Tap handled'),
          child: AspectRation(
               aspectRatio: 2,
               child: SfRadialGauge(
                    .........
               )
          )
     )
)

3 Replies

RS Ramya Soundar Rajan Syncfusion Team April 28, 2020 10:58 AM UTC

Hi Yegor, 
 
Greeting from Syncfusion. 
 
We have invested your query. Since GestureDetector is a subtree widget for radial gauge, so tap event that used in Inkwell is handled by gauge widget. To avoid this, we recommend you to wrap the radial gauge widget inside the IgnorePointer widget and set its ignoring property as true to ignore the hit testing for gauge as shown in the below code example, 
 
@override 
  Widget build(BuildContext context) { 
    return Scaffold( 
      body: Card( 
          child: InkWell( 
              onTap: () => print('Tap handled'), 
              child: AspectRatio( 
                  aspectRatio: 2, 
                  child: Center( 
                    child: IgnorePointer( 
                      ignoring: true, 
                        child: SfRadialGauge() 
                    ), 
                  ) 
              ) 
          ) 
      ), 
    ); 
  } 
 
Regards, 
Ramya S 



YE Yegor April 29, 2020 05:47 PM UTC

That works, thanks!


RS Ramya Soundar Rajan Syncfusion Team April 30, 2020 06:25 AM UTC

Hi Yegor, 
 
Thanks for the update.  
 
Please get in touch if you need any further assistance. 
 
Regards, 
Ramya S

Loader.
Up arrow icon