Skip to content

Commit d4bc00b

Browse files
committed
Refactored comments
1 parent 0c0a5b8 commit d4bc00b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/tabs/visualization_tab.dart

+12-10
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class VisualizationTab extends StatefulWidget {
2929

3030
class VisualizationTabState extends State<VisualizationTab> {
3131
String? _selectedExercise;
32-
String _selectedTable = 'Exercise'; // Default selected table
32+
String _selectedTable = 'Exercise';
3333
late String _aggregationMethod;
3434
late String _chartType;
35-
String _dataType = 'Weight'; // Default data type for Fitness table
35+
String _dataType = 'Weight';
3636
List<String> _exerciseNames = [];
3737
List<ScatterSpot> _dataPoints = [];
3838
DateTimeRange? _selectedDateRange;
@@ -44,7 +44,7 @@ class VisualizationTabState extends State<VisualizationTab> {
4444
void initState() {
4545
super.initState();
4646
_initializeDefaults();
47-
_fetchExerciseNames(); // Fetch exercise names initially
47+
_fetchExerciseNames();
4848
}
4949

5050
void _initializeDefaults() {
@@ -231,7 +231,7 @@ class VisualizationTabState extends State<VisualizationTab> {
231231
case 'Weight':
232232
return widget.isKg
233233
? value
234-
: value * 2.20462; // Convert to lbs if needed
234+
: value * 2.20462;
235235
case 'Height':
236236
return value; // Assuming height is already in the desired unit
237237
case 'Age':
@@ -269,6 +269,7 @@ class VisualizationTabState extends State<VisualizationTab> {
269269

270270
// Get the height of the screen
271271
final screenHeight = MediaQuery.of(context).size.height;
272+
272273
// Define the maximum height for the chart as 45% of the screen height
273274
final chartMaxHeight = screenHeight * 0.45;
274275

@@ -291,13 +292,14 @@ class VisualizationTabState extends State<VisualizationTab> {
291292
onChanged: (newValue) {
292293
if (newValue != null && newValue != _selectedTable) {
293294
setState(() {
295+
// reset
294296
_selectedTable = newValue;
295-
_selectedExercise = null; // Reset the selected exercise
296-
_exerciseNames = []; // Clear the exercise names
297-
_dataPoints = []; // Clear the data points
298-
_dataType = 'Weight'; // Reset data type to default
297+
_selectedExercise = null;
298+
_exerciseNames = [];
299+
_dataPoints = [];
300+
_dataType = 'Weight';
299301
});
300-
_fetchExerciseNames(); // Fetch the new exercise names if needed
302+
_fetchExerciseNames();
301303
}
302304
},
303305
hint: 'Select Table',
@@ -311,7 +313,7 @@ class VisualizationTabState extends State<VisualizationTab> {
311313
onChanged: (newValue) {
312314
if (newValue != null) {
313315
setState(() {
314-
_dataPoints = []; // Clear the data points
316+
_dataPoints = []; // reset
315317
_selectedExercise = newValue;
316318
});
317319
_fetchDataPoints(newValue);

0 commit comments

Comments
 (0)