From 4388b222ce6487de75e7930d34cce178ddf2715b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Pedersen?= Date: Sat, 24 Aug 2024 20:49:37 +0200 Subject: [PATCH] Sort exercises alphabetically in dropdown in vizualization tab (#210) * Sort exercises alphabetically in dropdown in viz tab * Linted code --- lib/tabs/visualization.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/tabs/visualization.dart b/lib/tabs/visualization.dart index 6669002..93756d5 100644 --- a/lib/tabs/visualization.dart +++ b/lib/tabs/visualization.dart @@ -49,10 +49,18 @@ class _VisualizationTabState extends State { variables = await _dbHelper.getFitnessData(); } + // fetch data from table final names = variables .map((entry) => entry['exercise'] as String) .toSet() .toList(); + + // sort names if not empty + if (!names.isEmpty) { + names.sort(); + } + + // update states setState(() { _exerciseNames = names; if (_selectedExercise != null) {