Use the default theme available by the themeData for tooltips instead of library's custom theme
- Dominant language
- Dart
- Stars
- 7.6k
- Forks
- 2k
- Avg merge
- 9d 1h
- Merged PRs (30d)
- 2
Description
** Don't make a duplicate issue.
You can search in issues to make sure there isn't any already opened issue with your concern.
**Is your feature request related to a problem? Please describe.**
No
**Describe the solution you'd like**
So, currently, when making bar charts, if we have to customise the tooltip theme properties, we would define the BarTouchTooltipData that takes a single value for a theme.
Say, if the app is using a light theme, the tooltip background will be light and the text will be dark. But for dark mode, we would have to conditionally change these values. So if we just use Flutter's built-in themeData and provide TooltipThemeData for both light and dark colour schemes, it's easier to manage since we don't have to write conditional statements.
Basically making the charts adapt to any style of theme.
**Describe alternatives you've considered**
n/a
**Additional context**
This is how we could define the theme for tooltip
```dart
tooltipTheme: TooltipThemeData(
decoration: BoxDecoration(
color: lightDynamic?.inverseSurface,
),
textStyle: TextStyle(
color: lightDynamic?.onInverseSurface,
),
),
```
vs
```dart
barTouchData: BarTouchData(
touchTooltipData: BarTouchTooltipData(
tooltipRoundedRadius: 5,
tooltipBgColor: Theme.of(context)
.colorScheme
.onInverseSurface,
getTooltipItem:
(group, groupIndex, rod, rodIndex) {
return BarTooltipItem(
'test',
TextStyle(
color: Theme.of(context)
.colorScheme
.inverseSurface,
),
);
},
),
),
```
Contributor guide
Research direction
Start by tracing BarTouchTooltipData and BarTooltipItem, then review how Flutter's TooltipThemeData provides light and dark theme values. Verify the behavior with a bar chart using both theme modes; done means tooltip appearance follows the configured theme without conditional tooltip colors or text styles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, flutter
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100