Skip to content

Commit

Permalink
Merge pull request imaNNeo#613 from imaNNeoFighT/dev
Browse files Browse the repository at this point in the history
Dev 0.30.0
  • Loading branch information
imaNNeo authored Mar 22, 2021
2 parents 56edb2c + f65499c commit 6876bdc
Show file tree
Hide file tree
Showing 62 changed files with 2,039 additions and 2,066 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Publish
uses: sakebook/actions-flutter-pub-publisher@v1.2.1
uses: sakebook/actions-flutter-pub-publisher@v1.3.1
with:
credential: ${{ secrets.CREDENTIAL_JSON }}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 0.30.0
* [IMPROVEMENT] We now use [RenderObject](https://api.flutter.dev/flutter/rendering/RenderObject-class.html) as our default drawing system. It brings a lot of stability. Such as size handling, hitTest handling (touches), and It makes us possible to paint Widgets inside our chart (It might fix #383, #556, #582, #584, #591).
* [IMPROVEMENT] Added [Radar Chart Documentations](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/radar_chart.md)
* [IMPROVEMENT] Added `textAlign` property in the [BarTooltipItem](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md#bartooltipitem), [LineTooltipItem](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#linetooltipitem), and [ScatterTooltipItem](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/scatter_chart.md#scattertooltipitem), default is `TextAlign.center`.
* [IMPROVEMENT] Added `direction` property in the [BarTouchTooltipData](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md#bartouchtooltipdata), and [LineTouchTooltipData](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#linetouchtooltipdata) to specify the position of the tooltip (can be `auto`, `top`, `bottom`), default is `auto`.
* [IMPROVEMENT] Updated touch flow, we now use [hitTest](https://api.flutter.dev/flutter/rendering/RenderProxyBoxWithHitTestBehavior/hitTest.html) for handling touch and interactions.
* [IMPROVEMENT] Added 'clickHappened' property in all of our TouchResponses (such as [LineTouchResponse](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#LineTouchResponse), [BarTouchResponse](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md#bartouchresponse), ...), #210.
* [IMPROVEMENT] Added `swapAnimationCurve` property to all chart widgets which handles the built-in animation [Curve](https://api.flutter.dev/flutter/animation/Curves-class.html), #436.
* [BREAKING] Some properties in [ScatterTouchResponse](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/scatter_chart.md#scattertouchresponse), and [PieTouchResponse](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/pie_chart.md#pietouchresponse) moved to a wrapper class, you need to access them through that wrapper class.
* [BREAKING] Renamed `tooltipBottomMargin` to `tooltipMargin` property in the [BarTouchTooltipData](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md#bartouchtooltipdata), and [LineTouchTooltipData](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#linetouchtooltipdata)
* [Bugfix] Fixed `double.infinity` in [PieChartData](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/pie_chart.md#piechartdata) .centerSpaceRadius, #584.

## 0.20.1
* [BREAKING] We now support flutter version 2.0 (null-safety), check out the [migration guide](https://dart.dev/null-safety/migration-guide).
* [NEW_CHART] We have added [RadarChart](https://github.com/payam-zahedi/fl_chart/blob/master/repo_files/documentations/radar_chart.md). Thanks to [Payam Zahedi](https://github.com/payam-zahedi)!
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
|ScatterChart |RadarChart| Coming Soon|
|:------------:|:------------:|:-------------:|
| [![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/scatter_chart/scatter_chart_sample_1.gif)](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/scatter_chart.md#sample-1-source-code) [![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/scatter_chart/scatter_chart_sample_2.gif)](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/scatter_chart.md#sample-2-source-code) | ![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/radar_chart/radar_chart_sample_1.jpg) ![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/blank.jpg)|![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/blank.jpg) ![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/blank.jpg)|
|[Read More](repo_files/documentations/scatter_chart.md)|Read More Coming Soon!||
|[Read More](repo_files/documentations/scatter_chart.md)|[Read More](repo_files/documentations/radar_chart.md)||

Banner designed by [Soheil Saffar](https://www.linkedin.com/in/soheilsaffar), and
samples inspired from
Expand All @@ -41,7 +41,7 @@ Thank you all!

```yml
dependencies:
fl_chart: ^0.20.1
fl_chart: ^0.30.0
```
Expand All @@ -60,9 +60,6 @@ flutter packages get
|:------------:|:------------:|:-------------:|
| [![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/line_chart/line_chart_sample_1_anim.gif)](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#sample-1-source-code) | [![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/line_chart/line_chart_sample_2_anim.gif)](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/line_chart.md#sample-2-source-code) | [![](https://github.com/imaNNeoFighT/fl_chart/raw/master/repo_files/images/bar_chart/bar_chart_sample_1_anim.gif)](https://github.com/imaNNeoFighT/fl_chart/blob/master/repo_files/documentations/bar_chart.md#sample-1-source-code) |

### 4 - Follow the roadmap
##### you can follow the roadmap from [here](repo_files/documentations/roadmap.md), and (let me know your suggestions)


### And the last but not least 🔥
##### :beer: pull requests are welcome!
Expand Down
6 changes: 3 additions & 3 deletions example/lib/bar_chart/samples/bar_chart_sample1.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:async';
import 'dart:math';

import 'package:flutter/gestures.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';

Expand Down Expand Up @@ -182,8 +182,8 @@ class BarChartSample1State extends State<BarChartSample1> {
touchCallback: (barTouchResponse) {
setState(() {
if (barTouchResponse.spot != null &&
barTouchResponse.touchInput is! FlPanEnd &&
barTouchResponse.touchInput is! FlLongPressEnd) {
barTouchResponse.touchInput is! PointerUpEvent &&
barTouchResponse.touchInput is! PointerExitEvent) {
touchedIndex = barTouchResponse.spot.touchedBarGroupIndex;
} else {
touchedIndex = -1;
Expand Down
5 changes: 3 additions & 2 deletions example/lib/bar_chart/samples/bar_chart_sample2.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';

class BarChartSample2 extends StatefulWidget {
@override
Expand Down Expand Up @@ -105,8 +106,8 @@ class BarChartSample2State extends State<BarChartSample2> {
touchedGroupIndex = response.spot.touchedBarGroupIndex;

setState(() {
if (response.touchInput is FlLongPressEnd ||
response.touchInput is FlPanEnd) {
if (response.touchInput is PointerExitEvent ||
response.touchInput is PointerUpEvent) {
touchedGroupIndex = -1;
showingBarGroups = List.of(rawBarGroups);
} else {
Expand Down
2 changes: 1 addition & 1 deletion example/lib/bar_chart/samples/bar_chart_sample3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BarChartSample3State extends State<BarChartSample3> {
touchTooltipData: BarTouchTooltipData(
tooltipBgColor: Colors.transparent,
tooltipPadding: const EdgeInsets.all(0),
tooltipBottomMargin: 8,
tooltipMargin: 8,
getTooltipItem: (
BarChartGroupData group,
int groupIndex,
Expand Down
8 changes: 5 additions & 3 deletions example/lib/line_chart/samples/line_chart_sample3.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';

class LineChartSample3 extends StatefulWidget {
final weekDays = ['Sat', 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri'];
Expand Down Expand Up @@ -96,9 +97,10 @@ class _LineChartSample3State extends State<LineChartSample3> {
}).toList();
}),
touchCallback: (LineTouchResponse lineTouch) {
if (lineTouch.lineBarSpots.length == 1 &&
lineTouch.touchInput is! FlLongPressEnd &&
lineTouch.touchInput is! FlPanEnd) {
final desiredTouch = lineTouch.touchInput is! PointerExitEvent &&
lineTouch.touchInput is! PointerUpEvent;

if (desiredTouch && lineTouch.lineBarSpots != null) {
final value = lineTouch.lineBarSpots[0].x;

if (value == 0 || value == 6) {
Expand Down
11 changes: 6 additions & 5 deletions example/lib/pie_chart/samples/pie_chart_sample1.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';

import 'package:flutter/gestures.dart';
import 'indicator.dart';

class PieChartSample1 extends StatefulWidget {
Expand Down Expand Up @@ -66,11 +66,12 @@ class PieChartSample1State extends State {
PieChartData(
pieTouchData: PieTouchData(touchCallback: (pieTouchResponse) {
setState(() {
if (pieTouchResponse.touchInput is FlLongPressEnd ||
pieTouchResponse.touchInput is FlPanEnd) {
touchedIndex = -1;
final desiredTouch = pieTouchResponse.touchInput is! PointerExitEvent &&
pieTouchResponse.touchInput is! PointerUpEvent;
if (desiredTouch && pieTouchResponse.touchedSection != null) {
touchedIndex = pieTouchResponse.touchedSection.touchedSectionIndex;
} else {
touchedIndex = pieTouchResponse.touchedSectionIndex;
touchedIndex = -1;
}
});
}),
Expand Down
11 changes: 6 additions & 5 deletions example/lib/pie_chart/samples/pie_chart_sample2.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';

import 'package:flutter/gestures.dart';
import 'indicator.dart';

class PieChartSample2 extends StatefulWidget {
Expand Down Expand Up @@ -29,11 +29,12 @@ class PieChart2State extends State {
PieChartData(
pieTouchData: PieTouchData(touchCallback: (pieTouchResponse) {
setState(() {
if (pieTouchResponse.touchInput is FlLongPressEnd ||
pieTouchResponse.touchInput is FlPanEnd) {
touchedIndex = -1;
final desiredTouch = pieTouchResponse.touchInput is! PointerExitEvent &&
pieTouchResponse.touchInput is! PointerUpEvent;
if (desiredTouch && pieTouchResponse.touchedSection != null) {
touchedIndex = pieTouchResponse.touchedSection.touchedSectionIndex;
} else {
touchedIndex = pieTouchResponse.touchedSectionIndex;
touchedIndex = -1;
}
});
}),
Expand Down
10 changes: 6 additions & 4 deletions example/lib/pie_chart/samples/pie_chart_sample3.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter/gestures.dart';

/// Icons by svgrepo.com (https://www.svgrepo.com/collection/job-and-professions-3/)
class PieChartSample3 extends StatefulWidget {
Expand All @@ -24,11 +25,12 @@ class PieChartSample3State extends State {
PieChartData(
pieTouchData: PieTouchData(touchCallback: (pieTouchResponse) {
setState(() {
if (pieTouchResponse.touchInput is FlLongPressEnd ||
pieTouchResponse.touchInput is FlPanEnd) {
touchedIndex = -1;
final desiredTouch = pieTouchResponse.touchInput is! PointerExitEvent &&
pieTouchResponse.touchInput is! PointerUpEvent;
if (desiredTouch && pieTouchResponse.touchedSection != null) {
touchedIndex = pieTouchResponse.touchedSection.touchedSectionIndex;
} else {
touchedIndex = pieTouchResponse.touchedSectionIndex;
touchedIndex = -1;
}
});
}),
Expand Down
5 changes: 3 additions & 2 deletions example/lib/radar_chart/samples/radar_chart_sample1.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:flutter/gestures.dart';

const gridColor = Color(0xff68739f);
const titleColor = Color(0xff8c95db);
Expand Down Expand Up @@ -100,8 +101,8 @@ class _RadarChartSample1State extends State<RadarChartSample1> {
RadarChartData(
radarTouchData: RadarTouchData(touchCallback: (response) {
if (response.touchedSpot != null &&
response.touchInput is! FlPanEnd &&
response.touchInput is! FlLongPressEnd) {
response.touchInput is! PointerUpEvent &&
response.touchInput is! PointerExitEvent) {
setState(() {
selectedDataSetIndex = response?.touchedSpot?.touchedDataSetIndex ?? -1;
});
Expand Down
27 changes: 10 additions & 17 deletions example/lib/scatter_chart/samples/scatter_chart_sample2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class _ScatterChartSample2State extends State {

List<int> selectedSpots = [];

int lastPanStartOnIndex = -1;

@override
Widget build(BuildContext context) {
return AspectRatio(
Expand Down Expand Up @@ -99,21 +97,16 @@ class _ScatterChartSample2State extends State {
tooltipBgColor: Colors.black,
),
touchCallback: (ScatterTouchResponse touchResponse) {
if (touchResponse.touchInput is FlPanStart) {
lastPanStartOnIndex = touchResponse.touchedSpotIndex;
} else if (touchResponse.touchInput is FlPanEnd) {
final FlPanEnd flPanEnd = touchResponse.touchInput;

if (flPanEnd.velocity.pixelsPerSecond <= const Offset(4, 4)) {
// Tap happened
setState(() {
if (selectedSpots.contains(lastPanStartOnIndex)) {
selectedSpots.remove(lastPanStartOnIndex);
} else {
selectedSpots.add(lastPanStartOnIndex);
}
});
}
if (touchResponse.clickHappened && touchResponse.touchedSpot != null) {
final sectionIndex = touchResponse.touchedSpot.spotIndex;
// Tap happened
setState(() {
if (selectedSpots.contains(sectionIndex)) {
selectedSpots.remove(sectionIndex);
} else {
selectedSpots.add(sectionIndex);
}
});
}
},
),
Expand Down
1 change: 0 additions & 1 deletion lib/fl_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export 'src/chart/bar_chart/bar_chart.dart';
export 'src/chart/bar_chart/bar_chart_data.dart';
export 'src/chart/base/axis_chart/axis_chart_data.dart';
export 'src/chart/base/base_chart/base_chart_data.dart';
export 'src/chart/base/base_chart/touch_input.dart';
export 'src/chart/line_chart/line_chart.dart';
export 'src/chart/line_chart/line_chart_data.dart';
export 'src/chart/pie_chart/pie_chart.dart';
Expand Down
Loading

0 comments on commit 6876bdc

Please sign in to comment.