Commit 8497513
release 1.12.1 fix: right padding and honor theme/y2-axis space (#58)
* fix: remove hardcoded 80px right padding and honor theme/y2-axis space\n\n- AnimatedChartPainter: rightPadding = theme.padding.right + y2AxisSpace\n- AnimatedCristalyseChartWidget: stop reserving 80px; align plotArea calc with painter\n- Cleanup unused hasSecondaryY vars\n\nThis fixes excessive right padding even when no secondary Y-axis is present and keeps hit-testing aligned with the rendered plot area.
* fix: align widget plotArea calculation with painter for correct interactions\n\nWidget now calculates y2AxisSpace the same way the painter does:\n- Measures actual Y2 label widths using TextPainter\n- Accounts for axis width, tick spacing, and optional title\n- Ensures plotArea dimensions match between rendering and hit-testing\n\nThis fixes interaction misalignment (hover, click, pan) when using\nsecondary Y-axis charts, where widget plotArea was previously wider\nthan the actual rendered plot area by y2AxisSpace pixels.
* refactor: extract y2AxisSpace calculation into helper method\n\nReplace duplicated y2AxisSpace calculation logic (lines ~546-580 and\n~858-892) with a single helper method _calculateY2AxisSpace().\n\nBenefits:\n- Eliminates 70 lines of code duplication\n- Single source of truth for y2-axis space calculation\n- Easier maintenance and consistency\n- Prevents logic drift between the two locations
* feat: boundary clamping, option to disable infinite panning (#62)
* fix: use conservative y2-axis space estimate for layout, precise calculation at paint time
- Replace _calculateY2AxisSpace() with _estimateY2AxisSpace() that uses 80px conservative upper bound
- Widget layout now uses simple fixed estimate before scales are initialized
- Painter continues to calculate precise y2AxisSpace at paint time with full scale info
- Eliminates divergence between widget layout calculation and painter rendering
- Ensures plotArea and hit-testing alignment with rendered output
- Reverts to pragmatic approach: layout just needs reasonable estimate, rendering needs precision
* update flutter version in ci workflow
* refine: check y2Scale is non-null in _estimateY2AxisSpace
Only reserve 80px conservative estimate when both hasSecondaryYAxis returns
true AND chartWidget.y2Scale is non-null, ensuring we don't allocate space
for axes that don't actually exist. Painter will refine at paint time.
* docs: add 1.12.1 changelog entry with secondary y-axis layout fix details
---------
Co-authored-by: Jón Bjarni <jbbjarnason@gmail.com>1 parent 5d51a28 commit 8497513
File tree
9 files changed
+74
-12
lines changed- .github/workflows
- doc
- example
- lib/src/widgets
9 files changed
+74
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
1 | 28 | | |
2 | 29 | | |
3 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | | - | |
| 1104 | + | |
1105 | 1105 | | |
1106 | 1106 | | |
1107 | 1107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| 108 | + | |
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
15 | 38 | | |
16 | 39 | | |
17 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
206 | 205 | | |
207 | 206 | | |
208 | 207 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
543 | 543 | | |
544 | 544 | | |
545 | 545 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 546 | + | |
| 547 | + | |
549 | 548 | | |
550 | 549 | | |
551 | 550 | | |
| |||
823 | 822 | | |
824 | 823 | | |
825 | 824 | | |
826 | | - | |
827 | | - | |
828 | | - | |
| 825 | + | |
| 826 | + | |
829 | 827 | | |
830 | 828 | | |
831 | 829 | | |
| |||
1065 | 1063 | | |
1066 | 1064 | | |
1067 | 1065 | | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
1068 | 1080 | | |
1069 | 1081 | | |
1070 | 1082 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
0 commit comments