Skip to content

Commit

Permalink
Fixed out of charts tooltips & added date edit null check
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielTavernini committed Sep 16, 2020
1 parent cd2dd2e commit 7908268
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/dateRangeDialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class _DateRangeDialogState extends State<DateRangeDialog> {
initialDate: selectedRange.start
);

if(newDate != selectedRange.start) {
if(newDate != null && newDate != selectedRange.start) {
fromController.text = dateFormat.format(newDate);
selectedRange = DateTimeRange(
start: newDate,
Expand Down Expand Up @@ -127,7 +127,7 @@ class _DateRangeDialogState extends State<DateRangeDialog> {
initialDate: selectedRange.end
);

if(newDate != selectedRange.end) {
if(newDate != null && newDate != selectedRange.end) {
toController.text = dateFormat.format(newDate);
selectedRange = DateTimeRange(
start: selectedRange.start,
Expand Down
34 changes: 34 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,23 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
);

return LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
getTooltipItems: (List<LineBarSpot> touchedBarSpots) {
return touchedBarSpots.map((barSpot) {
if (barSpot.x < start || barSpot.x > end) return null;
return LineTooltipItem(
barSpot.x.toString(),
TextStyle(
color: data.gradientColors[1],
fontWeight: FontWeight.bold,
fontSize: 14
)
);
}).toList();
},
),
),
clipData: FlClipData.horizontal(),
gridData: FlGridData(
show: true,
Expand Down Expand Up @@ -633,6 +650,23 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
);

return LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
getTooltipItems: (List<LineBarSpot> touchedBarSpots) {
return touchedBarSpots.map((barSpot) {
if (barSpot.x < start || barSpot.x > end) return null;
return LineTooltipItem(
barSpot.x.toString(),
TextStyle(
color: data.gradientColors[1],
fontWeight: FontWeight.bold,
fontSize: 14
)
);
}).toList();
},
),
),
clipData: FlClipData.horizontal(),
gridData: FlGridData(
show: true,
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ packages:
name: equatable
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.2.5"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -136,7 +136,7 @@ packages:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
version: "0.4.1+1"
path_parsing:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: A mobile app developed with Flutter to view Covid19 statistics.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 2.0.1+9
version: 2.0.2+9

environment:
sdk: ">=2.2.2 <3.0.0"
Expand Down
Binary file modified repo_files/app-release.apk
Binary file not shown.

0 comments on commit 7908268

Please sign in to comment.