fix(ui): Disk chart had too many horizontal grid lines

This commit is contained in:
Inex Code 2024-08-14 08:10:56 +03:00
parent a490f5391b
commit 55d88fe9d4

View file

@ -1,5 +1,3 @@
import 'dart:math';
import 'package:easy_localization/easy_localization.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
@ -63,13 +61,7 @@ class DiskChart extends StatelessWidget {
}
@override
Widget build(final BuildContext context) {
final diskDataMax = [
...diskData.map<List<double>>(
(final disk) => disk.diskData.map((final e) => e.value).toList(),
),
].expand((final x) => x).reduce(max);
return Semantics(
Widget build(final BuildContext context) => Semantics(
label: screenReaderDescription(context),
child: LineChart(
LineChartData(
@ -149,8 +141,9 @@ class DiskChart extends StatelessWidget {
period,
),
style: Theme.of(context).textTheme.labelSmall?.copyWith(
color:
Theme.of(context).colorScheme.onSurfaceVariant,
color: Theme.of(context)
.colorScheme
.onSurfaceVariant,
),
),
),
@ -171,7 +164,7 @@ class DiskChart extends StatelessWidget {
show: true,
drawVerticalLine: true,
verticalInterval: 40,
horizontalInterval: diskDataMax * 2 / 6.5,
horizontalInterval: 25,
getDrawingHorizontalLine: (final value) => FlLine(
color: Theme.of(context).colorScheme.outline.withOpacity(0.3),
strokeWidth: 1,
@ -205,7 +198,6 @@ class DiskChart extends StatelessWidget {
),
),
);
}
bool checkToShowTitle(
final double minValue,