Skip to content

Commit d5b5b5b

Browse files
Merge pull request #3 from SriramKiranSenthilkumar/master
Committed null safety changes
2 parents fda78cd + f9d7441 commit d5b5b5b

File tree

2 files changed

+26
-29
lines changed

2 files changed

+26
-29
lines changed

lib/main.dart

Lines changed: 24 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ChartApp extends StatelessWidget {
1919

2020
class MyHomePage extends StatefulWidget {
2121
// ignore: prefer_const_constructors_in_immutables
22-
MyHomePage({Key key}) : super(key: key);
22+
MyHomePage({Key? key}) : super(key: key);
2323

2424
@override
2525
_MyHomePageState createState() => _MyHomePageState();
@@ -45,32 +45,29 @@ class _MyHomePageState extends State<MyHomePage> {
4545
height: 500,
4646
width: 320,
4747
child: SfCartesianChart(
48-
backgroundColor: Colors.white,
49-
plotAreaBackgroundColor: Colors.white,
50-
onTooltipRender: (TooltipArgs args) {
51-
if (args.pointIndex == 0) {
52-
//Tooltip without header
53-
args.header = '';
54-
}
55-
if (args.pointIndex == 1) {
56-
//Tooltip with customized header
57-
args.header = 'Sold';
58-
}
59-
if (args.pointIndex == 2) {
60-
//Tooltip with X and Y positions of data points
61-
args.header = 'x : y';
62-
args.text =
63-
'${args.locationX.floor()} : ${args.locationY.floor()}';
64-
}
65-
if (args.pointIndex == 3) {
66-
//Tooltip with formatted DateTime values
67-
List<CartesianChartPoint<dynamic>> chartdata =
68-
args.dataPoints;
69-
args.header =
70-
DateFormat('d MMM yyyy').format(chartdata[3].x);
71-
args.text = '${chartdata[3].y}';
72-
}
73-
},
48+
backgroundColor: Colors.white,
49+
plotAreaBackgroundColor: Colors.white,
50+
onTooltipRender: (TooltipArgs args) {
51+
if (args.pointIndex == 0) {
52+
//Tooltip without header
53+
args.header = '';
54+
}
55+
if (args.pointIndex == 1) {
56+
//Tooltip with customized header
57+
args.header = 'Sold';
58+
}
59+
if (args.pointIndex == 2) {
60+
//Tooltip with X and Y positions of data points
61+
args.header = 'x : y';
62+
args.text = '${args.locationX!.floor()} : ${args.locationY!.floor()}';
63+
}
64+
if(args.pointIndex == 3) {
65+
//Tooltip with formatted DateTime values
66+
List<dynamic>? chartdata = args.dataPoints;
67+
args.header = DateFormat('d MMM yyyy').format(chartdata![3].x);
68+
args.text = '${chartdata[3].y}';
69+
}
70+
},
7471
primaryXAxis: DateTimeAxis(
7572
interval: 30, intervalType: DateTimeIntervalType.days),
7673
// Enable tooltip

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
1818
version: 1.0.0+1
1919

2020
environment:
21-
sdk: ">=2.7.0 <3.0.0"
21+
sdk: ">=2.12.0 <3.0.0"
2222

2323
dependencies:
2424
flutter:
@@ -28,7 +28,7 @@ dependencies:
2828
# The following adds the Cupertino Icons font to your application.
2929
# Use with the CupertinoIcons class for iOS style icons.
3030
cupertino_icons: ^0.1.3
31-
syncfusion_flutter_charts: ^18.1.46
31+
syncfusion_flutter_charts: ^19.1.55+1
3232

3333
dev_dependencies:
3434
flutter_test:

0 commit comments

Comments
 (0)