imaNNeo / imaNNeo/fl_chart

Bug: need twice pop(context) to close touchCallback dialogs

Open
#1,894 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Dart
Stars
7.6k
Forks
2k
Avg merge
9d 1h
Merged PRs (30d)
2

Description

**Describe the bug**
Don't know if it's me but after i upgraded fl_chart from 0.69.2 to 0.70.2, when i touch an axis-based chart on mobile to open a dialog, i need to pop(context) a few times to close it.

**To Reproduce**
Some code snippet below:
```dart
...barTouchData: BarTouchData(
touchCallback: (FlTouchEvent event, response) {
if (response == null || response.spot == null) return;
final barTouchedIndex = response.spot!.touchedBarGroupIndex;
_showSitenamesBarChart(barTouchedIndex);
},
...

// where _showSitenamesBarChart() eventually shows a dialog:
void _showSitenamesBarChart(int barTouchedIndex) {
...
showDialog(
context: context,
builder: (context) => AlertDialog(
...
actions: [
ElevatedButton(
onPressed: () => Navigator.pop(context),
child: Text("Ok"),
),
]));
}
```

**Screenshots**
https://github.com/user-attachments/assets/4082a10a-24dc-450b-92f9-be0ff85d3ad5

**Versions**
Flutter version 3.29.2

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the BarTouchData touchCallback and showDialog example on Flutter 3.29.2, checking how the chart handles touch events after the dialog opens. Trace the callback and navigation behavior around the touched bar. Done means the dialog closes with a single Navigator.pop(context) and the regression is covered by a test or reproducible case.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
frontend, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.