Update breaking fl_chart dependency

This commit is contained in:
Inex Code 2022-04-05 18:50:47 +03:00
parent 073b7bfcb6
commit bef625a934
4 changed files with 83 additions and 51 deletions

View File

@ -35,9 +35,7 @@ class CpuChart extends StatelessWidget {
spots: getSpots(),
isCurved: true,
barWidth: 1,
colors: [
Colors.red,
],
color: Colors.red,
dotData: FlDotData(
show: false,
),
@ -47,28 +45,45 @@ class CpuChart extends StatelessWidget {
maxY: 100,
minX: data.length - 200,
titlesData: FlTitlesData(
topTitles: SideTitles(showTitles: false),
bottomTitles: SideTitles(
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
interval: 20,
rotateAngle: 90.0,
showTitles: true,
getTextStyles: (_, __) => const TextStyle(
fontSize: 10,
color: Colors.purple,
fontWeight: FontWeight.bold,
reservedSize: 50,
getTitlesWidget: (value, titleMeta) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: RotatedBox(
child: Text(bottomTitle(value.toInt()),
style: TextStyle(
fontSize: 10,
color: Colors.purple,
fontWeight: FontWeight.bold,
)),
quarterTurns: 1,
),
getTitles: (value) {
return bottomTitle(value.toInt());
}),
leftTitles: SideTitles(
getTextStyles: (_, __) => progressTextStyleLight.copyWith(
color: Theme.of(context).brightness == Brightness.dark
? BrandColors.gray4
: null,
);
},
showTitles: true,
),
),
leftTitles: AxisTitles(
sideTitles: SideTitles(
getTitlesWidget: (value, titleMeta) {
return Padding(
padding: EdgeInsets.only(right: 15),
child: Text(
value.toInt().toString(),
style: progressTextStyleLight.copyWith(
color: Theme.of(context).brightness == Brightness.dark
? BrandColors.gray4
: null,
),
));
},
interval: 25,
showTitles: false,
),
margin: 15,
interval: 25,
showTitles: true,
),
),
gridData: FlGridData(show: true),

View File

@ -44,7 +44,7 @@ class NetworkChart extends StatelessWidget {
spots: getSpots(listData[0]),
isCurved: true,
barWidth: 1,
colors: [Colors.red],
color: Colors.red,
dotData: FlDotData(
show: false,
),
@ -53,7 +53,7 @@ class NetworkChart extends StatelessWidget {
spots: getSpots(listData[1]),
isCurved: true,
barWidth: 1,
colors: [Colors.green],
color: Colors.green,
dotData: FlDotData(
show: false,
),
@ -67,34 +67,51 @@ class NetworkChart extends StatelessWidget {
1.2,
minX: listData[0].length - 200,
titlesData: FlTitlesData(
topTitles: SideTitles(showTitles: false),
bottomTitles: SideTitles(
topTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)),
bottomTitles: AxisTitles(
sideTitles: SideTitles(
interval: 20,
rotateAngle: 90.0,
showTitles: true,
getTextStyles: (_, __) => const TextStyle(
fontSize: 10,
color: Colors.purple,
fontWeight: FontWeight.bold,
reservedSize: 50,
getTitlesWidget: (value, titleMeta) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: RotatedBox(
child: Text(bottomTitle(value.toInt()),
style: TextStyle(
fontSize: 10,
color: Colors.purple,
fontWeight: FontWeight.bold,
)),
quarterTurns: 1,
),
getTitles: (value) {
return bottomTitle(value.toInt());
}),
leftTitles: SideTitles(
reservedSize: 50,
margin: 5,
interval: [
...listData[0].map((e) => e.value),
...listData[1].map((e) => e.value)
].reduce(max) *
2 /
10,
getTextStyles: (_, __) => progressTextStyleLight.copyWith(
color: Theme.of(context).brightness == Brightness.dark
? BrandColors.gray4
: null,
);
},
showTitles: true,
),
),
leftTitles: AxisTitles(
sideTitles: SideTitles(
reservedSize: 50,
getTitlesWidget: (value, titleMeta) {
return Padding(
padding: EdgeInsets.only(right: 5),
child: Text(
value.toInt().toString(),
style: progressTextStyleLight.copyWith(
color: Theme.of(context).brightness == Brightness.dark
? BrandColors.gray4
: null,
),
));
},
interval: [
...listData[0].map((e) => e.value),
...listData[1].map((e) => e.value)
].reduce(max) *
2 /
10,
showTitles: false,
),
showTitles: true,
),
),
gridData: FlGridData(show: true),

View File

@ -301,7 +301,7 @@ packages:
name: fl_chart
url: "https://pub.dartlang.org"
source: hosted
version: "0.45.0"
version: "0.50.1"
flutter:
dependency: "direct main"
description: flutter

View File

@ -17,7 +17,7 @@ dependencies:
easy_localization: ^3.0.0
either_option: ^2.0.1-dev.1
equatable: ^2.0.3
fl_chart: ^0.45.0
fl_chart: ^0.50.1
flutter:
sdk: flutter
flutter_bloc: ^8.0.1