Add horizontal scrollbars to dashboard panels

This commit is contained in:
Hillel Coren 2023-10-24 12:56:52 +03:00
parent eeed8276ca
commit 9e89e6cc24
1 changed files with 93 additions and 74 deletions

View File

@ -43,6 +43,21 @@ class DashboardChart extends StatefulWidget {
class _DashboardChartState extends State<DashboardChart> {
String? _selected;
int _selectedIndex = 0;
late ScrollController _controller;
@override
void initState() {
super.initState();
_controller = ScrollController();
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
void _onSelectionChanged(charts.SelectionModel model) {
if (widget.onDateSelected == null) {
@ -139,9 +154,12 @@ class _DashboardChartState extends State<DashboardChart> {
Divider(height: 1.0),
LimitedBox(
maxHeight: settings.enableComparison ? 122 : 102,
child: Scrollbar(
controller: _controller,
child: ListView(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
controller: _controller,
children: widget.data!.map((dataGroup) {
final int index = widget.data!.indexOf(dataGroup);
final bool isSelected = index == _selectedIndex;
@ -217,6 +235,7 @@ class _DashboardChartState extends State<DashboardChart> {
}).toList(),
),
),
),
Divider(height: 1.0),
],
SizedBox(